Maple 2021 Questions and Posts

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

Hello!

I'm new user in Maple and I have two question:

1. I have modeled transfer function in z term(without DynamicSystems). How quicky can I reearange it to difference equation to find coefficients?

2. I discretize transfer function of s to z using ToDiscrete(DynamicSystems) how here I can reearange this form to difference equation? 

restart

NULL

Is there a direct way to have the int command return the anti-derivative plus an arbitrary constant of integration? I am imagining the process to look like:
int(f(x), x) = F(x)+c1

NULL

Consider the integral of f(x)=x.f := x

x

(1)

Int(f, x); int(f, x)

(1/2)*x^2

(2)

Notice that the output has no intregration constant or the constant has been assigned the value of zero and is not displayed in the output.

Maple 2021 Help states, "Indefinite integration  is performed if the second argument x is a name. Note that no constant of integration appears in the result. Definite integration is performed if the second argument is of the form x=a..b where a and b are the endpoints of the interval of integration."

I'd like Maple to output the anti-derivative plus an arbitrary constant in the same way dsolve outputs a general solution of an ode with arbitrary constants. My first work around was to just use dsolve.  

There is a sense in which performing an integration is equivalent to solving an ode:
diff(h(x), x) = g(x); int(diff(h(x), x), x) = int(g(x), x); h(x) = int(g(x), x)+c1; h(x) = G(x)+c2
    

Is there a way to force int to output arbitrary constants of integration or should I stick to just using dsolve if I want that effect?

Download constants_of_integration_int_output.mw

restart:with(LinearAlgebra):with(plots):with(geometry):with(plottools): On appelle alpha la moitié de l'angle de rotation de la roue menée par tour de roue menante. alpha=Pi/n en radians? soit Pi/8 pour 8 rainures.. On a alors les relations suivantes entre l'entaxe E, le rayon de la roue ùenante R1 et le rayon de la roue menée R2 : R1=E.sin(alpha), R2=E*cos(alpha) Intersection du cercle (O,R2) avec la droite tan(phi)x-r/cos(phi), on obtient les coordonnées de P3 sol:=allvalues(solve([tan(phi)*x-r/cos(phi)=y,y^2+x^2=R2^2],[x,y])): Intersection de 2 cercles sol1:=allvalues(solve([(x-E)^2+y^2=(R-a)^2,y^2+x^2=R2^2],[x,y])): Coordonnées des points du pourtour de l'élément de croix Oo:=point([0,0]): phi:=Pi/8:R2:=5:r:=1/4:E:=R2/cos(phi):evalf(%):R:=R2*tan(phi):evalf(%):a:=0.5: P1:=point([(R2/2-r)*cos(phi),(R2/2-r)*sin(phi)]): P2:=point([(R2/2)*cos(phi)+r*sin(phi),(R2/2)*sin(phi)-r*cos(phi)]): xP2:=(R2/2)*cos(phi)+r*sin(phi):yP2:=(R2/2)*sin(phi)-r*cos(phi): xP1:=(R2/2-r)*cos(phi):yP1:=(R2/2-r)*sin(phi): Equation paramétrique du segment OP1 (t varie de 0 à 1) ; x1:=t*(0-xP1)+xP1: y1:=t*(0-yP1)+yP1: n1:=5: dt:=1/(n1-1):#t varie entre 0 et 1 for i to n1 do tau:=(i-1)*dt: xx[i]:=evalf(subs(t=tau,x1)): yy[i]:=evalf(subs(t=tau,y1)): #print(i,xx[i],yy[i]); od: Equation paramétrique du quart de cercle P1P2 de la rainure (t varie de 0 à 1) x2:=R2/2*cos(phi)+r*cos(t):#attention au sens de rotation du parcours de l'objet y2:=R2/2*sin(phi)+r*sin(t): n2:=6: dt:=Pi/2/(n2-1):#arc de Pi/2 for i to n2 do tau:=phi-Pi+(i-1)*dt: xx[i]:=evalf(subs(t=tau,x2)): yy[i]:=evalf(subs(t=tau,y2)): od: for i to n2 do Vector[row]([i,xx[i],yy[i]]) od: droite:=plot((tan(phi)*x-r/cos(phi),x=0..3),linestyle=dot,color=blue): sol[1]: xP3:=evalf(subs(op(1,sol[1]),x)):yP3:=evalf(subs(op(1,sol[1]),y)): xP2:yP2: xP4:=evalf(subs(op(1,sol1[1]),x)):yP4:=evalf(subs(op(1,sol1[1]),y)): xP5:=E-(R-a):yP5:=0: x3:=t*(xP3-xP2)+xP2: y3:=t*(yP3-yP2)+yP2: n3:=10: dt:=1/(n3-1):#t varie entre 0 et 1 for i to n3 do tau:=(i-1)*dt: xx[i+n2]:=evalf(subs(t=tau,x3)): yy[i+n2]:=evalf(subs(t=tau,y3)): od: for i to n3 do Vector[row]([i,xx[i],yy[i]]) od: x4:=xP5+R-a+(R-a)*cos(t):#attention au sens de rotation du parcours de l'objet y4:=(R-a)*sin(t): n4:=11: eta:=arcsin(yP4/(R-a)): dt:=(-eta)/(n2-1)/2:#arc de Pi/2 for i to n4 do tau:=(Pi+eta)+(i-1)*dt:#recherche de tau ? xx[i+n2+n3]:=evalf(subs(t=-tau,x4)): yy[i+n2+n3]:=evalf(subs(t=-tau,y4)): od: for i to n4 do Vector[row]([i,xx[i],yy[i]]) od: n:=n2+n3+n4; n := 27 for i to n do Vector[row]([i,xx[i],yy[i]]) od: figure:=NULL: for i from 0 to n do xx[0]:=0:yy[0]:=0: figure:=figure,[xx[i],yy[i]]: #print(i,xx[i],yy[i]); od: polygonplot([figure],scaling=constrained,color=yellow,view=[-0.1..5,-0.1..3]): for i to n do X[i]:=xx[i]: Y[i]:=yy[i] od: d1:=plottools[disk]([xP1,yP1],0.05,color=blue): d2:=plottools[disk]([xP2,yP2],0.05,color=red): d3:=plottools[disk]([xP3,yP3],0.05,color=green): d4:=plottools[disk]([xP4,yP4],0.05,color=green): d5:=plottools[disk]([xP5,yP5],0.05,color=green): fig:=pointplot([figure],scaling=constrained): Po:=pointplot([[xP1,yP1],[xP2,yP2],[xP3,yP3]],color = blue, symbol = asterisk): Cir:=plot([R2*cos(t),R2*sin(t),t=0..Pi/2],color=black): Arc:=plot([E+(R-a)*cos(t),(R-a)*sin(t),t=3*Pi/4..Pi],linestyle=dot,color=blue): textplot({[1, 2, "one point in 2-D"], [3, 2, "second point in 2-D"]}): texte:=textplot([[xP1-0.2,yP1,"P1"],[xP2,yP2-0.3,"P2"],[xP3+0.2,yP3+0.2,"P3"], [xP4+0.2,yP4+0.1,"P4"],[xP5-0.2,yP5+0.2,"P5"]]): display({Arc,Cir,d1,d2,d3,d4,d5,Po,fig,droite,texte},scaling=constrained,view=[-1..7,-1..6]): with(plottools): printlevel:=3: Miroir : symétrie par rapport à l'axes des x for i from 0 to n/2 do tt:=yy[i]: yy[i]:=yy[n-i+1]: yy[n-i+1]:=tt: tt:=xx[i]: xx[i]:=xx[n-i+1]: xx[n-i+1]:=tt od: for i from 0 to n-1 do xx[2*n-i]:=xx[i]: yy[2*n-i]:=-yy[i]: #print(i,xx[i],yy[i]) od: Poly:=NULL: for i from 0 to 2*n-1 do xx[0]:=0:yy[0]:=0: Poly:=Poly,[xx[i],yy[i]]:od: polygonplot([Poly],color=yellow,scaling=constrained): pointplot([Poly],color = blue, scaling=constrained,symbol = asterisk,view=[-1..5,-3..3]): Rotation unassign('xt','yt'): #gc(): zt:=8:#8 rainures ou faisceaux xt:=Vector(63,[]): yt:=Vector(63,[]): xt:=Vector((2*n-1),zt,[]): yt:=Vector((2*n-1),zt,[]): j:=0: for k from 0 to zt-1 do j:=0: phi:=2*Pi*k/zt: cs:=cos(phi): sn:=sin(phi): for kk from 1 to 2*n-1 do j:=j+1: xt[j][k]:=evalf(xx[kk]*cs-yy[kk]*sn): yt[j][k]:=evalf(xx[kk]*sn+yy[kk]*cs): od: od: N1:=j: points:=seq(seq([xt[i][j], yt[i][j]], j=0..zt-1), i=1..2*n-1): p_cross:= pointplot([points], scaling = constrained, color = black,linestyle=solid, filled=[yellow]): polygonplot([points], color = yellow, scaling = constrained); NULL; display([p_cross]);#How to draw this cross with a line without points. Thank you.

Hey all! I recently reinstalled my PC and therefore had to reinstall Maple. I did so and it worked out great, however, minor problem. My PC doesn't recognise .mw files as associated to Maple. I have tried a few different files, but I don't know which one to select as standard program for opening .mw files. Would anyone by chance know which file is the "opener" file, if that´s what that's called.
Thank you for the help in advance :D

(PS: I do know that I can just open the file through Maple by clicking files -> open and locating the file. But I'd rather access them by just doubleclicking from the directory.

I was trying Maple 2021.2 on this pde I saw on the net, and noticed it gives some error messages. 

Are these to be expected and known?  

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 1127 and is the same as the version installed in this computer, created 2022, January 3, 14:33 hours Pacific Time.`

restart;

PDE := diff(u(t, x, y), t) = VectorCalculus:-Laplacian(u(t,x,y),'cartesian'[x,y]);
bc := D[2](u)(t,0,y)=0,D[2](u)(t,1,y)=0, u(t, x, 0)=0,u(t, x, 3)=0;
ic := u(0, x, y) = f(x,y);
sol := pdsolve([PDE, bc,ic], u(t,x,y))

diff(u(t, x, y), t) = diff(diff(u(t, x, y), x), x)+diff(diff(u(t, x, y), y), y)

(D[2](u))(t, 0, y) = 0, (D[2](u))(t, 1, y) = 0, u(t, x, 0) = 0, u(t, x, 3) = 0

u(0, x, y) = f(x, y)

Error, (in assuming) when calling '`assume/NormalizeBoolean`'. Received: 'invalid input: type expects 2 arguments, but received 3'

restart;

PDE := diff(u(t, x, y), t) = VectorCalculus:-Laplacian(u(t,x,y),'cartesian'[x,y]);
bc := D[2](u)(t,1,y)=0, u(t, x, 0)=0,u(t, x, 3)=0;
ic := u(0, x, y) = f(x,y);
sol := pdsolve([PDE, bc,ic], u(t,x,y))

diff(u(t, x, y), t) = diff(diff(u(t, x, y), x), x)+diff(diff(u(t, x, y), y), y)

(D[2](u))(t, 1, y) = 0, u(t, x, 0) = 0, u(t, x, 3) = 0

u(0, x, y) = f(x, y)

Error, (in PDEAdvisor/2nd_order/Series/ThreeVariables) invalid input: has expects 2 arguments, but received 1

restart;

pde := diff(u(t, x, y), t) = VectorCalculus:-Laplacian(u(t,x,y),'cartesian'[x,y]);
bc := D[2](u)(t,0,y)=0,D[2](u)(t,1,y)=0, u(t, x, 0)=0,u(t, x, 3)=0;
sol := pdsolve([pde,bc], u(t,x,y))

diff(u(t, x, y), t) = diff(diff(u(t, x, y), x), x)+diff(diff(u(t, x, y), y), y)

(D[2](u))(t, 0, y) = 0, (D[2](u))(t, 1, y) = 0, u(t, x, 0) = 0, u(t, x, 3) = 0

Error, (in PDEAdvisor/2nd_order/Series/ThreeVariables) invalid boolean expression: NULL

 

Download pde_error_messages.mw

I have the following warnings. Could you help me fix the problem?

restart;

deS:=diff(x(t),t)=-0.5*x(t)*y(t)

diff(x(t), t) = -.5*x(t)*y(t)

(1)

deI:=diff(y(t),t)=0.5*x(t)*y(t)-0.15*y(t)

diff(y(t), t) = .5*x(t)*y(t)-.15*y(t)

(2)

with(DEtools):

DEplot([deS,deI],[x(t),y(t)],t=0..40,x=0..1,y=0..0.6,[[x(0)=0.99,y(0)=0]])

Warning, plot may be incomplete, the following errors(s) were issued:
   incorrect number of arguments, got 51, expected 50

 

 

 

 

Download DEtools_example.mw

I have been experiencing an error in the 2-D math text in Maple 2021. Every time I use the shift button the command seems to double. So if I for instance want to define A:=2 it will write; AA::==2 making the command useless. This only happens in 2-D math.

I have tried restarting Maple, my PC and uninstalling then installing maple 2021 again but nothing changes. This error appeared after updating maple the 6th of january 2022 to Maple 2021.2. I have a MacBook Air M1 2020. 

Please help as I have an exam soon

Hello, I'm using Maple 2021.2 to approximate the solution to a differential equation using a pseudospectral expansion in the basis of Hermite polynomials. After setting up some equations, I get a non-linear system of equations that I try to solve using the Maple's function solve, but Maple suddenly crashes during the execution of this function.

My code is the following:

HN := (n, y) -> exp(-1/2*y^2)*simplify(HermiteH(n, y))/sqrt(sqrt(Pi)*2^n*n!):

u7 := a0*HN(0, y) + a1*HN(1, y) + a2*HN(2, y) + a3*HN(3, y) + a4*HN(4, y) + a5*HN(5, y) + a6*HN(6, y):

resid := diff(u7, y $ 2) + 4*y*diff(u7, y)*u7 + 2*u7^2:

r := evalf(allvalues(RootOf(HermiteH(7, x), x)));
equations := {evalf(eval(u7, y = 0) - 1)};
for root_r in r do
    if root_r != 0 then
        equations := {op(equations), evalf(eval(resid, y = root_r))};
    end if:
end do:

solutions := solve(equations, {a0, a1, a2, a3, a4, a5, a6}):

Does anyone have any idea about what is happening? Is there any better way of solving a non-linear system of equations?

A user wonders if they can customize Maple output to show, for example x^2 instead of x2 in 2D output. 

We suggest they either set 

interface(prettyprint=0);

globally, or use

lprint(x^2)

for individual outputs. 

A user wonders if there is a straightforward way to show US states with names using the WorldMap Data Set in Maple

We suggest something like the attached: map-of-us-with-states.mw

 

restart; with(DataSets:-Builtin); r := Reference("GeoNames"); states := r[[Country = "United States", Type = "first-order administrative division"]]; w := WorldMap(); w:-AddPoints(w, states); Display(w, mapdata = fine, style = polygonoutline, size = [2000, 1500])

 

 

What/Whare are the maple initialization files.

I have a problem with libname.

According to maple help, I should create/modify ~/.mapleinit.

> cat ~/.mapleinit

libname := "/usr/local/Maple2021/lib","/home/tomdean/maple/toolbox/maplev/lib","/home/tomdean/maple/toolbox/Syrup/lib";

But, when I start maple (in emacs), libname is only the first part, "/usr/local/Maple2021/lib",

I installed the cloud version of Syrup with xmaple, by clicking the cloud icon, etc. It is loaded with xmaple and cmaple. But, not in maple running in emacs.

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

Tom Dean

I am attempting to use maplev mode for emacs. Ubuntu 20.04.3, Emacs 26.3, maplev-mode from git, release-2.36-59-g142c03. maple 2021.

I copied mload from an older computer and added a line to define maple, after the original maple definition line.

MAPLE=${MAPLE:-maple} # Maple script
MAPLE=/usr/local/Maple2021/bin/maple  <=== added

I compiled and installed maplev-mode. I had to touch doc/version.texi because the file did not exist. But, otherwise, I saw no errors.

I added lines to my emacs init.el as per the README.md.

maplev-mode seems to load when I edit a .mpl file.

However, mint is not defined.  Where should I change to define the location of mint?

/usr/local/Maple2021/bin/mint

Tom Dean

In this example, i have a top module A. Inside it, I have module named my_RECORD (which happened to be option object) that I want to return back to caller when they call a proc.

Maple allows me to declare the proc to return my_RECORD. No problem., But when making a local variable inside the proc and using o::my_RECORD it complains  that my_RECORD does not exist. 

The solution is to change o::my_RECORD to o::A:-my_RECORD

My question why it did not complain the same way on the return value on the proc?   for me, they are both semantically the same. One says the proc returns this type, and the other says the local variable is this type. So why had to do A:-my_RECORD on one but not the other? 

Here is an example. Maple 2021.2 on windows 10.

restart;

interface(warnlevel=4);
kernelopts('assertlevel'=2):

3

A:=module()
 #this is the RECORD to return
  local module my_RECORD()
   option object;
   export data::string:="";
  end module;
   
  export do_analysis:=proc()::my_RECORD;   
    local o::my_RECORD; #error here. But this is the same above line above?    
    o:=Object(my_RECORD);
    o:-data:="test";
    return o;        
  end proc;
end module;

_m2642451182336

A:-do_analysis()

Error, (in do_analysis) type `my_RECORD` does not exist

#FIXED BELOW
restart;

A:=module()
    #this is the RECORD to return
    local module my_RECORD()
        option object;
        export data::string:="";
    end module;
   
    export do_analysis:=proc()::my_RECORD;
          local o::A:-my_RECORD;    
          o:=Object(my_RECORD);
          o:-data:="test";
          return o;        
    end proc;
end module;

_m2642339719872

A:-do_analysis()

module my_RECORD () export data::string; option object; end module

 

Download A_no_lib.mw

Hi, I am trying to enter into the Mini-Course Computer Algebra for Physicists from the help, but instead of going to the page I get the help page of Physics[FeynmanIntegral]. Can anyone confirm that this happens to them on Maple 2021.2?

Kevin

First 14 15 16 17 18 19 20 Last Page 16 of 33