Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Is an analytic solution possible for this problem: find an expression for maximum of power subject to constraints f=0, g=0, h=0? The feasible range is: T1, T2, R, Rthhot, Rthcold, and Z>0.

I know how to solve it using either FindMaximum or Langrage multiplier if I assign numerical values to T1, T2, R, Rthhot, Rthcold, and Z. I'd like to know if it's possible to find an analytic solution if I leave T1, T2, R, Rthhot, Rthcold and Z as parameters

I tried this but it did not work:

f := (X, Y, Rload, Rth, S) -> -(T1 - X)/Rthhot + (X - Y)/Rth + S^2*X*(X - Y)/(R + Rload) + (-1)*0.5*S^2*Rload*(X - Y)^2/(R + Rload)^2;

g := (X, Y, Rload, Rth, S) -> (Y - T2)/Rthcold - (X - Y)/Rth - S^2*Y*(X - Y)/(R + Rload) + (-1)*0.5*S^2*Rload*(X - Y)^2/(R + Rload)^2;

h := (X, Y, Rload, Rth, S) -> S^2*Rth/R - Z;

power := (X, Y, Rload, Rth, S) -> S^2*(X - Y)^2*Rload/(R + Rload)^2;

LagrangeMultipliers(power(X, Y, Rload, Rth, S), [f(X, Y, Rload, Rth, S), g(X, Y, Rload, Rth, S), h(X, Y, Rload, Rth, S)], [X, Y, Rload, Rth, S]);

Hello everybody,

I managed to get to the point that i could start part 2 of the book series of applied Dutch math. 

This paragraph is about Taylor series.

Now i am being asked to find a solution for the taylorseries with a certain x value. That is all fine, Maple can spit it out. But to put in into something that is there with a sum sign in front of it is something else. I have to convert the solution into something that is written with "x to the k-ed, something something". 

Now i did find to solution to a not so complex one. I will add that one on the maple sheet. But there is this one that is really complex, and i cant get my head around how to get to the final solution that makes the sum go and work well. It does have some series to it. But i dont know how to find that one out. Is there some trick to make it work? 

Without further ado:

a.

taylor(1/(3-x), x = 2)

series(1+x-2+(x-2)^2+(x-2)^3+(x-2)^4+(x-2)^5+O((x-2)^6),x = 2,6)

(1)

Sum((x-2)^k, k = 0 .. infinity)

Sum((x-2)^k, k = 0 .. infinity)

(2)

b.

taylor(sqrt(x), x = 1, 16)

series(1+(1/2)*(x-1)-(1/8)*(x-1)^2+(1/16)*(x-1)^3-(5/128)*(x-1)^4+(7/256)*(x-1)^5-(21/1024)*(x-1)^6+(33/2048)*(x-1)^7-(429/32768)*(x-1)^8+(715/65536)*(x-1)^9-(2431/262144)*(x-1)^10+(4199/524288)*(x-1)^11-(29393/4194304)*(x-1)^12+(52003/8388608)*(x-1)^13-(185725/33554432)*(x-1)^14+(334305/67108864)*(x-1)^15+O((x-1)^16),x = 1,16)

(3)

"Sum(((x-1)^(k))/(???????),k=0..infinity)"

8*(1/2); 16*(1/8); 128*(1/16); 256*(1/128); 1024*(1/256); 2048*(1/1024); 32768*(1/2048); 65536*(1/32768); 262144*(1/65536); 524288*(1/262144); 4194304*(1/524288); 8388608*(1/4194304); 33554432*(1/8388608); 67108864*(1/33554432)

4

 

2

 

8

 

2

 

4

 

2

 

16

 

2

 

4

 

2

 

8

 

2

 

4

 

2

(4)

``

Thank you!

Greetings,

The Function

Download Mapleprimes_Book_2_Question_1.mw

I want to compute the series expansion of i3_r wrt (x, y, z) at point (x=y=z=0):

i2   := (x,y) -> -(1/2)*I*(exp(I*x)*(sin(x)/x)-exp(I*y)*(sin(y)/y))/(x-y):
i3_r := -(1/2)*I*(i2(y,z)-i2(y,x))/(z-x);

My first attempt was to compute this mulltiple series expansion this way:

ordre := 3:
sx := convert( series(i3_r, x, ordre), polynom);
sy := convert( series(sx  , y, ordre), polynom);
sz := convert( series(sy  , z, ordre), polynom);

But this gives me sy=sz=0 whatever the expansion order.

I then do this:

sx :=              convert(series(i3_r , x, ordre), polynom):
sy := add(map(u -> convert(series(u    , y, ordre), polynom), [op(expand(sx))])):
sz := add(map(u -> convert(series(u    , z, ordre), polynom), [op(expand(sy))]));

and obtained non zero results for both sy and sz (but are they are correct ?).

Could you explain me what happens and tell me how to find the series expansion of i3_r wrt (x, y, z) ?

TIA

restart

``

with(plots)

 

fixedparameter := [Nb = 0, Nt = 0, Bi = 1000, Le = 10]

[Nb = 0, Nt = 0, Bi = 1000, Le = 10]

(1)

DE1 := diff(f(eta), eta, eta, eta)+f(eta)*(diff(f(eta), eta, eta))-[diff(f(eta), eta)]^2 = 0

diff(diff(diff(f(eta), eta), eta), eta)+f(eta)*(diff(diff(f(eta), eta), eta))-[diff(f(eta), eta)]^2 = 0

(2)

``

DE2 := diff(theta(eta), eta, eta)+Pr*f(eta)*(diff(theta(eta), eta))+Pr*Nb*(diff(theta(eta), eta))*(diff(phi(eta), eta))+Pr*Nt*[diff(theta(eta), eta)]^2 = 0

diff(diff(theta(eta), eta), eta)+Pr*f(eta)*(diff(theta(eta), eta))+Pr*Nb*(diff(theta(eta), eta))*(diff(phi(eta), eta))+Pr*Nt*[diff(theta(eta), eta)]^2 = 0

(3)

DE3 := diff(phi(eta), eta, eta)+Le*(diff(phi(eta), eta))+Nt*(diff(theta(eta), eta, eta))/Nb = 0

diff(diff(phi(eta), eta), eta)+Le*(diff(phi(eta), eta))+Nt*(diff(diff(theta(eta), eta), eta))/Nb = 0

(4)

BC1 := f(0) = 0, f(eta) = 1-exp(-eta), (D(f))(0) = 1, (D(f))(10) = 0

f(0) = 0, f(eta) = 1-exp(-eta), (D(f))(0) = 1, (D(f))(10) = 0

(5)

BC2 := theta(10) = 0, (D(theta))(0) = -Bi*[1-theta(0)]

theta(10) = 0, (D(theta))(0) = -Bi*[1-theta(0)]

(6)

BC3 := phi(0) = 1, phi(10) = 0

phi(0) = 1, phi(10) = 0

(7)

``

L := [0.7e-1, .2, .7, 2, 7, 20, 70]; for k to 7 do R := dsolve(eval({BC1, BC2, BC3, DE1, DE2, DE3}, Pr = L[k]), [f(eta), theta(eta), phi(eta)], numeric, output = listprocedure); Y || k := rhs(R[5]); YP || k := -rhs(R[6]) end do

Error, (in dsolve/numeric/bvp/convertsys) unable to convert to an explicit first-order system

 

 

NULL

Download ODEprobz.mw

H.M.mw

restart

with(plottools):

with(plots):

with(CurveFitting):

with(Statistics):

Digits := 10:

L := point([0, 0, 0], color = blue, symbol = cross, symbolsize = 50), point([0, 0, 1], color = red, symbol = cross, symbolsize = 50), point([0, 1, 0], color = black, symbol = cross, symbolsize = 50):

display(L, axes = boxed, view = [-1 .. 1, -1 .. 1, -1 .. 1], orientation = [125, 65])

 

``

``

``

``

Download H.M.mw

Hi experts,

I have an equation. I tried to use subs command to substitute x with complex number p+iq in this equation and then separate the Re and Im part of the equation, but it does not work.

How can I do this?

How can I plot the Re and Im part of the equation vs y for some different parameters?

Equation:

eq.mw

I would like to open a specially formatted document from start/new document. I set  up one with a fixed width table to make it easy to print to A4. I find the very useful for taking notes.

Currently I just save it as  a usual document. The attached shows the basic setup I use. Contents arn't too relivant.

restart

``

 

 

 

"R(m2,m3,m4,...)≡((2 m2+3 m3+4 m4+...)!)/((1+m2+2 m3+3 m4+...)!m2!m3!m4!...)"

 

 

  

Xterm := factorial(2*m+3*n+4*p+5*q)*c[2]^m*c[3]^n*c[4]^p*c[5]^q/(factorial(1+m+2*n+3*p+4*q)*factorial(m)*factorial(n)*factorial(p)*factorial(q))

factorial(2*m+3*n+4*p+5*q)*c[2]^m*c[3]^n*c[4]^p*c[5]^q/(factorial(1+m+2*n+3*p+4*q)*factorial(m)*factorial(n)*factorial(p)*factorial(q))

(1)

k := 5

5

(2)

x := add(add(add(add(Xterm, q = 0 .. 4*k), p = 0 .. 3*k), n = 0 .. 2*k), m = 0 .. k)

nops(x)

22176

(3)

NULL

nops(TestPoly)

1

(4)

ldegree(TestPoly)

1

(5)

NULL

NULL

NULL
NULL

mtaylor(TestPoly, [c[2], c[3], c[4], c[5]], k+2)

TestPoly

(6)

C1 := 1; C2 := -2; C3 := 3; C4 := -4; C5 := 5

5

(7)

Poly1 := expand((y+C1)*(y+C2)*(y+C3)*(y+C4)*(y+C5))

y^5+3*y^4-23*y^3-51*y^2+94*y+120

(8)

NULL

Poly1 := Poly1/coeff(Poly1, y, 0)

(1/120)*y^5+(1/40)*y^4-(23/120)*y^3-(17/40)*y^2+(47/60)*y+1

(9)

NULL

Poly1 := expand((y+C1)*(y+C2)*(y+C3)*(y+C4)*(y+C5))

y^5+3*y^4-23*y^3-51*y^2+94*y+120

(10)

NULL

Poly1 := Poly1/coeff(Poly1, y, 0)

(1/120)*y^5+(1/40)*y^4-(23/120)*y^3-(17/40)*y^2+(47/60)*y+1

(11)

fsolve(Poly1, y)

-5., -3., -1., 2., 4.

(12)

coeff(Poly1, y, 1)

47/60

(13)

Poly2 := algsubs(y = -z/coeff(Poly1, y, 1), Poly1)

-(6480000/229345007)*z^5+(324000/4879681)*z^4+(41400/103823)*z^3-(1530/2209)*z^2-z+1

(14)

"(->)"

-0.28254e-1*z^5+0.66398e-1*z^4+.39876*z^3-.69262*z^2-1.*z+1.

(15)

"(->)"

 

solve(Poly2, z)

-47/30, -47/15, 47/12, 47/20, 47/60

(16)

-%/coeff(Poly1, y, 1)

2, 4, -5, -3, -1

(17)

NULL

 

 

``

``

NULL

Download A4_format.mw

How to add any/many subprocedure in a mainprocedure?
Somehow the mainprocedure must deliver the input for the mainprocedure

Here is a example 

Note: probably can this old procedure be rewritten in modern Maple programming language ?  

restart;

 

Code to Find the Max and Min Values in a List A

 

maxmin:=proc(A,maxv::evaln,minv::evaln)

   local i;

   maxv:=A[1]; minv:=A[1];

   for i from 2 to nops(A) do

     if eval(maxv) < A[i] then maxv:=A[i] end if;

     if eval(minv) > A[i] then minv:=A[i] end if;

   end do;

   RETURN()

end proc:

 

Now we can call the maxmin procedure from a procedure named optimize, which is designed to create the polygonal approximation, use maxmin to find the largest and smallest y-values from among the vertices, and produce some graphic output.

See the documentation in the book.

 

Code to Approximate the Max and Min Values of a Function  f :

 

optimize:=proc(f,a,b,N,pic::evaln)

  local X,Y,L,i,A,xmax,xmin;

  X:=array(0..N);Y:=array(0..N);L:=array(0..N);

  with(plots,display);

  for i from 0 to N do

    X[i]:=evalf(a+i*(b-a)/N);

    Y[i]:=f(X[i]);

    L[i]:=plot([[X[i],0],[X[i],Y[i]]],color=black):

  end do;

  A:=[seq(Y[i-1],i=1..N+1)];

  maxmin(A,maxv,minv); # USE OF SECOND PROCEDURE --------------

  xmax:={};xmin:={};

  for i from 0 to N do

    if Y[i]=maxv then xmax:=xmax union {X[i]} end if;

    if Y[i]=minv then xmin:=xmin union {X[i]} end if;

  end do; #----------------------------------------------------

  pic:=display({seq(L[i],i=1..N)}):

  print(`maximum y value is`,maxv,`and occurs at these x values`,xmax);

  print(`minimum y value is`,minv,`and occurs at these x values`,xmin);

  end proc:

 

Note that you must execute the code that defines maxmin before the procedure optimize will work. This only make sense.

 

We test the optimize procedure with the following function

 

f:=x->3+10*(-x^2+x^4)*exp(-x^2);

proc (x) options operator, arrow; 3+10*(-x^2+x^4)*exp(-x^2) end proc

(1)

on the interval [-1, 4].

 

optimize(f,-1,4,150,pic);

`maximum y value is`, 6.088066652, `and occurs at these x values`, {1.633333333}

 

`minimum y value is`, 1.391538737, `and occurs at these x values`, {-.6333333333, .6333333333}

(2)

pic;

 

 

Download procedure_en_subprocedures.mw

Hi. 

Just trying to replicate a calculation, I would expect close to absolute zero, but my units are out

Black_hole_temp.mw

finite difference method 

restart

with(ODETools)

unprotect('gamma')

unprotect(GAMMA)

Digits := 3

M := M; delta := delta; Ec := Ec; Pr := Pr; A := A; GAMMA := GAMMA; gamma := gamma; Q := Q; R := R; S := S; Sc := Sc

M

 

delta

 

Ec

 

Pr

 

A

 

GAMMA

 

gamma

 

Q

 

R

 

S

 

Sc

(1)

ODE1 := d(1+GAMMA)*(diff(f(eta), eta, eta, eta, eta))-S*(eta*(diff(f(eta), eta, eta, eta))+3*(diff(f(eta), eta, eta))+(diff(f(eta), eta))(diff(f(eta), eta, eta))-f(eta)*(diff(f(eta), eta, eta, eta)))-GAMMA*delta(2*(diff(f(eta), eta, eta))*(diff(f(eta), eta, eta, eta))^2+(diff(f(eta), eta, eta))^2*(diff(f(eta), eta, eta, eta, eta)))-M^2*(diff(f(eta), eta, eta)) = 0

d(1+GAMMA)*(diff(diff(diff(diff(f(eta), eta), eta), eta), eta))-S*(eta*(diff(diff(diff(f(eta), eta), eta), eta))+3*(diff(diff(f(eta), eta), eta))+(diff(f(eta), eta))(diff(diff(f(eta), eta), eta))-f(eta)*(diff(diff(diff(f(eta), eta), eta), eta)))-GAMMA*delta(2*(diff(diff(f(eta), eta), eta))*(diff(diff(diff(f(eta), eta), eta), eta))^2+(diff(diff(f(eta), eta), eta))^2*(diff(diff(diff(diff(f(eta), eta), eta), eta), eta)))-M^2*(diff(diff(f(eta), eta), eta)) = 0

(2)

ODE2 := (1+4*R*(1/3))*(diff(theta(eta), eta, eta))+Pr*S*(f(eta)*(diff(theta(eta), eta))-eta*(diff(theta(eta), eta))+Q*theta(eta)) = 0

(1+(4/3)*R)*(diff(diff(theta(eta), eta), eta))+Pr*S*(f(eta)*(diff(theta(eta), eta))-eta*(diff(theta(eta), eta))+Q*theta(eta)) = 0

(3)

ODE3 := diff(phi(eta), eta, eta)+Sc*S*(f(eta)*(diff(phi(eta), eta))-eta*(diff(phi(eta), eta)))-Sc*gamma*phi(eta) = 0

diff(diff(phi(eta), eta), eta)+Sc*S*(f(eta)*(diff(phi(eta), eta))-eta*(diff(phi(eta), eta)))-Sc*gamma*phi(eta) = 0

(4)

bc := f(0) = 0, (D(f))(0)^2 = 0, f(1) = 1, (D(f))(1) = 0, (D(theta))(0) = 0, theta(1) = 1, (D(phi))(0) = 0, phi(1) = 1

f(0) = 0, (D(f))(0)^2 = 0, f(1) = 1, (D(f))(1) = 0, (D(theta))(0) = 0, theta(1) = 1, (D(phi))(0) = 0, phi(1) = 1

(5)

``

(6)

parameter := [S = .5, GAMMA = .1, delta = .1, gamma = .1, M = 1, Pr = 1, Ec = .2, Sc = .6, R = 1, Q = 1]

[S = .5, GAMMA = .1, delta = .1, gamma = .1, M = 1, Pr = 1, Ec = .2, Sc = .6, R = 1, Q = 1]

(7)

SOL := dsolve({bc, subs(parameter, ODE1), subs(parameter, ODE2), subs(parameter, ODE3)}, type = numeric, method = bvp[middefer], output = listprocedure)

Error, (in fproc) unable to store '15.0099999999999998/d(1.1)' when datatype=float[8]

 

Sol := dsolve({bc, subs(parameter, ODE1), subs(parameter, ODE2), subs(parameter, ODE3)}, type = numeric, method = bvp[middefer], output = listprocedure, initmesh = 1024, abserr = 0.1e3)

Error, (in fproc) unable to store '15.0099999999999998/d(1.1)' when datatype=float[8]

 

SOL(1)

SOL(1)

(8)

NULL

``

Download FDM_EYRING_POWELL.mw

I can't move files in the navigator window anymore in Maple 2021.2.

Anyone else with the same problems?

sometimes complicated equation is generated and attempt to solve it fail, which is OK. But there is a case, where Maple generates an internal error from solve(). The problem is that it is not possible to even capture this error using try...catch... end try so the whole program crashes.

Is there a way to trap such errors, so at least it can bypass it without solving it but without terminating the whole program? 

According to help it says

The try statement provides a mechanism for executing statements in a controlled environment, where errors will not just cause the execution to halt with no warning.

Well. The above is not really true.

interface(version);

`Standard Worksheet Interface, Maple 2021.2, Windows 10, November 23 2021 Build ID 1576349`

Physics:-Version()

`The "Physics Updates" version in the MapleCloud is 1115 and is the same as the version installed in this computer, created 2021, December 15, 10:0 hours Pacific Time.`

restart;

eq:=-t^m*y+1/12*(-6*(-(108+12*(6144*(t^m)^3*y^3+81)^(1/2))^(2/3)+96*t^m*y)/(108+12*(6144*(t^m)^3*y^3+81)^(1/2))^(1/3))^(1/2)+1/12*6^(1/2)*((-(-6*(-(108+12*(6144*(t^m)^3*y^3+81)^(1/2))^(2/3)+96*t^m*y)/(108+12*(6144*(t^m)^3*y^3+81)^(1/2))^(1/3))^(1/2)*(108+12*(6144*(t^m)^3*y^3+81)^(1/2))^(2/3)+96*t^m*y*(-6*(-(108+12*(6144*(t^m)^3*y^3+81)^(1/2))^(2/3)+96*t^m*y)/(108+12*(6144*(t^m)^3*y^3+81)^(1/2))^(1/3))^(1/2)+72*(108+12*(6144*(t^m)^3*y^3+81)^(1/2))^(1/3))/(108+12*(6144*(t^m)^3*y^3+81)^(1/2))^(1/3)/(-6*(-(108+12*(6144*(t^m)^3*y^3+81)^(1/2))^(2/3)+96*t^m*y)/(108+12*(6144*(t^m)^3*y^3+81)^(1/2))^(1/3))^(1/2))^(1/2) = t^(m-1)*(-y+1/12*(-6*(-(108+12*(6144*y^3+81)^(1/2))^(2/3)+96*y)/(108+12*(6144*y^3+81)^(1/2))^(1/3))^(1/2)+1/12*6^(1/2)*((-(-6*(-(108+12*(6144*y^3+81)^(1/2))^(2/3)+96*y)/(108+12*(6144*y^3+81)^(1/2))^(1/3))^(1/2)*(108+12*(6144*y^3+81)^(1/2))^(2/3)+96*y*(-6*(-(108+12*(6144*y^3+81)^(1/2))^(2/3)+96*y)/(108+12*(6144*y^3+81)^(1/2))^(1/3))^(1/2)+72*(108+12*(6144*y^3+81)^(1/2))^(1/3))/(108+12*(6144*y^3+81)^(1/2))^(1/3)/(-6*(-(108+12*(6144*y^3+81)^(1/2))^(2/3)+96*y)/(108+12*(6144*y^3+81)^(1/2))^(1/3))^(1/2))^(1/2)):

sol:=solve(eq,m)  assuming t>0;

Error, (in PolynomialSystemSolvers:-PseudoResultant) too many levels of recursion

try
    sol:=solve(eq,m)  assuming t>0;
catch:
    print("Cought error");
end try;

Error, (in PolynomialSystemSolvers:-PseudoResultant) too many levels of recursion

 

Download dec_16_2021.mw

Other than saving few bytes of memory, why would one use ::static for methods of Object?

I found that if I use ::static, then I have to add prefix _self:- each time an object data member is referenced anywhere, making the code very hard to read.

Imagine having to write  _self:-x + 3* _self:-x^2 + 2* _self:-y^3 and so on all the time, instead of just x+3*x^2+2*y^3. (where it is assumed here that x,y happened to be object private data members and not local variables for a proc inside the module).

But then I found if I remove  ::static now _self:- no longer needed and can still get the benefit of using the object and the code works as before, but the code is now much more readable. 

I know that by not using static, then a copy of each method is made for each new object.

I am OK with that. As I do not use that many objects any way (few at a time before GC cleans the ones I used).

But the benefit of much more readable code far outweights the little extra memory needed, and memory is cheap these days anyway. I got lots of RAM. An extra few MB's is not a big deal.

What Am I missing here? Why does all the Maple help and documenation say that one should use static for object methods then? But do not mention that by not using static:: then the code will become more readable since _self:- is not needed to be appeneded to each variable or method name.

Here is an example below to compare. 

First example uses ::static methods, and the second does not.

One can see the difference The code is more clear in the second.   Is there something else I am overlooking by not using ::static . I am still learning OOP in Maple, and could be overlooking something else. I definitly do not want to code using _self:-variable_name all the time if I have to use OOP in Maple as it makes the code hard to read. 

Notice that in both examples, and for the exported methods, I used _self as first argument. This is OK. This is meant to allow client of the object to call it using object:-method() syntax which is what I prefer instead of method(object,....). syntax.

I am talking about the execssive use of _self internal to the module/object code when having to use ::static. methods.

restart;

person_class_STATIC:=module()
   option object;
   local age:=5;   

   export set_age::static:=proc(_self,age,$)      
     _self:-age:=age:
   end proc:      

   export update_age::static:=proc(_self,age,$)      
      do_the_update(_self)
   end proc:      

   local do_the_update::static:=proc(_self,$)
      _self:-age:=_self:-age+1;
      _self:-age:=sqrt(_self:-age^2+3);
   end proc;

   export get_age::static:=proc(_self,$)      
     return _self:-age;
   end proc:      

end module:

o:=Object(person_class_STATIC);
o:-set_age(100);
o:-get_age();
o:-update_age();

o2:=Object(person_class_STATIC);
o2:-get_age();

_m1982588380672

100

100

2*2551^(1/2)

_m1982698669216

5

person_class_NO_STATIC:=module()
   option object;
   local age:=5;   

   export set_age:=proc(_self,_age,$)      
     age:=_age:
   end proc:      

   export update_age:=proc(_self,$)      
      do_the_update()
   end proc:      

   local do_the_update:=proc()
      age:=age+1;
      age:=sqrt(age^2+3);
   end proc;

   export get_age:=proc(_self,$)      
     return age;
   end proc:      

end module:

o:=Object(person_class_NO_STATIC);
o:-set_age(100);
o:-get_age();
o:-update_age();

o2:=Object(person_class_NO_STATIC);
o2:-get_age();

_m1982698652256

100

100

2*2551^(1/2)

_m1982698629312

5

 

Download OOP.mw

Without trying it or looking down more, should these two code fragments give same output or not

# CASE 1

restart;
A   :=   2;
B   :=   x+2*y;
t^2 * ( A * B );


#CASE 2
restart;
t^2*( 2 * (x+2*y)  );

One would expect both to give same output, right? CASE 1 just uses variables and CASE 2 just uses the values of these variables. I mean the semantics of CASE 1 and 2 are the same, given that Maple replaces each variable with its value when evaluating.

But Maple does not give same result.

One way to force same result when using variables is to use t^2*(eval(A*B));

My question is why CASE 1 gives different result from CASE 2?  I would have expected same output.

Maple 2021.2 on windows 10. Worksheet.

interface(version);

`Standard Worksheet Interface, Maple 2021.2, Windows 10, November 23 2021 Build ID 1576349`

restart;

A:=2;
B:=x+2*y;
t^2*(A*B);

2

x+2*y

2*t^2*(x+2*y)

restart;

t^2*(2*(x+2*y));

t^2*(2*x+4*y)

restart;

A:=2;
B:=x+2*y;
t^2*(eval(A*B));

2

x+2*y

t^2*(2*x+4*y)

 

Download why_different.mw

First 349 350 351 352 353 354 355 Last Page 351 of 2216