Maple 2022 Questions and Posts

These are Posts and Questions associated with the product, Maple 2022

Why does 'simplify' not work when calculating Eigenvectors? Further, how can we express (2) in a more simplified form by using 'simplify'?simplify.mw

I am trying to solve the following recursion for any n, given a constant c. Here is my code for it:

c := 2:

A[i] := rsolve({a(0) = 1/n, a(i) = ((n - i + 1)/(n - i) + 1/(c*(n - i)))*a(i - 1)}, a);

total := evala(Simplify(sum(eval(A[i], i=k), k=0..n-1)));
evalf(eval(total, n = 6));

For c = 1, I get a valid (and correct) output, however for c = 2 for example, rsolve is returning A[i] = -GAMMA(-n)*GAMMA(-n + i - 1/2)/(GAMMA(-n - 1/2)*GAMMA(-n + i + 1)), which does not make sense when n is an integer. Is there something I am doing wrong here? Not sure why this is happening. Thanks!

im trying to write differential quadrature method i have successfully  generated system of equations using code but now im stuck with rk4 method to solve these equation in a loop kindly give me suggestions or modify the code

restart

with(orthopoly)

N := 5

5

(1)

P := proc (n, x) options operator, arrow; orthopoly[P](n, 2*x-1) end proc

P_N := simplify(P(N, x))

252*x^5-630*x^4+560*x^3-210*x^2+30*x-1

(2)

localroots := fsolve(P_N = 0, x, complex)

HFloat(0.04691007703066799), HFloat(0.23076534494715836), HFloat(0.4999999999999997), HFloat(0.7692346550528439), HFloat(0.9530899229693298)

(3)

for i to N do assign(x[i] = localroots[i]) end do

PRime := diff(P_N, x)

1260*x^4-2520*x^3+1680*x^2-420*x+30

(4)

for i to N do for j to N do if i <> j then a[i, j] := (eval(PRime, x = x[i]))/((x[i]-x[j])*(eval(PRime, x = x[j]))) else a[i, j] := (1-2*x[i])/(2*x[i]*(x[i]-1)) end if end do end do

u := proc (i) local u_x, expr, j; u_x := add(a[i, j]*u[j], j = 1 .. N); expr := -u[i]*u_x+x[i]; expr end proc; odes := [seq(u(i, [seq(u[j], j = 1 .. N)]), i = 1 .. N)]; for i to N do assign(o[i] = odes[i]) end do; for i to N do printf("u_%d = %s\n", i, convert(u(i), string)) end do

u_1 = -u[1]*(-10.1340811913091*u[1]+15.4039041703445*u[2]-8.08708750877537*u[3]+3.92079823166652*u[4]-1.10353370192667*u[5])+.046910077030668
u_2 = -u[2]*(-1.92051204726391*u[1]-1.51670643433575*u[2]+4.80550130432862*u[3]-1.85711605328765*u[4]+.488833230558754*u[5])+.230765344947158
u_3 = -u[3]*(.602336319455661*u[1]-2.87077648466948*u[2]-1.11022302462516e-015*u[3]+2.87077648466942*u[4]-.602336319455684*u[5])+.5
u_4 = -u[4]*(-.488833230558737*u[1]+1.85711605328767*u[2]-4.8055013043286*u[3]+1.51670643433578*u[4]+1.92051204726404*u[5])+.769234655052844
u_5 = -u[5]*(1.1035337019266*u[1]-3.92079823166643*u[2]+8.08708750877511*u[3]-15.4039041703442*u[4]+10.1340811913086*u[5])+.95308992296933

 

initial_conditions := [0.1e-1, 0.2e-1, 0.3e-1, 0.4e-1, 0.5e-1]

for i to N do printf("Initial condition for u_%d: u_%d(0) = %f\n", i, i, initial_conditions[i]) end do

Initial condition for u_1: u_1(0) = 0.010000
Initial condition for u_2: u_2(0) = 0.020000
Initial condition for u_3: u_3(0) = 0.030000
Initial condition for u_4: u_4(0) = 0.040000
Initial condition for u_5: u_5(0) = 0.050000

 

dt := .1

tf := 1

"local o_old;  o_old := Vector(n);    #` Loop to initialize o[i]old values`  for i from 1 to n do      o_old[i] := initial_conditions[i];      printf("Initial condition for u_%d: u_%d(0) = %f\\n", i, i, initial_conditions[i]);  end do:    time := t0;  while time < tf do  for i from 1 to n do      k[1, i] := dt * o[i](time,o_old[i]);   for i from 1 to n do  k[2,i]:=dt*o[i](time + dt/(2), o_old[i]+   (k[1, i])/(2));  end do:  for i from 1 to n do  k[3,i]:=dt*o[i](time+ o_old[i]+ (  k[1, i])/(2));  end do:  for i from 1 to n do  k[4,i]:=dt*o[i](time+dt,o_old[i]+k[1,i]);  end do:  for i from 1 to n do    0 _new[i]:=o_old[i]+(k[1,i]+2 *k[2,i]+2*k[3,i]+k[4,i]);  end do:  time := time + dt;     end do;      "

Error, illegal use of an object as a name

"local o_old;  o_old := Vector(n);    #` Loop to initialize o[i]old values`  for i from 1 to n do   o_old[i] := initial_conditions[i];   printf("Initial condition for u_%d: u_%d(0) = %f\\n", i, i, initial_conditions[i]);  end do:    time := t0;  while time < tf do  for i from 1 to n do   k[1, i] := dt * o[i](time,o_old[i]);  end do:  for i from 1 to n do  k[2,i]:=dt*o[i](time + dt/2, o_old[i]+ (k[1, i])/2);  end do:  for i from 1 to n do  k[3,i]:=dt*o[i](time+ o_old[i]+ (  k[1, i])/2);  end do:  for i from 1 to n do  k[4,i]:=dt*o[i](time+dt,o_old[i]+k[1,i]);  end do:  for i from 1 to n do  0 _new[i]:=o_old[i]+(k[1,i]+2 *k[2,i]+2*k[3,i]+k[4,i]);  end do:  time := time + dt;   end do;      "

 
 

NULL

Download dq_code.mw

Multiplaction "dot" in Maple 2022 is way too small - causes errors.

e.g. two variables multiplied s*m ends up being sm a new variable as I cannot really see that there is a missing multiplication operator between the variables. This causes huge unnecessary errors.

Maple 9.x e.g had nice clear and big operators and this kind of error was avoided.

How can I undo this unfortunate regression in Maple 2022 to increase the size of multiplication operator and other operators, so that they actually becom visible and not just a little dot almost a pixel in size.

If I was a falcon (20x20)^infinity then this would have been ok, but I am not, I am human.

So how do I change this unfortunate regression so that these errors can be avoided.?

Why does Maple 2022 still have only a history of ten files in the Recents ?

It makes it very difficult to search for files you opened but only realised later you need, but then it is long out of the silly 10 history list.

Isnt there a way to make a perpetual list so that all files opened are saved chronologiacally against date, or... at least be able to increase the silly 10 recent files to something like 30

Thanks

In my code, why  does InitState(5,5) return only one element of the vector while Coherent(5) returns 5 elements of the vector?

restart;

with(LinearAlgebra):

 

Coherent := proc({zeta:=1,phi:=Pi/2},n_max) local alpha,i,ICs:
 #alpha := sqrt(zeta)*exp(I*phi):
 ICs := Vector(n_max,i->evalc(evalf(exp(-zeta/2)/sqrt((i-1)!))*(sqrt(zeta)*exp(I*phi))^(i-1)),datatype=complex[8]);
end proc:

Projectile := proc({L:=1,sigma:=0.01,beta:=0.02,k0:=-5*Pi},n_max) local x0,g,c,v,ICs,j:
  x0 := evalf(beta*L);
  g := unapply(exp(-(x-x0)^2/2/sigma^2),x);
  c := evalf(int(g(x)^2,x=-L/2..L/2,numeric=true));
 
  v:=Vector(n_max,datatype=complex[8]);

  for j from 1 to n_max do:
     if (is(j,odd)) then  v[j]:= evalc[8](evalf(Int(cos(Pi*j*x/L)*g(x)*cos(k0*x),x=-L/2..L/2,method=_d01akc))+ I*evalf(Int(cos(Pi*j*x/L)*g(x)*sin(k0*x),x=-L/2..L/2,method=_d01akc)));
      else v[j]:= evalc[8](evalf(Int(sin(Pi*j*x/L)*g(x)*cos(k0*x),x=-L/2..L/2,method=_d01akc))+ I*evalf(Int(sin(Pi*j*x/L)*g(x)*sin(k0*x),x=-L/2..L/2,method=_d01akc)));
     end if:
  end do:

 ICs :=evalf[8](sqrt(2/L*c))*v;
end proc:

InitState := proc({zeta:=1,phi:=Pi/2,L:=1,sigma:=0.01,beta:=0.02,k0:=-5*Pi},d1,d2) local Z0:
z1 := Coherent(zeta,phi,d1);
#Z0:= MatrixMatrixMultiply(Coherent(zeta,phi,d1),Transpose(Projectile(L,sigma,beta,k0,d2))):
end proc:

Warning, (in InitState) `z1` is implicitly declared local

 

InitState(5,5); Coherent(5);

Vector(1, {(1) = .6065306597+0.*I})

 

Vector[column](%id = 36893490076814315516)

(1)
 

 

Download test3.mw

How can I get the evaluation of integration inside if-statement?

Thanks for your help in advance,

restart;

#L:=1:sigma:=0.01:beta:=0.2:k0:=-100:

#For Free particle
Projectile := proc({L:=1,sigma:=0.01,beta:=0.2,k0:=-100},n_max) local x0,g,c:
 x0:= beta*L;
 g := unapply(exp(-(x-x0)^2/2/sigma^2),x);
 #c := int(g(x)^2,x=-L/2..L/2,numeric=true);
 ub := (L/2-x0)/sqrt(2)/sigma;
 lb := (-L/2-x0)/sqrt(2)/sigma;
 a := Pi*sqrt(2)*sigma/L;
 b := sqrt(2)*k0*sigma;
 c := Pi*x/L;
 d := k0*x0;
 eq1 := [cos(a*n*z)*cos(b*z)/e^(z^2),cos(a*n*z)*sin(b*z)/e^(z^2),sin(a*n*z)*cos(b*z)/e^(z^2),sin(a*n*z)*sin(b*z)/e^(z^2)];
 eq1 := map(f->unapply(f,n,z),eq1);
 eq2 := [cos(n*c)*cos(d),cos(n*c)*sin(d),sin(n*c)*cos(d),sin(n*c)*sin(d)];
 eq2 := map(f->unapply(f,n,z),eq2);

 for j from 1 to n_max do:
   if (is(j,odd)) then eq11 := int(eq1[1](j,z),z=lb..ub,numeric=true);
   else 0;
   end if;
 end do:

end proc:

 

Warning, (in Projectile) `ub` is implicitly declared local

 

Warning, (in Projectile) `lb` is implicitly declared local

 

Warning, (in Projectile) `a` is implicitly declared local

 

Warning, (in Projectile) `b` is implicitly declared local

 

Warning, (in Projectile) `d` is implicitly declared local

 

Warning, (in Projectile) `eq1` is implicitly declared local

 

Warning, (in Projectile) `eq2` is implicitly declared local

 

Warning, (in Projectile) `j` is implicitly declared local

 

Warning, (in Projectile) `eq11` is implicitly declared local

 

Projectile(1);

int(cos(0.4442882938e-1*z)*cos(1.414213562*z)/e^(z^2), z = -49.49747467 .. 21.21320343)

(1)

 


Download SolnforProjectile_v3_3.mw

How to verify eq by using (2), (3) and (4)? Since lambda's, A's, B's and a are constant, but they appear as variables i.e., D[2](A1)..., (D[2] -> d/dt (derivative w.r.t 't')). Also q(n+1,t)- q(n,t) = a (const). Therefore, d/dt(q(n+1),t) - d/dt,(q(n,t))=0

verif_May24.mw

OS Linux

I have Maple 2022 open with a worksheet on a specific workspace.

I then move to a different workspace and want to start a new instance of maple for a new problem.

In command line I exacute

$]xmaple22 –standalone  filename.mw

Unfortunately when the new instance is started, the open maple instance on the first workspace is moved automatically to the second workspace together with the new instance opened, completely messing up the organization.

This is not expected behavior.

How can I make Maple execute absolutely independent instances of xmaple22 without indiscressionately and automatically moving existing open maple instances to the current workspace.

Severely annoying. Maple 9.5 e.g. does not have this behavior at all so Maple 2022 is a step backwards in this regard.

Thanks

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.

Why does no substitution work on functions with s(n+1,t) (see eqns (2-8))? Also (&PartialD;)/(&PartialD; (sigma2*t))=1/(sigma2)(&PartialD;)/(&PartialD; t), how can I do it on Maple?shift.mw

I am trying to load the third-party package 'CPC Program Library (qub.ac.uk)' by following the instructions as in 'how to install wkptest? - MaplePrimes'. But encounter with Errors: '

Error, `:` unexpected
with(wkptest);
Error, invalid input: with expects its 1st argument, pname, to be of type {`module`, package}, but received wkptest

restart:

sourcefolder:=cat(kernelopts('C:\Users\ahmed\Downloads\adty_v1_0'),"/wkptest");
installfolder:=cat(kernelopts('homedir'),"/maple/toolbox/wkptest/lib");
FileTools:-MakeDirectory(installfolder, 'recurse'=true);
libraryfile:=cat(installfolder,"/wkptest.mla");
try
  FileTools:-Remove(libraryfile);
catch:
end try:
LibraryTools:-Create(libraryfile);
libname:=libraryfile,libname;
read cat(sourcefolder,"/wkptest_cpc");

Error, `:` unexpected

 

with(wkptest);

Error, invalid input: with expects its 1st argument, pname, to be of type {`module`, package}, but received wkptest

 
 

 

Download exam_wkptest1.mws

How can I make if-statement work in my code?
assuming m,n :: integers
Thank you in advance.

restart;

 

x2 := proc(m,n)
  if ((is(m,even) and is(n,odd)) or (is(m,odd)and is(n,even))) then -8*L*m*n/(m+n)^2/Pi^2/(m-n)^2;
  else  0;
  end if;
end poc:

Error, missing operator or `;`

 


Download test2.mw

How can I  get the result for the integration when m =n or m is not equal to n and How can I add assumption that m, or n can be even or odd?

Thanks in advance for your help.

 

restart;
phi := proc(k,x,L)
  if (type(k,even)) then sqrt(2)*sin(Pi*k*x/L)/sqrt(L)
  else sqrt(2)*cos(Pi*k*x/L)/sqrt(L)
  end if;
end proc:

Int(phi(m,x,L)*_h^2/m2*diff(phi(n,x,L),x,x),x=-L/2..L/2);

Int(-2*cos(Pi*m*x/L)*_h^2*Pi^2*n^2*cos(Pi*n*x/L)/(L^3*m2), x = -(1/2)*L .. (1/2)*L)

(1)
 

 

Download test1.mw

 

ras5_v1.mw 

How can I  change eq13 to eq14 without using op command manually?

Thank you for your help in advance,

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