MaplePrimes Questions

Dears, 

Can you look the code bellow and send me my error please? I used Maple 18.

restart;
with(plots);
theta(t) = 19.592+1.2697*cos(.5240*t+4.3391)-.6343*cos((2*.5240)*t-.6963);
omicron(t) = 99.4876+89.8581*cos(.5232*t+15.4500)+19.1069*sin((2*.5232)*t)-8.5891*cos((3*.5232)*t+3.7723)+6.4660*sin((5*.5232)*t);
`ϕ`(theta):=0.000203*theta*(theta - 11.7)*sqrt(42.3-theta);
mu[v](theta,omicron):=0.0886*exp(((0.01*omicron +1.01*theta  -21.211)/(14.852))^(4));
p[0](theta):=(-0.153* theta*theta + 8.61*theta - 97)/(mu[v](theta,omicron)):
p[2](omicron):=(4*0.25)/(2500)*omicron*( 50 -omicron);
p[3](omicron):=(4*0.75)/(2500)*omicron*( 50 -omicron);
p[2](theta):=exp (0.06737 - 0.00554*theta);
theta[EA](theta):=1/(-0.00094*theta*theta + 0.049*theta - 0.552);
L[v](theta,omicron):=(3.375*(4*omicron*(50-omicron))^(3)*exp(0.0054*theta+0.6737))/(50^(6)*(2+(0.00554*theta-0.06737)^(-1)));
eta(theta,omicron):=(p[0](theta)*p[1](omicron)*p[2](omicron)*p[3](omicron)*p[2](theta))/(theta[EA](theta));
lambda[v] := beta[v]*`ϕ`(theta)*i[v](t)/n[h](t);
lambda[h] := (beta[h]*`ϕ`(theta)*i[h](t)+beta[h]*`ϕ`(theta)*omega*r[h](t))/n[h](t);
n[v](t):=s[v](t)+i[v](t);
beta[h] := 0.9e-1; beta[v] := 0.2e-1; Lambda[h] := .50; sigma[1] := 0.15e-1; sigma[2] := 0.71e-1; Omega[h] := .50; mu[h] := 0.128e-1; delta[h] := .45; k[v] := .66; omega := .3; mu[d] := 0.14e-2;
sys := {diff(i[h](t), t) = Omega[h]+sigma[2]*r[h](t)+lambda[v]*s[h](t)-(delta[h]+mu[d]+mu[h])*i[h](t), diff(i[v](t), t) = lambda[h]*s[v](t)-mu[v](theta, omicron)*i[v](t), diff(j[v](t), t) = L[v](theta, omicron)*(1-j[v](t)/k[v])*n[v](t)-(eta(theta, omicron)+mu[j](theta, omicron))*j[v](t), diff(r[h](t), t) = delta[h]*i[h](t)-(sigma[1]+sigma[2]+mu[h])*r[h](t), diff(s[h](t), t) = Lambda[h]+sigma[1]*r[h](t)-(lambda[v]+mu[h])*s[h](t), diff(s[v](t), t) = eta(theta, omicron)*j[v](t)-(lambda[h]+mu[v](theta, omicron))*s[v](t), i[h](0) = 100, i[v](0) = 100, j[v](0) = 200, r[h](0) = 0, s[h](0) = 10000, s[v](0) = 5000};
p1 := dsolve(sys, numeric, method = rkf45, output = procedurelist);
Error, (in dsolve/numeric/process_input) input system must be an ODE system, found {mu[j](theta, omicron), mu[v](theta, omicron)}
p1o := odeplot(p1, [theta, omicron, i[h](t)], 0 .. 10, numpoints = 100, labels = ["Time (Days)", " infectious population"], labeldirections = [horizontal, vertical], style = line, color = red, axes = boxed, legend = [front, rear, ideal]);

Maple gives same solution for two different equations.

eq1 := 1/5*sqrt(-20*y + 1) - 1/5*ln(1 + sqrt(-20*y + 1)) = x + 2;
eq2 := -1/5*sqrt(-20*y + 1) - 1/5*ln(1 - sqrt(-20*y + 1)) = x + 2;

Solving these for y, gives same exact solution. But this is not correct. As this worksheet shows.

Is this a bug? How could two different equations give same solution?
 

15172

interface(version);

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

Case 1. Solve first then plugin x value in solution

 

eq1:=(sqrt(a^2 - 4*b*y) - a*ln(a + sqrt(a^2 - 4*b*y)))/b=x+c__1;
eq2:=(-sqrt(a^2 - 4*b*y) - a*ln(a - sqrt(a^2 - 4*b*y)))/b=x+c__1;

eq1:=eval(eq1,[a=1,b=5,c__1=2]);
eq2:=eval(eq2,[a=1,b=5,c__1=2]);

((a^2-4*b*y)^(1/2)-a*ln(a+(a^2-4*b*y)^(1/2)))/b = x+c__1

(-(a^2-4*b*y)^(1/2)-a*ln(a-(a^2-4*b*y)^(1/2)))/b = x+c__1

(1/5)*(-20*y+1)^(1/2)-(1/5)*ln(1+(-20*y+1)^(1/2)) = x+2

-(1/5)*(-20*y+1)^(1/2)-(1/5)*ln(1-(-20*y+1)^(1/2)) = x+2

sol1:=simplify(solve(eq1,y));

-(1/20)*LambertW(-exp(-11-5*x))*(LambertW(-exp(-11-5*x))+2)

sol2:=simplify(solve(eq2,y));

-(1/20)*LambertW(-exp(-11-5*x))*(LambertW(-exp(-11-5*x))+2)

eval(sol1,x=10.);

0.3221340286e-27

eval(sol2,x=10.);

0.3221340286e-27

Case 2. Plugin in same x value in equation and then solve, we get different answers

 

eq1:=(sqrt(a^2 - 4*b*y) - a*ln(a + sqrt(a^2 - 4*b*y)))/b=x+c__1;
eq2:=(-sqrt(a^2 - 4*b*y) - a*ln(a - sqrt(a^2 - 4*b*y)))/b=x+c__1;

eq1:=eval(eq1,[a=1,b=5,c__1=2,x=10]);
eq2:=eval(eq2,[a=1,b=5,c__1=2,x=10]);

((a^2-4*b*y)^(1/2)-a*ln(a+(a^2-4*b*y)^(1/2)))/b = x+c__1

(-(a^2-4*b*y)^(1/2)-a*ln(a-(a^2-4*b*y)^(1/2)))/b = x+c__1

(1/5)*(-20*y+1)^(1/2)-(1/5)*ln(1+(-20*y+1)^(1/2)) = 12

-(1/5)*(-20*y+1)^(1/2)-(1/5)*ln(1-(-20*y+1)^(1/2)) = 12

sol1:=evalf(solve(eq1,y));

-205.8850616

sol2:=evalf(solve(eq2,y));

0.3221340286e-27


 

Download different_equations_give_same_solution_june_12_2024.mw

 

On the corresponding Modelica page I find

Since MapleSim 2024 now has been upgraded to Modelica 4.0 (which I appreciate very much by the way - Thank you), I was wondering if I could give this libraray a try?

I am looking for simple ways to set up digital controllers in the context of developement of code for micro-controllers. From the github page:

Furthermore, in sublibrary Controller about 20 input/output blocks of linear systems are provided that are based on the different representation forms, e.g., PID, StateSpace, Filter blocks. A unique feature of these blocks is that it is very convenient to quickly switch between a continuous and a discrete block representation. Also, templates are provide to quickly built-up standard controller structures. 

I am using intersectplot  to make projective coordinate plots. Everything intersects the plane z=1. I find the plot quality poor, i.e. dotty dashy lines and circle. This seem to be the best linestyle=solid can do here. gridrefine can't be applied here. 
Any suggestions to improve quality here?
Maybe intersectplot is not the best aprroach here but so far it is all if have figured out.


restart

 

 

with(plottools)

[annulus, arc, arrow, circle, colorbar, cone, cuboid, curve, cutin, cutout, cylinder, disk, dodecahedron, ellipse, ellipticArc, exportplot, extrude, getdata, hemisphere, hexahedron, homothety, hyperbola, icosahedron, importplot, line, octahedron, parallelepiped, pieslice, point, polygon, polygonbyname, prism, project, pyramid, rectangle, reflect, rotate, scale, sector, semitorus, sphere, stellate, tetrahedron, torus, transform, translate, triangulate]

(1)

with(plots)

[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fieldplot, fieldplot3d, gradplot, gradplot3d, implicitplot, implicitplot3d, inequal, interactive, interactiveparams, intersectplot, listcontplot, listcontplot3d, listdensityplot, listplot, listplot3d, loglogplot, logplot, matrixplot, multiple, odeplot, pareto, plotcompare, pointplot, pointplot3d, polarplot, polygonplot, polygonplot3d, polyhedra_supported, polyhedraplot, rootlocus, semilogplot, setcolors, setoptions, setoptions3d, shadebetween, spacecurve, sparsematrixplot, surfdata, textplot, textplot3d, tubeplot]

(2)

 

 

DistCircle:=x^2+y^2=1

x^2+y^2 = 1

(3)

pt1:=[1/4,3/4]

[1/4, 3/4]

(4)

pt2:=[7/8,-1/3]

[7/8, -1/3]

(5)

pt3:=[-3/2,3/7]

[-3/2, 3/7]

(6)

pt4:=[3/5,-4/5]

[3/5, -4/5]

(7)

pt5:=[-1/10,-3/2]

[-1/10, -3/2]

(8)

 

L12:=-(13*x)/12 - (5*y)/8 + 71/96; #LnPeqns(pt1,pt2);

-(13/12)*x-(5/8)*y+71/96

(9)

L13:=-(9*x)/28 + (7*y)/4 - 69/56; #LnPeqns(pt1,pt3);

-(9/28)*x+(7/4)*y-69/56

(10)

L23:=(16*x)/21 + (19*y)/8 + 1/8; #LnPeqns(pt2,pt3);

(16/21)*x+(19/8)*y+1/8

(11)

L35:=(27*x)/14 + (7*y)/5 + 321/140; #LnPeqns(pt5,pt3)

(27/14)*x+(7/5)*y+321/140

(12)

nullline:=3/5*x-4/5*y-1

(3/5)*x-(4/5)*y-1

(13)

ptplt:=point([pt1,pt2,pt3,pt4,pt5],color="Green",symbol=solidcircle,symbolsize=10):
txtplt:=textplot([pt4[],typeset("pt4")],align={below,right}):

plt1:=display(txtplt,implicitplot([DistCircle,L12,L13,L23,L35,nullline],x=-2..2,y=-1.5...1.5,color=[red,blue,blue,blue,blue,cyan]),ptplt,scaling=constrained)

 

 

# Projective Geometry Version

DistCirclez:=x^2+y^2-z^2;  #a Cone

 

x^2+y^2-z^2

(14)

pt1p:=[pt1[],1];
pt2p:=[pt2[],1];
pt3p:=[pt3[],1];
pt4p:=[pt4[],1];
pt5p:=[pt5[],1];

[1/4, 3/4, 1]

 

[7/8, -1/3, 1]

 

[-3/2, 3/7, 1]

 

[3/5, -4/5, 1]

 

[-1/10, -3/2, 1]

(15)

 

 

 

L12p:=(13*x)/12 + (5*y)/8 - (71*z)/96;#LnPeqns([pt1p,pt2p,[0,0,0]]);

(13/12)*x+(5/8)*y-(71/96)*z

(16)

L13p:=(13*x)/12 + (5*y)/8 - (71*z)/96;#LnPeqns([pt1p,pt3p,[0,0,0]]);

(13/12)*x+(5/8)*y-(71/96)*z

(17)

L23p:=(9*x)/28 - (7*y)/4 + (69*z)/56;#LnPeqns([pt2p,pt3p,[0,0,0]]);

(9/28)*x-(7/4)*y+(69/56)*z

(18)

L35p:=(27*x)/14 + (7*y)/5 + (321*z)/140;#LnPeqns([pt3p,pt5p,[0,0,0]]);

(27/14)*x+(7/5)*y+(321/140)*z

(19)

L04p:=3/5*x-4/5*y-1*z;

(3/5)*x-(4/5)*y-z

(20)

ptpltp:=point([pt1p,pt2p,pt3p,pt4p,pt5p],symbol=solidsphere, symbolsize=8,color="green"):
intp1:=intersectplot(DistCirclez,z=1,x=-2.5..2.5,y=-2.5..2.5,z=0..1,linestyle=solid):#unit circle at z=1
intp12p:=intersectplot(L12p,z=1,x=-2.5..2.5,y=-2.5..2.5,z=0..1,color=blue):
intp13p:=intersectplot(L13p,z=1,x=-2.5..2.5,y=-2.5..2.5,z=0..1,color=blue):
intp23p:=intersectplot(L23p,z=1,x=-2.5..2.5,y=-2.5..2.5,z=0..1,color=blue):
intp35p:=intersectplot(L35p,z=1,x=-2.5..2.5,y=-2.5..2.5,z=0..1,color=blue):
intp04p:=intersectplot(L04p,z=1,x=-2.5..2.5,y=-2.5..2.5,z=0..1,color=cyan):

 

display(ptpltp,intp1,intp12p,intp13p,intp23p,intp35p,intp04p,scaling=constrained,caption="Projective Co-ords on plane z=1",axes=normal,axis[3]=[tickmarks=[1]])

 

 


Download 2024-06-10_Q_Intersectplot_quality.mw

restart:with(Physics):

Setup(dimension=3,coordinates=(X=[x,y,z])):

Define(Tp3[~alpha,~beta,~gamma],B[~lambda,mu],T3[~rho,~epsilon,~sigma]):

Tp3[~alpha,~beta,~gamma]=B[~alpa,rho]B[~beta,epsilon]B[~gamma,sigma]T3[~rho,~epsilon,~sigma]

SumOverRepeatedIndices of the expression does not do anything. Why?

Thanks for the answer.

Dear sir,

In the given problem, eta = 0 to 20, I want the table value of eta for a step size of 1000 (0 to 20 in thousand parts).

i have calculated only for one value, zero

Download Demo_paper_work.mw

hi,

I don't know how to test the answers I got in Mathematica, can you help me?
I can't send the file here, I really need help.

Can I solve the given biquadratic equation in terms of sigma. I only need real positive root, if any

6125*_Z^4 + 68644*_Z^3*sigma - 219625*_Z^3 + 255712*_Z^2*sigma - 959250*_Z^2 + 238144*_Z*sigma - 1113500*_Z - 245000

I tried with solve for variable but it does not work. 

These are two examples of challenging ode solutions to show they satisfy the ode.

I tried many things myself but can't do it. Feel free to use any method or trick you want. The goal is simply to show that the solution is correct. The solutions are correct as far as I know, but hard to show by back substitution since the solutions are given in form of integrals and RootOf in them.

Extra credit points will be awarded for those who manage to do both.

28148

interface(version);

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

Example 1

 

_EnvTry:='hard';
ode:=y(x) = arcsin(diff(y(x), x)) + ln(1 + diff(y(x), x)^2);
sol:=dsolve(ode);
r:=odetest(sol,ode);
coulditbe(r=0);

hard

y(x) = arcsin(diff(y(x), x))+ln(1+(diff(y(x), x))^2)

x-Intat(1/sin(RootOf(-_a+_Z+ln(sin(_Z)^2+1))), _a = y(x))-c__1 = 0

-arcsin(sin(RootOf(-y(x)+_Z+ln(3/2-(1/2)*cos(2*_Z)))))+RootOf(-y(x)+_Z+ln(3/2-(1/2)*cos(2*_Z)))

FAIL

Example 2

 

ode:=(1 + diff(y(x), x)^2)*(arctan(diff(y(x), x)) + a*x) + diff(y(x), x) = 0;
sol:=dsolve(ode);
r:=odetest(sol,ode);
coulditbe(r=0)

(1+(diff(y(x), x))^2)*(arctan(diff(y(x), x))+a*x)+diff(y(x), x) = 0

y(x) = Int(tan(RootOf(a*x*tan(_Z)^2+tan(_Z)^2*_Z+a*x+tan(_Z)+_Z)), x)+c__1

(-arctan(tan(RootOf(2*a*x+sin(2*_Z)+2*_Z)))+RootOf(2*a*x+sin(2*_Z)+2*_Z))*tan(RootOf(2*a*x+sin(2*_Z)+2*_Z))/(a*x+RootOf(2*a*x+sin(2*_Z)+2*_Z))

FAIL

 

 

Download showing_solution_satisfies_ode.mw

Hi,

I am exploring the boxplot, and I see that I do not have the option to integrate 2 lists: One for observations and one for frequencies. The BoxPlot command only accepts one list (List A in my example). Is there a way to create the BoxPlot using the 'Obs' and 'Eff' lists? Thank you for your insight

QBoxPlot.mw

As Maple is not equipped to handle numerical solutions of elliptic PDEs, can anyone help top solve PDEs by finite differences or any other numerical solver?

pde.mw

Dear Maple Community,

I would like to ask you a question which will certainly be elementary for you. Imagine that I have a PDE (or, more generally, a system of PDEs) with (t, x) being independent variables, and the dependent variable defining the wave height or the fluid particle velocity u(t,x). The best example is the famous KdV equation:

u[t] + u*u[x] + u[x,x,x] = 0.

Now, I would like to automatically derive the ODE(s) that satisfy the travelling waves of this equation. Namely, we have to substitute the travelling wave ansatz u(t,x) = U(X) = U(x - c*t), where c is the travelling wave speed. In the case of the KdV equation, we obtain the following ODE:

-c*U' + U*U' + U''' = 0,

where prime ' denotes the derivative with respect to the new variable X.

My question is the following: What is the best way to automatically obtain this PDE -> ODE reduction in Maple?

Thanks a lot in advance!

Kind regards,

DDe

How to make Maple simplify a/sqrt(tan(x+c__1)^2+1); to a/sqrt(sec(x+c__1)^2);  ?

Below is worksheet. since the second one is smaller in leaf size, expected simplify(...,size) to do it, But it did not. Any suggestions?

24832

LC:=MmaTranslator:-Mma:-LeafCount;
e1:=a/sqrt(tan(x+c__1)^2+1);
e2:=a/sqrt(sec(x+c__1)^2);

MmaTranslator:-Mma:-LeafCount

a/(tan(x+c__1)^2+1)^(1/2)

a/(sec(x+c__1)^2)^(1/2)

LC(e1);

12

LC(e2);

10

#we see they are same
simplify(e1-e2);

0

#both nothing below make e1 to e2
simplify(e1); #not good simplification at all. Adds csgn.
LC(%);

a*csgn(sec(x+c__1))*cos(x+c__1)

11

#expected this to do it but no
simplify(e1,size);
LC(%);

a/(tan(x+c__1)^2+1)^(1/2)

12

simplify(e1,trig);

a/(tan(x+c__1)^2+1)^(1/2)

combine(e1,trig);

a/(tan(x+c__1)^2+1)^(1/2)

 


Using some other software:

 

 

 

Download tan_sec_simplification_june_9_2024.mw

Can't figure out what code makes this simplification.
If this simplification works, it will be a part of a larger simplication procedure ( if it not conflicts hopefully) 
vereenvouding_hoe_-vraag_MPF.mw

I was trying to find out why my solution was not validating for this ode. It turned out because I was using solve instead of PDEtools:-Solve. It took me sometime to find this.

This made huge difference on odetest to verify the solution.

This is very simple ode. We just need to integrate once. But first we have to solve for y'(x). 

And here comes the difference. When I used solve to solve for y'(x), odetest did not verify the solution.

When using PDEtools:-Solve, it did.

The difference is how each returned the solution for y'(x). Both have RootOf but written differently and this made the difference.

1) Why solutions are written differently? 

2) Is this to be expected? I have thought Solve uses same engine as solve below the cover.

3) is it possible to make solve give the same form as Solve or change to that form?

I am now changing more of my code to use PDEtools:-Solve because of this.

27860

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 1757. The version installed in this computer is 1756 created 2024, June 5, 19:39 hours Pacific Time, found in the directory C:\Users\Owner\maple\toolbox\2024\Physics Updates\lib\`

Using solve

 

restart;

27860

ode:=x-ln(diff(y(x),x))-sin(diff(y(x),x))=0;
RHS:=solve(ode,diff(y(x),x));

x-ln(diff(y(x), x))-sin(diff(y(x), x)) = 0

RootOf(_Z-exp(-sin(_Z)+x))

mysol:= y(x) = Int(RHS,x)+c__1;

y(x) = Int(RootOf(_Z-exp(-sin(_Z)+x)), x)+c__1

odetest(mysol,ode);

-ln(RootOf(_Z-exp(-sin(_Z)+x)))+x-sin(RootOf(_Z-exp(-sin(_Z)+x)))

using PDEtools:-Solve (now it verifies) with no extra effort

 

restart;

27860

ode:=x-ln(diff(y(x),x))-sin(diff(y(x),x))=0;
RHS:=PDEtools:-Solve(ode,diff(y(x),x)):
RHS:=rhs(%);

x-ln(diff(y(x), x))-sin(diff(y(x), x)) = 0

RootOf(-x+ln(_Z)+sin(_Z))

mysol:= y(x) = Int(RHS,x)+c__1;

y(x) = Int(RootOf(-x+ln(_Z)+sin(_Z)), x)+c__1

odetest(mysol,ode);

0

 

 

Download PDEtools_Solve_vs_solve_june_8_2024.mw

 

Update

Here is a counter example. Where now it is the other way around.

Using solve makes odetest happy, but when using PDEtools:-Solve odetest does not verify the solution.  Same exact ODE.   


 

28652

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 1757 and is the same as the version installed in this computer, created 2024, June 6, 14:53 hours Pacific Time.`

Example, using solve works

 

ode:=exp(diff(y(x), x) - y(x)) - diff(y(x), x)^2 + 1 = 0;
RHS:=solve(ode,diff(y(x),x));
RHS:=eval(RHS,y(x)=y);
mysol:=Intat(eval(1/RHS,y=_a),_a=y(x))=x+c__1;
odetest(mysol,ode);

exp(diff(y(x), x)-y(x))-(diff(y(x), x))^2+1 = 0

Warning, solutions may have been lost

RootOf(-exp(_Z-y(x))+_Z^2-1)

RootOf(-exp(_Z-y)+_Z^2-1)

Intat(1/RootOf(-exp(_Z-_a)+_Z^2-1), _a = y(x)) = x+c__1

0

Example, using PDEtools:-Solve fails

 

ode:=exp(diff(y(x), x) - y(x)) - diff(y(x), x)^2 + 1 = 0;
RHS:=rhs(PDEtools:-Solve(ode,diff(y(x),x)));
RHS:=eval(RHS,y(x)=y);
mysol:=Intat(eval(1/RHS,y=_a),_a=y(x))=x+c__1;
odetest(mysol,ode);

exp(diff(y(x), x)-y(x))-(diff(y(x), x))^2+1 = 0

RootOf(_Z^2*exp(y(x))-exp(_Z)-exp(y(x)))

RootOf(_Z^2*exp(y)-exp(_Z)-exp(y))

Intat(1/RootOf(_Z^2*exp(_a)-exp(_Z)-exp(_a)), _a = y(x)) = x+c__1

exp(RootOf(_Z^2*exp(y(x))-exp(_Z)-exp(y(x)))-y(x))-RootOf(_Z^2*exp(y(x))-exp(_Z)-exp(y(x)))^2+1

 


 

Download PDEtools_Solve_vs_solve_june_9_2024.mw

So now I have no idea which to use. Sometimes solve works and sometimes Solve works. I  guess I have to now solve the ode both ways each time and see which works.

 

First 8 9 10 11 12 13 14 Last Page 10 of 2337