MaplePrimes Questions

I learnt that MapleFlow (MF) was a product similar (and better) than MathCad (MC). I have a old copy of MC, v.11 (with Maple symbolic engine) and I compared it with MF from my engineering dep. 

Can one kindly explain why Sum of a simple Matrix does not work, if the index is placed as exponent? Here what I did:

 

Dear all,

I have the following partial differential equation. I want all terms with 'diff' to be moved to the left side of the equation and all source terms to be moved to the right side of the equation.

diff(u(x, t), t, t) + 3 + 2*diff(u(x, t), t) + 4*t + x^2 + x^3/3 + diff(u(x, t), t, x, x) + diff(u(x, t), x, x, x, x) = x*t^2;

Is there a comprehensive solution for such purposes?

The desired result:

diff(u(x, t), t, t) + 2*diff(u(x, t), t) +  diff(u(x, t), t, x, x) + diff(u(x, t), x, x, x, x) = x*t^2-x^3/3 -x^2-4*t -3;

Can anyone guide me?

Best wishes,

Why Maple gives this error on solving first order linear ode using ODESteps? 

26004

interface(version);

`Standard Worksheet Interface, Maple 2024.0, Windows 10, March 01 2024 Build ID 1794891`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1744 and is the same as the version installed in this computer, created 2024, April 17, 19:33 hours Pacific Time.`

ode:=diff(y(x),x)+x*y(x)=1;
ic:=y(0)=0;
dsolve([ode,ic]);

diff(y(x), x)+x*y(x) = 1

y(0) = 0

y(x) = -((1/2)*I)*exp(-(1/2)*x^2)*Pi^(1/2)*2^(1/2)*erf(((1/2)*I)*2^(1/2)*x)

Student:-ODEs:-ODESteps([ode,ic])

Error, (in Student:-ODEs:-OdeSolveOrder1) invalid input: too many and/or wrong type of arguments passed to solve; first unused argument is _C1

 

 

Download odesteps_fail_may_10_2024.mw

ps. also reported to Maplesoft customer support.

Under piecewise in ?updates,Maple2024,AdvancedMath I find

{simplify,combine}(piecewise(x <= 0, 2*ln(1 - x), 0 < x, ln((x - 1)^2))) assuming (x, real);
                         /  /       2\\ 
                        { ln\(x - 1) / }
                         \            / 

Same result without simplify

{combine}(piecewise(x <= 0, 2*ln(1 - x), 0 < x, ln((x - 1)^2))) assuming (x, real);
                         /  /       2\\ 
                        { ln\(x - 1) / }
                         \            / 

What I do not understand is the grouping of simplify and combine in a set. This looks like a function composition which is normally done with the composition operator

(simplify@combine)(expr)

Asking differently: What is

{simplify,combine}(expr)

supposed to do in the examples?


Why sorting these 4 vectors wrt L(+oo) norm returns a correct result bur sorting them wrt L2 norm doesn't (unless if I evaluate the norms as floats)?
 

restart:

kernelopts(version)

`Maple 2015.2, APPLE UNIVERSAL OSX, Dec 20 2015, Build ID 1097895`

(1)

V := [seq(LinearAlgebra:-RandomVector(2, generator=1..10), k=1..4)];

N2   := evalf(norm~(V, 2));
Ninf := norm~(V, +infinity);

V := [Vector(2, {(1) = 3, (2) = 5}), Vector(2, {(1) = 8, (2) = 7}), Vector(2, {(1) = 4, (2) = 5}), Vector(2, {(1) = 6, (2) = 2})]

 

[5.830951895, 10.63014581, 6.403124237, 6.324555320]

 

[5, 8, 5, 6]

(2)

Sorting wrt L(+oo) norm

sort(V, key=(t -> norm(t, +infinity)));  # correct

[Vector(2, {(1) = 3, (2) = 5}), Vector(2, {(1) = 4, (2) = 5}), Vector(2, {(1) = 6, (2) = 2}), Vector(2, {(1) = 8, (2) = 7})]

(3)

Sorting wrt L(2) norm

sort(V, key=(t -> norm(t, 2))); # not correct
is(norm(V[4], 2) < norm(V[3], 2));

[Vector(2, {(1) = 3, (2) = 5}), Vector(2, {(1) = 4, (2) = 5}), Vector(2, {(1) = 8, (2) = 7}), Vector(2, {(1) = 6, (2) = 2})]

 

true

(4)

sort(V, key=(t -> evalf(norm(t, 2)))); # correct

[Vector(2, {(1) = 3, (2) = 5}), Vector(2, {(1) = 6, (2) = 2}), Vector(2, {(1) = 4, (2) = 5}), Vector(2, {(1) = 8, (2) = 7})]

(5)

 


 

Download SortingVectors.mw


TIA

trouverTripletsDecroissants := proc(tripletInitial) local m, n, a, b, c, triplets, dernierTriplet; triplets := []; dernierTriplet := tripletInitial; m := dernierTriplet[3]; do m := m - 1; for n to m - 1 do if igcd(m, n) = 1 and (m - n) mod 2 = 1 then a := m^2 - n^2; b := 2*m*n; c := m^2 + n^2; if a^2 + b^2 = c^2 and a < dernierTriplet[1] and b < dernierTriplet[2] and c < dernierTriplet[3] then dernierTriplet := [a, b, c]; triplets := [op(triplets), dernierTriplet]; break; end if; end if; end do; break; if 0 < nops(triplets); end do; return triplets; end proc;
tripletInitial := [275, 252, 373];
tripletsDecroissants := trouverTripletsDecroissants(tripletInitial);
print(tripletsDecroissants);
               tripletInitial := [275, 252, 373]

           tripletsDecroissants := [[273, 136, 305]]

                       [[273, 136, 305]]

;
trouverTripletsDecroissants(275, 252, 373);
Error, (in trouverTripletsDecroissants) final value in for loop must be numeric or character
How to correct this error. Thank you.

I want to rescale a projective vector. Have been using gcd on the numerators and denominators. This works in simple situations. It doesn;t work well here, admitadely the points have been just made up for the question.  Square roots seem to make it mal-preform. I run into a lot of squate roots in symbolic situations. What would be a better way? I have been wondering if frontend would help?

restart

Prntmsg::boolean:=true;
Normalise_Projective_Point:=1;
ReScl::boolean:=true;

true

 

1

 

true

(1)

 

ProjLP:=overload([

      proc(A::Vector[row],B::Vector[row],prnt::boolean:=Prntmsg)
      description "2 projective points to create a projective line vector";
      option overload;
      local Vp ,gcdn,gcdd,vp ;
      uses LinearAlgebra;
       
      Vp:=CrossProduct(A,B)^%T;#print("2nd ",Vp);
      if ReScl then
         gcdn := gcd(gcd(numer(Vp[1]),numer(Vp[2])), numer(Vp[3]));
         gcdd := gcd(gcd(denom(Vp[1]),denom(Vp[2])), denom(Vp[3]));
         Vp:=simplify(Vp*gcdd/gcdn);
      end if;
      if Prntmsg then
         print("Line vector from two projective points. " );
      end if;
      return Vp
      end proc,



      proc(A::Vector[column],B::Vector[column],prnt::boolean:=Prntmsg)
      description "2 lines to get intersection projective point";
      option overload;
      uses LinearAlgebra;
      local  Vp;
    
      Vp:=CrossProduct(A,B)^%T;
     
     
      if Vp[3]<>0 and Normalise_Projective_Point<>0 then
           Vp:=Vp/Vp[3];
      end if;
      if Prntmsg then
           print("Meet of two Lines ");
      end if;
      return Vp
   end proc
     
]);

 

proc () option overload; [proc (A::(Vector[row]), B::(Vector[row]), prnt::boolean := Prntmsg) local Vp, gcdn, gcdd, vp; option overload; description "2 projective points to create a projective line vector"; Vp := LinearAlgebra:-CrossProduct(A, B)^%T; if ReScl then gcdn := gcd(gcd(numer(Vp[1]), numer(Vp[2])), numer(Vp[3])); gcdd := gcd(gcd(denom(Vp[1]), denom(Vp[2])), denom(Vp[3])); Vp := simplify(Vp*gcdd/gcdn) end if; if Prntmsg then print("Line vector from two projective points. ") end if; return Vp end proc, proc (A::(Vector[column]), B::(Vector[column]), prnt::boolean := Prntmsg) local Vp; option overload; description "2 lines to get intersection projective point"; Vp := LinearAlgebra:-CrossProduct(A, B)^%T; if Vp[3] <> 0 and Normalise_Projective_Point <> 0 then Vp := Vp/Vp[3] end if; if Prntmsg then print("Meet of two Lines ") end if; return Vp end proc] end proc

(2)

#maplemint(ProjLP)

pt1:=<a|sqrt(b^2+c^2)|1>:
pt2:=<c|sqrt(b^2+a^2)|1>:
pt3:=<f^2/sqrt(a^2+b^2)|f^2/sqrt(c^2+b^2)+sqrt(a^2+b^2)|1>:
pt4:=<b^2/sqrt(a^2+b^2)|f^2/sqrt(c^2+b^2)-sqrt(a^2+b^2)|1>:

 

l1:=ProjLP(pt1,pt2)

"Line vector from two projective points. "

 

Vector[column](%id = 36893490491002736020)

(3)

l2:=ProjLP(pt3,pt4)

"Line vector from two projective points. "

 

Vector[column](%id = 36893490491002712420)

(4)

l3:=ProjLP(pt1,pt4)

"Line vector from two projective points. "

 

Vector[column](%id = 36893490491064062908)

(5)

l4:=ProjLP(pt2,pt4)

"Line vector from two projective points. "

 

Vector[column](%id = 36893490491064037372)

(6)

pl1l2:=simplify(ProjLP(l1,l2))

"Meet of two Lines "

 

Vector[row](%id = 36893490491002741932)

(7)

pl2l3:=simplify(ProjLP(l2,l3))

"Meet of two Lines "

 

Vector[row](%id = 36893490491113907252)

(8)

(ProjLP(pl1l2,pl2l3));
length(%)

"Line vector from two projective points. "

 

Vector[column](%id = 36893490491113907972)

 

6223

(9)

ReScl:=false

false

(10)

# doing nothing seems to work better here than rescaling

(ProjLP(pl1l2,pl2l3));
length(%)

"Line vector from two projective points. "

 

Vector[column](%id = 36893490491125667468)

 

2796

(11)

 


 

Download 2024-05-09_Q_Rescale_projective_vector.mw

Hi,

just a simple question: Is it possible to write procedures in Mapleflow, like (this is just a simple example, not what I would like to code!):

add4:=proc(a,b,c,d) a+b+c+d end proc

and, if so, how to do it? I've tried the above code but got the error

"expecting operator"

Hi everyone,

I'm having trouble in maple to do the following:
Plot the curve x^3-4xy+2y^3=0 , as x variesbetween -3 and 3 with the aid of the implicitplot command

find dy/dx at all points (x,y) on the curve for which x=1. and find the equations of the lines tangent to the curve at the points

plot the curve and tangent lines on the same set of axes

Any help would be appreciated , thank you.

I'm new to Mapple 2024, and probably miss something.
lie, e[i] i=1..4, and G are previously defined objects. Then whe I define:

cf:=(k,l,m,t,x,y,z)->seq(lie(p,e[k](t,x,y,z),e[l](t,x,y,z))*G(t,x,y,z)[p,m],p=1..4);
cf(2,4,2,t,x,y,z);

I get:

0, 0, 0, -6*(-6*z^3*(7*z - 4)*(z - 1)^2*(y^2 - 1)^3*(x^2 - 1)^2*x - 6*z^4*(1 - z)^3*(-x^2 + 1)^2*(-y^2 + 1)^3*x*(-3*z^2*(7*z - 4)*(z - 1)^2*(y^2 - 1)^3*(x^2 - 1)^3 - 7*z^3*(z - 1)^2*(y^2 - 1)^3*(x^2 - 1)^3 - 2*z^3*(7*z - 4)*(z - 1)*(y^2 - 1)^3*(x^2 - 1)^3) - (1 - z^3*(7*z - 4)*(z - 1)^2*(y^2 - 1)^3*(x^2 - 1)^3)*(-24*z^3*(1 - z)^3*(-x^2 + 1)^2*(-y^2 + 1)^3*x + 18*z^4*(1 - z)^2*(-x^2 + 1)^2*(-y^2 + 1)^3*x))*z^4*(1 - z)^3*(-x^2 + 1)^2*(-y^2 + 1)^3*x*(1 - z^3*(7*z - 4)*(z - 1)^2*(y^2 - 1)^3*(x^2 - 1)^3)

The 4th item eval as:
cf(2, 4, 2, t, x, y, z)[4] = -36*z^10*x^2*(x^2 - 1)^7*(7*z^2 - 8*z + 4)*(z - 1)^7*(y^2 - 1)^9*(-1 + z^3*(7*z - 4)*(z - 1)^2*(y^2 - 1)^3*(x^2 - 1)^3)

But when I define another function by just changing the seq operator with a sum operator:

cf2:=(k,l,m,t,x,y,z)->sum(lie(p,e[k](t,x,y,z),e[l](t,x,y,z))*G(t,x,y,z)[p,m],p=1..4);
cf2(2,4,2,t,x,y,z);

I get 0.

What do I miss ?

I want to define an alias L_2 in terms of another alias L_1, the latter being a RootOf(). I noticed that doing the following does not work: alias_in_alias.mw. How to fix it? Should I define the two alias sequantially? That is, L_1 first and then (in a follow up alias()) L_2?

Sorry for the super complicated expressions. You could perhaps show me with a simpler example. Thanks!

This is my code
 

restart;
with(Student:-MultivariateCalculus);
A := [0, 0, 0];
B := [a, 0, 0];
C := [a, a, 0];
DD := [0, a, 0];
S := [0, 0, h];
d1 := Line(A, C);
d2 := Line(S, DD);
(Distance(d1, d2) assuming (a::positive and h::positive));

I got 

abs(a)^2*abs(h)/sqrt(2*abs(a*h)^2 + abs(a)^4)

How can I remove abs?

Using with(plots) and with(plottools), how do you change the color of the line enclosing a disk? I can change the line style of the line, but I can't figure out how to change the color of the line. I didn't find anything in plot options that would fit my purpose.

how_do_i_change_the_color_of_the_line_around_a_disk_while_using_plottools.mw

I am trying to verify a solution by checking whether eval() returns 0 but it's taking me forever. If I recall correctly it once returned [0,0] so I am quite confident that the first and only positive root of that polynomial solves my system. I am now running again the same calculation but somehow eval() is stuck in "Evaluating...". I am not sure if it matters here, but parameters gamma, sigma_v, and sigma_d are strictly positive while -1<rho<+1 (rho is a correlation coefficient). 

How else can I verify such solution?

EDIT: THIS IS NOT A DUPLICATE QUESTION AND SHOULDN'T BE TAGGED AS SUCH

restart;

local gamma:

Equations:

eq1 := (gamma*sigma__v^2*(-1 + rho__v) - 2*lambda__2)*(rho__v*sigma__v^2 + sigma__v^2)/((2*gamma*(lambda__1 + lambda__2)*(-1 + rho__v)*sigma__v^2 - 8*lambda__1*lambda__2)*((gamma*sigma__v^2*(-1 + rho__v) - 2*lambda__2)^2*(2*rho__v*sigma__v^2 + 2*sigma__v^2)/(2*gamma*(lambda__1 + lambda__2)*(-1 + rho__v)*sigma__v^2 - 8*lambda__1*lambda__2)^2 + (-lambda__1*(gamma*sigma__v^2*(-1 + rho__v) - 4*lambda__2)/(2*gamma*(lambda__1 + lambda__2)*(-1 + rho__v)*sigma__v^2 - 8*lambda__1*lambda__2) + 1)^2*sigma__d^2 + gamma^2*lambda__2^2*sigma__v^4*(-1 + rho__v)^2*sigma__d^2/(2*gamma*(lambda__1 + lambda__2)*(-1 + rho__v)*sigma__v^2 - 8*lambda__1*lambda__2)^2)):

eq2 := (gamma*sigma__v^2*(-1 + rho__v) - 2*lambda__1)*(rho__v*sigma__v^2 + sigma__v^2)/((2*gamma*(lambda__1 + lambda__2)*(-1 + rho__v)*sigma__v^2 - 8*lambda__1*lambda__2)*((gamma*sigma__v^2*(-1 + rho__v) - 2*lambda__1)^2*(2*rho__v*sigma__v^2 + 2*sigma__v^2)/(2*gamma*(lambda__1 + lambda__2)*(-1 + rho__v)*sigma__v^2 - 8*lambda__1*lambda__2)^2 + (-(gamma*sigma__v^2*(-1 + rho__v) - 4*lambda__1)*lambda__2/(2*gamma*(lambda__1 + lambda__2)*(-1 + rho__v)*sigma__v^2 - 8*lambda__1*lambda__2) + 1)^2*sigma__d^2 + gamma^2*lambda__1^2*sigma__v^4*(-1 + rho__v)^2*sigma__d^2/(2*gamma*(lambda__1 + lambda__2)*(-1 + rho__v)*sigma__v^2 - 8*lambda__1*lambda__2)^2)):

Eq1, Eq2 := eq1 - lambda__1, eq2 - lambda__2:

Solution:

Gamma := gamma*sigma__v*sigma__d:
L__2 := RootOf(-8*(rho + 1)^4*_Z^4 + 12*(rho + 1)^3*Gamma*(rho - 1)*_Z^3 - 5*(rho + 1)^2*(-4/5 + Gamma^2*rho^2 + 2*(-2/5 - Gamma^2)*rho + Gamma^2)*_Z^2 - 4*(rho + 1)*Gamma*(rho^2 - 1)*_Z + Gamma^2*(rho + 1)*(rho - 1)^2);
l__2 := L__2*sigma__v*(rho__v + 1)/sigma__d:
quartic_solution := lambda__2 = simplify(allvalues~([l__2]))[1]:

RootOf((8*rho^3+24*rho^2+24*rho+8)*_Z^4+(-12*gamma*rho^3*sigma__d*sigma__v-12*gamma*rho^2*sigma__d*sigma__v+12*gamma*rho*sigma__d*sigma__v+12*gamma*sigma__d*sigma__v)*_Z^3+(5*gamma^2*rho^3*sigma__d^2*sigma__v^2-5*gamma^2*rho^2*sigma__d^2*sigma__v^2-5*gamma^2*rho*sigma__d^2*sigma__v^2+5*gamma^2*sigma__d^2*sigma__v^2-4*rho^2-8*rho-4)*_Z^2+(4*gamma*rho^2*sigma__d*sigma__v-4*gamma*sigma__d*sigma__v)*_Z-gamma^2*sigma__v^2*sigma__d^2*rho^2+2*rho*gamma^2*sigma__v^2*sigma__d^2-gamma^2*sigma__v^2*sigma__d^2)

(1)

Check: TOO SLOW

simplify(eval([eval(Eq1, lambda__1 = lambda__2), eval(Eq2, lambda__1 = lambda__2)], quartic_solution));


 

Download solution_check.mw

Hi,

I was just wondering if there is a init file for the Windows version of Maple, like there is one for the LInux version.

I'm not talking about the Maple.ini file located in the user's Application Data folder. In the Linux version, there is a file, .mapleinit, where you can place all of your initialization setups, like the packages you want to automatically load with the worksheet, defining constants, etc.

If someone has any ideas, I really appreciate it. Thanks very much in advance.

2 3 4 5 6 7 8 Last Page 4 of 2323