Maple 2021 Questions and Posts

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

question5.mw

In document uploaded I tried to write a code to get as output 11 plots. I would like a format as this: 9 plots in 3 columns an 3 rows, and a fourth row with two center plots. To explain me better, I drew a rustic sketch of what I want, basically something like this:

However I tried but I fail and my output is horrible. So, I want to ask: Does exists some option to the plot[display] command or should I try another aproach?

Thank you for helping me;
Greetings;
Lic. Marcus Vinicio Mora Salas;
Chemist;
Postgraduate student.

As part of my course work I've encountered a block wherein I need to convert a 4th order TF to a SmithForm but am unable to do so.

Can anyone help me with the code as attatched.

A := Matrix([[(.3384*x^3-26.13*x^2-.3659*x+0.1678e-1)/(s^4+3.068*s^3-3.362*s^2-.5748*s+.7598), (.4755*s^3-25.3*s^2-51.36*s-1.387)/(s^4+3.068*s^3-3.362*s^2-.5748*s+.7598)], [(-.3349*s^3+18.21*s^2+.3487*s-0.5939e-1)/(s^4+3.068*s^3-3.362*s^2-.5748*s+.7598), (-.3107*s^3+17.81*s^2+35.49*s+1.027)/(s^4+3.068*s^3-3.362*s^2-.5748*s+.7598)]])

Matrix(%id = 36893488152131246308)

(1)

"->"

Error, (in gcdex) invalid arguments

 

"->"

SmithForm(Matrix(%id = 36893488152131266788))``

(2)

with(LinearAlgebra)

NULL

S := SmithForm(A, s)

Error, (in gcdex) invalid arguments

 

with(LinearAlgebra); A := Matrix([[1, 2*x, 2*x^2+2*x], [1, 6*x, 6*x^2+6*x], [1, 3, x]])

Matrix(%id = 36893488152361731844)

(3)

S := SmithForm(A, x)

Matrix(%id = 36893488152348668020)

(4)

NULL

Download SmithForm.mw

This is a simple problem of Chemistry. I solved the exercise, but there are three aspects I don't like about output:
1) Even kg*m2 *s-2 = J (SI unit to energy) and both are correct, one must be explicit with units in order to be totally clear, so I need an output with units of J/mol and not kg*m2 *s-2 mol-1.
2) I had to hardcode number of significant figures, so I had to analize quantitys in order to determine this number, wich as you can see, is three. I think Maple can compute significant figures automatically, but I could not find the command in documentation and even in this case is not totally needed, I would like to learn how do it because it could be very useful for more complex expressions.
3) Finally, output must be expressed using scientific notation, it's say enthalpy = 10.4*104 J/mol.
Therefore: How can I get adecuate output?
Thank you for helping me;
Greetings;
Lic. Marcus Vinicio Mora Sallas;
Chemist;
Postgraduate student. question4.mw

*** e1.501

 

Using this equation attributed to Clausius and Clapeyron,

ln(P[2]/P[1]) = Delta*H[vap]/R 1/T[1]-1/T[2]

and these data for the vapour pressure of liquid mercury at the indicated temperatures,

      P =  1.6 10^(-4) Pa at T = 273.15 K and P = 36.4 Pa at T = 373.15 K

estimate the enthalpy change Delta*H[vap] for vapourization of mercury over this range of temperature.

 

p := [1.6e-4*Unit('Pa'), 36.4*Unit('Pa')]:

Delta(H[vap]) = 0.105e6*Units:-Unit(m^2*kg/(s^2*mol*K))*Units:-Unit(K)

``

Download question4.mw

system_of_PDE.mw

NULL

NULL

Digits := 30; with(PDEtools); with(plots); Ops1 := numpoints = 100; Ops2 := color = magenta; Ops3 := color = blue; Ops4 := color = "BlueViolet"; Ops5 := axes = boxed, shading = zhue, orientation = [40, 50]; a := 0; b := 1; Tf := .5

axes = boxed, shading = zhue, orientation = [40, 50]

 

.5

(1)

E := 1480

1480

(2)

Ebes := 5990

5990

(3)

n0 := 900000

900000

(4)

ro := 1200

1200

(5)

m := 12.6

12.6

(6)

f := sig(x, t)-Ebes*`ϵij`(x, t)

sig(x, t)-5990*`ϵij`(x, t)

(7)

n := 900000*exp(-(sig(x, t)-E*`ϵij`(x, t))/m)

900000*exp(-0.793650793650793650793650793651e-1*sig(x, t)+117.460317460317460317460317460*`ϵij`(x, t))

(8)

NULL

P := 5

5

(9)

w := 4

4

(10)

k := 7

7

(11)

i := 5

5

(12)

eq1 := diff(sig(x, t), x, x) = ro*(diff(sig(x, t), x, x))/E+ro*(diff(sig(x, t), t)-Ebes*f/(9000000*exp(-(sig(x, t)-E*`ϵij`(x, t))/m)))*(1+f/m)/(9000000*exp(-(sig(x, t)-E*`ϵij`(x, t))/m))

diff(diff(sig(x, t), x), x) = (30/37)*(diff(diff(sig(x, t), x), x))+(1/7500)*(diff(sig(x, t), t)-(599/900000)*(sig(x, t)-5990*`ϵij`(x, t))/exp(-0.793650793650793650793650793651e-1*sig(x, t)+117.460317460317460317460317460*`ϵij`(x, t)))*(1+0.793650793650793650793650793651e-1*sig(x, t)-475.396825396825396825396825397*`ϵij`(x, t))/exp(-0.793650793650793650793650793651e-1*sig(x, t)+117.460317460317460317460317460*`ϵij`(x, t))

(13)

 

eq2 := diff(`ϵij`(x, t), t) = f/(9000000*exp(-(sig(x, t)-E*`ϵij`(x, t))/m))

diff(`ϵij`(x, t), t) = (1/9000000)*(sig(x, t)-5990*`ϵij`(x, t))/exp(-0.793650793650793650793650793651e-1*sig(x, t)+117.460317460317460317460317460*`ϵij`(x, t))

(14)

NULL

sys := {eq1, eq2}

{diff(diff(sig(x, t), x), x) = (30/37)*(diff(diff(sig(x, t), x), x))+(1/7500)*(diff(sig(x, t), t)-(599/900000)*(sig(x, t)-5990*`ϵij`(x, t))/exp(-0.793650793650793650793650793651e-1*sig(x, t)+117.460317460317460317460317460*`ϵij`(x, t)))*(1+0.793650793650793650793650793651e-1*sig(x, t)-475.396825396825396825396825397*`ϵij`(x, t))/exp(-0.793650793650793650793650793651e-1*sig(x, t)+117.460317460317460317460317460*`ϵij`(x, t)), diff(`ϵij`(x, t), t) = (1/9000000)*(sig(x, t)-5990*`ϵij`(x, t))/exp(-0.793650793650793650793650793651e-1*sig(x, t)+117.460317460317460317460317460*`ϵij`(x, t))}

(15)

NULL

IBC1 := {sig(0, t) = P*sin(w*k*i), sig(10, t) = P*sin(w*k*i), sig(x, 0) = 0, sig(x, 1) = 0, `ϵij`(x, 0) = 0}

{sig(0, t) = 5*sin(140), sig(10, t) = 5*sin(140), sig(x, 0) = 0, sig(x, 1) = 0, `ϵij`(x, 0) = 0}

(16)

S := 1/100; Ops := spacestep = S, timestep = S; Sol1 := pdsolve(sys, IBC1, [sig, `ϵij`], numeric, time = t, range = a .. b, Ops)

1/100

 

spacestep = 1/100, timestep = 1/100

 

Error, (in pdsolve/numeric) unable to handle elliptic PDEs

 

``

Download system_of_PDE.mw

In relation with the following code and its respective output:

I want get an output in wicht left side of equalitys be expressed in radical terms and not in terms of trigonometric expressions. I tried convert(expr, radical), but the result is not that I want. Could someone help me please? Also I want to know if exists a method to avoid hardcoding list of the forloop other than [seq(i, i = 1..5)];

Thank you for helping me;
Greetings;
Lic. Marcus Vinicio Mora Salas;
Chemist;
postgraduate student in University of Costa Rica

Do someone tell me how can I solve this exersise using a created procedure? Also I would like to know if using a procedure is useful and if in that form code lines will be reduce. If procedures are not useful. What is the best aproach?

Here the exercise and the code:

Before to begin to learn Maple, I used to do math with python. I usually built function and classes in order to reduce code lines and to generalize the problem, but I don't know if this aproach is useful with Maple. In fact, I have another question. Is it possible to write in a document some codeblocks using Maple and another using python? If answer is yes, how can I do it?

Thank you for helping me;
Greetings;
Lic. Marcus Vinicio Mora Salas
Chemist

Hi MaplePrimes team,

Is there a generalized way to fill an extremely CONCAVE closed 3d parametric plane curve in Maple with spacecurve command (NO implicitplot3d), preferably without doing any multi-decomposition or creating a particular skeleton, or algorithm/programming?

Here my example:

 

#Circle of reference
R0 := 1:
C0 := t-> < cos(t), sin(t), 0 >:

#Variable radius
R := t-> R0*(1 + 1/2*sin(t)):

#Variable phase
Dt := t-> Pi/2*sin(2*t):

#CONCAVE Curve
C := t-> R(t)*C0(t - Dt(t)):
'C(t)' = C(t);

#Range
t1, t2 := 0, 2*Pi:

#Plot
GC := spacecurve(C(t), t = t1..t2, color = "Red", thickness = 3
, linestyle = solid
, scaling = constrained, axes = frame, orientation = [50,40,0]):
GC;

We know how to do it easily for any convex 3d plane curve (circle, ellipse, regular polygon, etc ...).

We also know how to do it for 2d curve with the Maple’s plot option filled = true but obviously not in 3d.

Thank you for your time.

Best.

Guy.

I have defined a function II1norm of one variable. The variable has units "microns". It plots perfecting using a range defined in microns, but gives an error when I try to find the root using NextZero. If I just leave off the "microns" in the second argument, NextRoot just reports "FAIL". If I rewite the worksheet without units, then the NextZero executes fine. Why? How to I use units when finding roots?

Hello there, 

Would you allow me to ask one question?

Is there any way to get a saturated water vapor pressure value with a temperature outside of the range?

The range here means [273.06 K, 647.096 K]. The pressure value certainly exists (T<273.06 K), but the API only comes up with an error. 

Here is the Maple worksheet where I got into this issue:

restart;

with(ThermophysicalData):

with(CoolProp):        

with(Units[Standard]):

with(ScientificConstants):

T2 := (-40.0 + 273.15) * Unit('K');

233.15*Units:-Unit(K)

(1)

xbb := 1: # 100% steam, saturated.

Pg2 := PropsSI("P", "T", T2, "Q", xbb, "water");

Error, (in ThermophysicalData:-CoolProp:-PropsSI) Temperature to QT_flash [233.15 K] must be in range [273.06 K, 647.096 K] : PropsSI("P","T",233.15,"Q",1,"water")

 

 

Download Q20220111.mw

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

First 16 17 18 19 20 21 22 Last Page 18 of 35