MaplePrimes Questions

I am working on visualizing the results of an SIR model in Maple. I’ve created multiple plots for different parameter values using dsolve and odeplot, and I’d like to arrange them in a grid (e.g., 2 rows x 3 columns) for easier comparison. Here’s what I’ve tried:

restart; with(plots); n := 10^6; s__0 := n-1; i__0 := 1; r__0 := 0; simulate_SIR := proc (beta, gamma) local lambda, sys, ic, sols, single_plot; lambda := beta*i(t)/n; sys := diff(s(t), t) = -lambda*s(t), diff(i(t), t) = lambda*s(t)-gamma*i(t), diff(r(t), t) = gamma*i(t); ic := s(0) = s__0, i(0) = i__0, r(0) = r__0; sols := dsolve({sys, ic}, numeric, output = listprocedure); single_plot := display([odeplot(sols, [t, s(t)], 0 .. 60, color = red), odeplot(sols, [t, i(t)], 0 .. 60, color = blue), odeplot(sols, [t, r(t)], 0 .. 60, color = green)], labels = ["Time [day]", "Population"], labeldirections = [horizontal, vertical], legend = ["Susceptible", "Infected", "Recovered"], legendstyle = [location = right]); return single_plot end proc; plot1 := simulate_SIR(.1, .1); plot2 := simulate_SIR(.2, .1); plot3 := simulate_SIR(.7, .1); plot4 := simulate_SIR(1.5, .1); plot5 := simulate_SIR(1, 0.25e-1); plot6 := simulate_SIR(1, .2); plot7 := simulate_SIR(1, .5); plot8 := simulate_SIR(1, 1); combined_plot := display([plot1, plot2, plot3, plot4, plot5, plot6, plot7, plot8], insequence = true, view = [0 .. 60, 0 .. n], grid = [2, 4]); combined_plot

 
 

NULL

Download grid.mw

Unfortunately, the insequence=true and gird=[2, 4] options didn’t work as I expected. Instead of arranging the plots in a grid, they appear like an animation

How can I correctly arrange multiple plots into a grid layout in Maple? Are there specific options or steps I’m missing? I would appreciate any guidance or examples.

I am doing some work in Maple.  Specifically, I run the following commands in Maple worksheet mode:

with(Statistics);
L := abs(RandomVariable(UniformDistribution(0, 1)) - RandomVariable(UniformDistribution(0, 1)));
Export("LineDensity.jpg", DensityPlot(L));
PDF(L, x);

Everything works fine.  When I export these commands into an MPL script, I get the following:

with(Statistics);
L := abs(RandomVariable(UniformDistribution(0, 1)) - RandomVariable(UniformDistribution(0, 1)));
Export("LineDensity.jpg", DensityPlot(L));
PDF(L, x);
NULL;

When I execute this script, I get the following error message:

Warning: persistent store makes readlib obsolete
Error: (in Export) exported file LineDensity.jpg could not be created

I need to do the work in MPL script form so that I can have larger problems processed.  Does anyone know why I would be having this problem with the Export function?  

I did a lot  of time but this time i don't know why not run any one have idea?

restart

with(PDEtools)

with(LinearAlgebra)

with(Physics)

with(SolveTools)

undeclare(prime)

`There is no more prime differentiation variable; all derivatives will be displayed as indexed functions`

(1)

declare(u(x, t)); declare(U(xi)); declare(G(xi))

u(x, t)*`will now be displayed as`*u

 

U(xi)*`will now be displayed as`*U

 

G(xi)*`will now be displayed as`*G

(2)

T := xi = -V*t+x; T1 := u(x, t) = U(-V*t+x)*exp(I*(-k*x+t*w+theta))

xi = -V*t+x

 

u(x, t) = U(-V*t+x)*exp(I*(-k*x+t*w+theta))

(3)

P3 := diff(u(x, t), x, t)

``

(4)

P33 := diff(u(x, t), x)

diff(u(x, t), x)

(5)

P333 := diff(P33, t)

NULL

Download why.mw

I already get the same results, but there's something about the factoring process that I encountered for the first time in this ODE. In the paper, it says that G′ satisfies a certain condition, but I’m not sure exactly what that means. Did the author use it for substitution, or did they change (m+F) into another variable and then solve? I’m not exactly sure what approach was taken. Does anyone have any idea or insight into this?

restart

with(PDEtools)

with(LinearAlgebra)

NULL

with(SolveTools)

undeclare(prime)

`There is no more prime differentiation variable; all derivatives will be displayed as indexed functions`

(1)

declare(Omega(x, t)); declare(U(xi)); declare(u(x, y, z, t)); declare(Q(xi))

Omega(x, t)*`will now be displayed as`*Omega

 

U(xi)*`will now be displayed as`*U

 

u(x, y, z, t)*`will now be displayed as`*u

 

Q(xi)*`will now be displayed as`*Q

(2)

tr := {t = tau, x = (-ZETA*c[3]-tau*c[4]-`Υ`*c[2]+xi)/c[1], y = `Υ`, z = ZETA, u(x, y, z, t) = U(xi)}

{t = tau, x = (-Zeta*c[3]-tau*c[4]-`Υ`*c[2]+xi)/c[1], y = `Υ`, z = Zeta, u(x, y, z, t) = U(xi)}

(3)

pde1 := diff(u(x, y, z, t), `$`(x, 3), z)-4*(diff(u(x, y, z, t), x, t))+4*(diff(u(x, y, z, t), x))*(diff(u(x, y, z, t), x, z))+2*(diff(u(x, y, z, t), `$`(x, 2)))*(diff(u(x, y, z, t), z))+3*(diff(u(x, y, z, t), `$`(y, 2))) = 0

diff(diff(diff(diff(u(x, y, z, t), x), x), x), z)-4*(diff(diff(u(x, y, z, t), t), x))+4*(diff(u(x, y, z, t), x))*(diff(diff(u(x, y, z, t), x), z))+2*(diff(diff(u(x, y, z, t), x), x))*(diff(u(x, y, z, t), z))+3*(diff(diff(u(x, y, z, t), y), y)) = 0

(4)

``

L1 := PDEtools:-dchange(tr, pde1, [xi, `Υ`, ZETA, tau, U])

(diff(diff(diff(diff(U(xi), xi), xi), xi), xi))*c[1]^3*c[3]-4*(diff(diff(U(xi), xi), xi))*c[4]*c[1]+6*(diff(U(xi), xi))*c[1]^2*(diff(diff(U(xi), xi), xi))*c[3]+3*(diff(diff(U(xi), xi), xi))*c[2]^2 = 0

(5)

map(int, (diff(diff(diff(diff(U(xi), xi), xi), xi), xi))*c[1]^3*c[3]-4*(diff(diff(U(xi), xi), xi))*c[4]*c[1]+6*(diff(U(xi), xi))*c[1]^2*(diff(diff(U(xi), xi), xi))*c[3]+3*(diff(diff(U(xi), xi), xi))*c[2]^2 = 0, xi)

c[1]^3*c[3]*(diff(diff(diff(U(xi), xi), xi), xi))+3*c[2]^2*(diff(U(xi), xi))-4*c[4]*c[1]*(diff(U(xi), xi))+3*c[1]^2*c[3]*(diff(U(xi), xi))^2 = 0

(6)

ode := %

c[1]^3*c[3]*(diff(diff(diff(U(xi), xi), xi), xi))+3*c[2]^2*(diff(U(xi), xi))-4*c[4]*c[1]*(diff(U(xi), xi))+3*c[1]^2*c[3]*(diff(U(xi), xi))^2 = 0

(7)

F := sum(a[i]*(m+1/(diff(G(xi), xi)))^i, i = -1 .. 1)

a[-1]/(m+1/(diff(G(xi), xi)))+a[0]+a[1]*(m+1/(diff(G(xi), xi)))

(8)

D1 := diff(F, xi)

a[-1]*(diff(diff(G(xi), xi), xi))/((m+1/(diff(G(xi), xi)))^2*(diff(G(xi), xi))^2)-a[1]*(diff(diff(G(xi), xi), xi))/(diff(G(xi), xi))^2

(9)

S := diff(G(xi), `$`(xi, 2)) = -(2*m*mu+lambda)*(diff(G(xi), xi))-mu

diff(diff(G(xi), xi), xi) = -(2*m*mu+lambda)*(diff(G(xi), xi))-mu

(10)

E1 := subs(S, D1)

a[-1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)/((m+1/(diff(G(xi), xi)))^2*(diff(G(xi), xi))^2)-a[1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)/(diff(G(xi), xi))^2

(11)

D2 := diff(E1, xi)

2*a[-1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)*(diff(diff(G(xi), xi), xi))/((m+1/(diff(G(xi), xi)))^3*(diff(G(xi), xi))^4)-2*a[-1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)*(diff(diff(G(xi), xi), xi))/((m+1/(diff(G(xi), xi)))^2*(diff(G(xi), xi))^3)-a[-1]*(2*m*mu+lambda)*(diff(diff(G(xi), xi), xi))/((m+1/(diff(G(xi), xi)))^2*(diff(G(xi), xi))^2)+2*a[1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)*(diff(diff(G(xi), xi), xi))/(diff(G(xi), xi))^3+a[1]*(2*m*mu+lambda)*(diff(diff(G(xi), xi), xi))/(diff(G(xi), xi))^2

(12)

E2 := subs(S, D2)

2*a[-1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)^2/((m+1/(diff(G(xi), xi)))^3*(diff(G(xi), xi))^4)-2*a[-1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)^2/((m+1/(diff(G(xi), xi)))^2*(diff(G(xi), xi))^3)-a[-1]*(2*m*mu+lambda)*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)/((m+1/(diff(G(xi), xi)))^2*(diff(G(xi), xi))^2)+2*a[1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)^2/(diff(G(xi), xi))^3+a[1]*(2*m*mu+lambda)*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)/(diff(G(xi), xi))^2

(13)

D3 := diff(E2, xi)

6*a[-1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)^2*(diff(diff(G(xi), xi), xi))/((m+1/(diff(G(xi), xi)))^4*(diff(G(xi), xi))^6)-12*a[-1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)^2*(diff(diff(G(xi), xi), xi))/((m+1/(diff(G(xi), xi)))^3*(diff(G(xi), xi))^5)-6*a[-1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)*(2*m*mu+lambda)*(diff(diff(G(xi), xi), xi))/((m+1/(diff(G(xi), xi)))^3*(diff(G(xi), xi))^4)+6*a[-1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)^2*(diff(diff(G(xi), xi), xi))/((m+1/(diff(G(xi), xi)))^2*(diff(G(xi), xi))^4)+6*a[-1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)*(2*m*mu+lambda)*(diff(diff(G(xi), xi), xi))/((m+1/(diff(G(xi), xi)))^2*(diff(G(xi), xi))^3)+a[-1]*(2*m*mu+lambda)^2*(diff(diff(G(xi), xi), xi))/((m+1/(diff(G(xi), xi)))^2*(diff(G(xi), xi))^2)-6*a[1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)^2*(diff(diff(G(xi), xi), xi))/(diff(G(xi), xi))^4-6*a[1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)*(2*m*mu+lambda)*(diff(diff(G(xi), xi), xi))/(diff(G(xi), xi))^3-a[1]*(2*m*mu+lambda)^2*(diff(diff(G(xi), xi), xi))/(diff(G(xi), xi))^2

(14)

E3 := subs(S, D3)

6*a[-1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)^3/((m+1/(diff(G(xi), xi)))^4*(diff(G(xi), xi))^6)-12*a[-1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)^3/((m+1/(diff(G(xi), xi)))^3*(diff(G(xi), xi))^5)-6*a[-1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)^2*(2*m*mu+lambda)/((m+1/(diff(G(xi), xi)))^3*(diff(G(xi), xi))^4)+6*a[-1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)^3/((m+1/(diff(G(xi), xi)))^2*(diff(G(xi), xi))^4)+6*a[-1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)^2*(2*m*mu+lambda)/((m+1/(diff(G(xi), xi)))^2*(diff(G(xi), xi))^3)+a[-1]*(2*m*mu+lambda)^2*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)/((m+1/(diff(G(xi), xi)))^2*(diff(G(xi), xi))^2)-6*a[1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)^3/(diff(G(xi), xi))^4-6*a[1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)^2*(2*m*mu+lambda)/(diff(G(xi), xi))^3-a[1]*(2*m*mu+lambda)^2*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)/(diff(G(xi), xi))^2

(15)

NULL

NULL

K := U(xi) = F

U(xi) = a[-1]/(m+1/(diff(G(xi), xi)))+a[0]+a[1]*(m+1/(diff(G(xi), xi)))

(16)

K1 := diff(U(xi), xi) = E1

diff(U(xi), xi) = a[-1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)/((m+1/(diff(G(xi), xi)))^2*(diff(G(xi), xi))^2)-a[1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)/(diff(G(xi), xi))^2

(17)

K2 := diff(U(xi), `$`(xi, 2)) = E2

diff(diff(U(xi), xi), xi) = 2*a[-1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)^2/((m+1/(diff(G(xi), xi)))^3*(diff(G(xi), xi))^4)-2*a[-1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)^2/((m+1/(diff(G(xi), xi)))^2*(diff(G(xi), xi))^3)-a[-1]*(2*m*mu+lambda)*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)/((m+1/(diff(G(xi), xi)))^2*(diff(G(xi), xi))^2)+2*a[1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)^2/(diff(G(xi), xi))^3+a[1]*(2*m*mu+lambda)*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)/(diff(G(xi), xi))^2

(18)

K3 := diff(U(xi), `$`(xi, 3)) = E3

diff(diff(diff(U(xi), xi), xi), xi) = 6*a[-1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)^3/((m+1/(diff(G(xi), xi)))^4*(diff(G(xi), xi))^6)-12*a[-1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)^3/((m+1/(diff(G(xi), xi)))^3*(diff(G(xi), xi))^5)-6*a[-1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)^2*(2*m*mu+lambda)/((m+1/(diff(G(xi), xi)))^3*(diff(G(xi), xi))^4)+6*a[-1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)^3/((m+1/(diff(G(xi), xi)))^2*(diff(G(xi), xi))^4)+6*a[-1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)^2*(2*m*mu+lambda)/((m+1/(diff(G(xi), xi)))^2*(diff(G(xi), xi))^3)+a[-1]*(2*m*mu+lambda)^2*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)/((m+1/(diff(G(xi), xi)))^2*(diff(G(xi), xi))^2)-6*a[1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)^3/(diff(G(xi), xi))^4-6*a[1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)^2*(2*m*mu+lambda)/(diff(G(xi), xi))^3-a[1]*(2*m*mu+lambda)^2*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)/(diff(G(xi), xi))^2

(19)

NULL

L := eval(ode, {K, K1, K2, K3})

c[1]^3*c[3]*(6*a[-1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)^3/((m+1/(diff(G(xi), xi)))^4*(diff(G(xi), xi))^6)-12*a[-1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)^3/((m+1/(diff(G(xi), xi)))^3*(diff(G(xi), xi))^5)-6*a[-1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)^2*(2*m*mu+lambda)/((m+1/(diff(G(xi), xi)))^3*(diff(G(xi), xi))^4)+6*a[-1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)^3/((m+1/(diff(G(xi), xi)))^2*(diff(G(xi), xi))^4)+6*a[-1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)^2*(2*m*mu+lambda)/((m+1/(diff(G(xi), xi)))^2*(diff(G(xi), xi))^3)+a[-1]*(2*m*mu+lambda)^2*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)/((m+1/(diff(G(xi), xi)))^2*(diff(G(xi), xi))^2)-6*a[1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)^3/(diff(G(xi), xi))^4-6*a[1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)^2*(2*m*mu+lambda)/(diff(G(xi), xi))^3-a[1]*(2*m*mu+lambda)^2*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)/(diff(G(xi), xi))^2)+3*c[2]^2*(a[-1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)/((m+1/(diff(G(xi), xi)))^2*(diff(G(xi), xi))^2)-a[1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)/(diff(G(xi), xi))^2)-4*c[4]*c[1]*(a[-1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)/((m+1/(diff(G(xi), xi)))^2*(diff(G(xi), xi))^2)-a[1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)/(diff(G(xi), xi))^2)+3*c[1]^2*c[3]*(a[-1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)/((m+1/(diff(G(xi), xi)))^2*(diff(G(xi), xi))^2)-a[1]*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)/(diff(G(xi), xi))^2)^2 = 0

(20)

"collect(L,(m+1/(diff(G(xi),xi))))^( )"

Error, (in collect) cannot collect m+1/diff(G(xi),xi)

 
 

NULL

Download factoring.mw

I am trying to see if I can get speed up by using dsolve inside thread.

I made very simple example of global list of two differential equations to start with.

Next, created two threads where each picks one ode from the global list to process. So they should in theory run in parallel. The list of ode's is a global list in the worksheet for now.

But I keep getting error when calling dsolve 

               Error, (in dsolve) type `System` does not exist

I tried also passing the actual ode to the thread, still, same error.

Next, I did not pass anything, but called dsolve directly from inside thread proc on same ode. The ode is local variable inside the proc. I still get same error.

                        Does this mean dsolve is not supported by threads? 

But when I searched this subject, AI says it works in threads:

 

Everything works OK when I run dsolve in worksheet outside thread (i.e. normally).

I will show below worksheet showing these cases. I must not be doing something right. But what? Can one not pass data from global worksheet to the thread this way? Or does one needs to load something in each thread to make this work?

interface(version);

`Standard Worksheet Interface, Maple 2024.2, Windows 10, October 29 2024 Build ID 1872373`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1840 and is the same as the version installed in this computer, created 2024, December 2, 10:11 hours Pacific Time.`

libname;

"C:\Users\Owner\maple\toolbox\2024\Physics Updates\lib", "C:\Program Files\Maple 2024\lib"

Example 1. Passing index of list to thread

 

restart;

g_list:=[sin(t)*diff(x(t),t$2)+cos(t)*diff(x(t),t)+2*x(t)=0,
         diff(y(x),x)=lambda*sin(lambda*x)*y(x)^2+a*cos(lambda*x)^n*y(x)-a*cos(lambda*x)^(n-1)]:

work_func:=proc(i::posint)  
  :-dsolve(g_list[i]):
end proc:

Threads:-Wait(  seq( Threads:-Create( work_func(i)), i=1..2) );

Error, (in dsolve) type `System` does not exist

Example 2. Passing actual ode itself to thread

 

restart;

g_list:=[sin(t)*diff(x(t),t$2)+cos(t)*diff(x(t),t)+2*x(t)=0,
         diff(y(x),x)=lambda*sin(lambda*x)*y(x)^2+a*cos(lambda*x)^n*y(x)-a*cos(lambda*x)^(n-1)]:

work_func:=proc(ode::`=`)  
  :-dsolve(ode):
end proc:

Threads:-Wait(  seq( Threads:-Create( work_func(g_list[i])), i=1..2) );

Error, (in dsolve) type `System` does not exist

 

Example 3. Normal processing. No threads

 

restart;

g_list:=[sin(t)*diff(x(t),t$2)+cos(t)*diff(x(t),t)+2*x(t)=0,
         diff(y(x),x)=lambda*sin(lambda*x)*y(x)^2+a*cos(lambda*x)^n*y(x)-a*cos(lambda*x)^(n-1)]:

work_func:=proc(ode::`=`)  
  :-dsolve(ode):
end proc:

for item in g_list do
    work_func(item);
od:

#no error

 

Example 4. do not pass anything. Just call dsolve

 

restart;

work_func:=proc(i::posint)  
  local x,t;
  local ode:=sin(t)*diff(x(t),t$2)+cos(t)*diff(x(t),t)+2*x(t)=0;
  :-dsolve(ode):
end proc:

Threads:-Wait(  seq( Threads:-Create( work_func(i)), i=1..2) );

Error, (in dsolve) type `System` does not exist

 

 

 

Download error_dsolve_using_threads_dec_26_2024.mw

restart;

Here are the graphs of a parabola and a straight line:

plots:-display(
        plot(x^2, x=-1..1),
        plot((x+1)/2, x=-1..1),
color=["Red","Green"]);

 

Suppose I want to plot the part of the parabola that lies below

the straight line, and suppose, just to be nasty, I choose to do it

with implicitplot:

plots:-implicitplot(y=x^2, x=-1..1, y=0..(x+1)/2);

 

That is not a parabola at all.  [And where does the "ynew" label come from?]

 

This behavior was introduced in Maple 2022.

In Maple 2021 we get the expected result:

plots:-implicitplot(y=x^2, x=-1..1, y=0..(x+1)/2);


 

Download mw.mw

It is not clear to me how to set up parallel processing for let's say 10 completely independent tasks/processes process1,process2 .....process10

Further, no communication between the 10 tasks/processes, process1,process2 .....process10, takes place and they only use  previously calculated functions and variables in the worksheet.

So how do you set up the 10 processes to run in parallel using proc or grid.  ??

I cannot make out from the examples in the manual how and where the processes are run.

I am looking for a more eligent way to convert a Vector to a Diagonal Matrix.

restart

 

 

with(LinearAlgebra):

 

V:=Vector[column](3, [0.5863730366, 0.1171249270, 0.2965020364])

Vector(3, {(1) = .5863730366, (2) = .1171249270, (3) = .2965020364})

(1)

Vm:=Matrix(3,[[V[1],0,0],[0,V[2],0],[0,0,V[3]]])

Matrix(3, 3, {(1, 1) = .5863730366, (1, 2) = 0, (1, 3) = 0, (2, 1) = 0, (2, 2) = .1171249270, (2, 3) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = .2965020364})

(2)

Vm1:=Matrix(3,3):

for i to 3 do
Vm1[i,i]:=V[i];
end do:

Vm1

Matrix(3, 3, {(1, 1) = .5863730366, (1, 2) = 0, (1, 3) = 0, (2, 1) = 0, (2, 2) = .1171249270, (2, 3) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = .2965020364})

(3)
 

 

Download 2024-12-26_Q_Diagonal_Matrix_from_Vector.mw

This is an ode from textbook. dsolve gives new error I have not seen before. 

Maple 2024.2 on windows 10.

interface(version);

`Standard Worksheet Interface, Maple 2024.2, Windows 10, October 29 2024 Build ID 1872373`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1839 and is the same as the version installed in this computer, created 2024, December 2, 10:11 hours Pacific Time.`

restart;

libname;

"C:\Users\Owner\maple\toolbox\2024\Physics Updates\lib", "C:\Program Files\Maple 2024\lib"

ode:=y(x)^2*diff(y(x),x$3)-(3*y(x)*diff(y(x),x)+2*x*y(x)^2 )*diff(y(x),x$2)+(2*diff(y(x),x)^2+2*x*y(x)*diff(y(x),x)+3*x^2*y(x)^2)*diff(y(x),x)+x^3*y(x)^3=0;

y(x)^2*(diff(diff(diff(y(x), x), x), x))-(3*y(x)*(diff(y(x), x))+2*x*y(x)^2)*(diff(diff(y(x), x), x))+(2*(diff(y(x), x))^2+2*x*y(x)*(diff(y(x), x))+3*x^2*y(x)^2)*(diff(y(x), x))+x^3*y(x)^3 = 0

dsolve(ode);

Error, (in factor) too many levels of recursion

infolevel[dsolve]:=5;

5

dsolve(ode);

Methods for third order ODEs:

--- Trying classification methods ---

trying 3rd order ODE linearizable_by_differentiation

differential order: 3; trying a linearization to 4th order

trying differential order: 3; missing variables

trying differential order: 3; exact nonlinear

trying 3rd order, integrating factor of the form mu(y'') for some mu

Trying the formal computation of integrating factors depending on any 2 of [x, y, y', y'']

         *** Sublevel 2 ***

         Methods for first order ODEs:

         --- Trying classification methods ---

         trying a quadrature

         trying 1st order linear

         <- 1st order linear successful

Successful computation of 3 integrating factors: [x*exp(-1/2*x^2*(I*2^(1/2)+1))*KummerM(3/4+1/8*I*2^(1/2),3/2,I*2^(1/2)*x^2)/y(x), x*exp(-1/2*x^2*(I*2^(1/2)+1))*KummerU(3/4+1/8*I*2^(1/2),3/2,I*2^(1/2)*x^2)/y(x), x*exp(-1/2*x^2*(I*2^(1/2)+1))*(Int(x*KummerM(3/4+1/8*I*2^(1/2),3/2,I*2^(1/2)*x^2)*exp(-1/2*x^2*(I*2^(1/2)-1)),x)*KummerU(3/4+1/8*I*2^(1/2),3/2,I*2^(1/2)*x^2)-Int(x*KummerU(3/4+1/8*I*2^(1/2),3/2,I*2^(1/2)*x^2)*exp(-1/2*x^2*(I*2^(1/2)-1)),x)*KummerM(3/4+1/8*I*2^(1/2),3/2,I*2^(1/2)*x^2))/y(x)]

Attempting computing related first integrals...

Error, (in factor) too many levels of recursion

 

 

Download dsolve_factor_dec_24_2024.mw

tracelast;  gives long output with this at end

#(IntegrationTools:-Indefinite:-Polynomial,14): return poly/primitivepart*thisproc(primitivepart,var)
 IntegrationTools:-Indefinite:-Polynomial called with arguments: (8*I)*x*KummerM(3/4+((1/8)*I)*2^(1/2), 3/2, I*2^(1/2)*x^2)*x1*2^(1/2)-(3*I)*2^(1/2)*KummerM(3/4+((1/8)*I)*2^(1/2), 3/2, I*2^(1/2)*x^2)*y+(7*I)*2^(1/2)*KummerM(((1/8)*I)*2^(1/2)+7/4, 3/2, I*2^(1/2)*x^2)*y+12*x^2*KummerM(3/4+((1/8)*I)*2^(1/2), 3/2, I*2^(1/2)*x^2)*y+8*x*KummerM(3/4+((1/8)*I)*2^(1/2), 3/2, I*2^(1/2)*x^2)*x1+4*KummerM(((1/8)*I)*2^(1/2)+7/4, 3/2, I*2^(1/2)*x^2)*y, x1, nofactor = false
 #(IntegrationTools:-Indefinite:-Polynomial,8): newpoly := factor(poly)
Error, (in factor) too many levels of recursion
 locals defined as: p = p, primitivepart = primitivepart, base = base, exponent = exponent, subpolys = subpolys, change = change, newpoly = newpoly, u = u

Also, this error can not be cought using try/catch. 

I cannot find any examples of how to raise the software memory limits to maximum with the mentioned  -T switch in the manual to avoid memory allocation error popup.

Neither are there any examples posted on the web.

It cannot be a hardware allocation error, as the system memory is large.

So how is the -T switch implimented

I'm working on solving a system of ODEs in Maple that models an epidemic scenario, tracking the number of susceptible, infected, and recovered individuals over time. Here's what I've done so far:
Download sir_model.mw

Created a table of results at daily intervals with the following code:

results := [seq([t = tval, s = round(evalf(sol(tval)[2][1])), i = round(evalf(sol(tval)[2][2])),r = round(evalf(sol(tval)[2][2]))], tval = 0 .. 50)];

printf("%-10s %-15s %-15s %-15s\n", "Day", "Infected", "Recovered");
printf("---------------------------------------------\n");
for entry in results do
    printf("%-10d %-15d %-15d %-15d\n", entry[t],entry[s], entry[i], entry[r]);
end do;

but I encountered an error (in fprintf) integer expected for integer format

Hi,

just a quick question: Is it possible to customize the default worksheet with my own settings/styles, such that my settings are loaded automically when I create a new worksheet? I've tried to change my settings/styles and apply that globally but, once I leave MF and re-launch it, my settings/styles are not loaded.

Thanks very much in advance.

Hello, I have a question regarding finding two vectors that result in a resulting vector with only the directions of the two needed vectors.

Given:

- Vector F_RC1

- Unit Vector of F_RC1Y (called EV_C1Y)

- Unit Vector of F_RC1_ST (called EV_C1_ST)

Needed

- F_RC1_ST

- F_RC1Y

The picture below and the file should make it clear. 

vector_question.mw

How do I approach this? Best regards,

First 43 44 45 46 47 48 49 Last Page 45 of 2425