Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

something I always wondered about. On Maple website it says

Notice the date above., December 26.

On my Maple, with latest update, same version is printed, but the date is way off.

It says December 2, not 26.

Why is that? Should not the date be the same sicne same version 1840 of Physics update?

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.`

 

 

Download physics_version.mw

I like the scrollable vectors up to a point. They seem to be unnecessarly width restricted. Is there any way to increase this? Could anything be added to the .ini file as the is an entry in there to disable them?

Also, if the command is entered again it is ok

Where is the backup directory of auto saves stored - windows?

 

Maple Transactions Volume 4 Issue 4 has now been published.

 

This issue has two Featured Contributions by people who have been plenary speakers at Maple Conferences in the past, namely Veselin Jungić and Juana Sendra. We hope you enjoy both articles.  There is an accompanying video by Professor Sendra, which we will add a link to when it becomes ready.

As usual, there is an article in the Editor's Corner, but this one is a bit different.  In this one, Michelle Hatzell (the new copyeditor for Maple Transactions, who is also a Masters' student working with me at Western) and I have written about a fun use of Maple's colour contour plots to make an image that might be used as the cover of an upcoming book, namely Perturbation Methods using backward error, which I'm just finishing now with Nic Fillion and which SIAM will publish next year.  So, while there's some math in that paper, it's more about Maple's utilities for colour plotting; so you might find it useful.  We also hope you like at least some of the images.  Some are more attractive than others!

We have several Refereed Contributions, not all of which are ready at this time of publication but which will be added as they are revised and sent in.  We have a nice paper on using continued fractions in a high school context, another on code generation, and another on using Digital Signal Processing in Engineering courses.

Finally we have a first publication in French, by Jalale Soussi.  Actually we have the paper also in English: we chose to publish both, in our Communications section, each with links to the other.  It is possible to publish in Maple Transactions solely in French, of course, but the author provided both, so why not?

Happy reading, and best wishes for 2025. 

The goal is to eliminate x, y and z from [a^2=(4*y*z)/((x+y)*(x+z)),b^2=(4*z*x)/((y+z)*(y+x)),c^2=(4*x*y)/((z+x)*(z+y))]. However, eliminate only outputs a null expression (I added a  to emphasize it): 

restart;
expr := 4*[y*z/((x + y)*(x + z)), z*x/((y + z)*(y + x)), x*y/((z + x)*(z + y))]:
{eliminate}([a, b, c]**~2 =~ expr, [x, y, z]);
 = 
                               {}

Why is the result empty? 
In my view, the result should be (a*b*c)**2 = ((a**2 + b**2 + c**2) - 2**2)**2 (or its equivalent). One may verify this by: 

seq(seq(seq(
    is(eval((a^2 + b^2 + c^2 - 4)^2 = (a*b*c)^2, 
      elementwise([a, b, c] = [k1, k2, k3]*sqrt(expr)))), 
    `in`(k3, [-1, +1])), `in`(k2, [-1, +1])), `in`(k1, [-1, +1]));
 = 
         true, true, true, true, true, true, true, true

I’ve spent considerable effort trying to understand how the solution was derived, particularly the approach involving the factoring of G′/G. Despite my attempts, the methodology remains elusive. It seems there’s an innovative idea at play here—something beyond the techniques we’ve applied in similar problems before. While I suspect it involves a novel perspective, I can’t quite pinpoint what it might be.

If anyone has insights into how this factoring is achieved or can shed light on the underlying idea, I’d greatly appreciate your help.


 

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)

_local(gamma)

Warning, A new binding for the name `gamma` has been created. The global instance of this name is still accessible using the :- prefix, :-`gamma`.  See ?protect for details.

 

declare(Omega(x, t)); declare(U(xi)); declare(u(x, y, z, t)); declare(Q(xi)); declare(V(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

 

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

(2)

``

ode := (-V*a[2]+a[1])*(diff(diff(U(xi), xi), xi))+U(xi)*(((-gamma+sigma)*k+b)*U(xi)^2-a[1]*k^2+(w*a[2]-alpha)*k-w) = 0

(-V*a[2]+a[1])*(diff(diff(U(xi), xi), xi))+U(xi)*(((-gamma+sigma)*k+b)*U(xi)^2-a[1]*k^2+(w*a[2]-alpha)*k-w) = 0

(3)

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

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

(4)

D1 := diff(F, xi)

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

(5)

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

(6)

E1 := subs(S, D1)

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

(7)

D2 := diff(E1, xi)

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

(8)

E2 := subs(S, D2)

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

(9)

D3 := diff(E2, xi)

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

(10)

E3 := subs(S, D3)

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

(11)

``

NULL

K := U(xi) = F

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

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

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

``

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

(-V*a[2]+a[1])*(2*c[-1]*((-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)/G(xi)-(diff(G(xi), xi))^2/G(xi)^2)^2/(m+(diff(G(xi), xi))/G(xi))^3-c[-1]*(-(2*m*mu+lambda)*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)/G(xi)-3*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)*(diff(G(xi), xi))/G(xi)^2+2*(diff(G(xi), xi))^3/G(xi)^3)/(m+(diff(G(xi), xi))/G(xi))^2+c[1]*(-(2*m*mu+lambda)*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)/G(xi)-3*(-(2*m*mu+lambda)*(diff(G(xi), xi))-mu)*(diff(G(xi), xi))/G(xi)^2+2*(diff(G(xi), xi))^3/G(xi)^3))+(c[-1]/(m+(diff(G(xi), xi))/G(xi))+c[0]+c[1]*(m+(diff(G(xi), xi))/G(xi)))*(((-gamma+sigma)*k+b)*(c[-1]/(m+(diff(G(xi), xi))/G(xi))+c[0]+c[1]*(m+(diff(G(xi), xi))/G(xi)))^2-a[1]*k^2+(w*a[2]-alpha)*k-w) = 0

(12)

NULL

# rewritting rule

RR := isolate(m+diff(G(xi), xi)/(G(xi))=Phi, diff(G(xi), xi)/G(xi));

(diff(G(xi), xi))/G(xi) = Phi-m

(13)

# Apply RR and collect wrt Phi

subs(RR, L):
normal(%):
PhiN := collect(numer(lhs(%)), phi):
PhiD := denom(lhs(%%));

Phi^3*G(xi)^4

(14)



with(LargeExpressions):

LLE := collect(PhiN, Phi, Veil[phi] ):
LLE / PhiD = 0;

(Phi^6*phi[1]+3*Phi^5*phi[2]-Phi^4*phi[3]-Phi^3*phi[4]-Phi^2*phi[5]+Phi*phi[6]-phi[7])/(Phi^3*G(xi)^4) = 0

(15)

# phi[i] coefficients


phis := [ seq( phi[i] = simplify(Unveil[phi](phi[i]), size), i=1..LastUsed[phi] ) ]:

print~( phis ):

phi[1] = c[1]^3*G(xi)^4*((-gamma+sigma)*k+b)

 

phi[2] = c[0]*G(xi)^4*c[1]^2*((-gamma+sigma)*k+b)

 

phi[3] = -3*G(xi)^4*c[1]*(-(1/3)*a[1]*k^2+(-c[-1]*(gamma-sigma)*c[1]+(-gamma+sigma)*c[0]^2+(1/3)*w*a[2]-(1/3)*alpha)*k+b*c[-1]*c[1]+b*c[0]^2-(1/3)*w)

 

phi[4] = G(xi)*(2*c[1]*(V*a[2]-a[1])*(diff(G(xi), xi))^3+3*c[1]*G(xi)*(2*m*mu+lambda)*(V*a[2]-a[1])*(diff(G(xi), xi))^2+((2*m*mu+lambda)^2*G(xi)+3*mu)*(V*a[2]-a[1])*G(xi)*c[1]*(diff(G(xi), xi))+G(xi)^2*(-c[0]*(6*c[-1]*((-gamma+sigma)*k+b)*c[1]-a[1]*k^2+k*w*a[2]+((-gamma+sigma)*k+b)*c[0]^2-k*alpha-w)*G(xi)+c[1]*mu*(2*m*mu+lambda)*(V*a[2]-a[1])))

 

phi[5] = -3*G(xi)^4*(-(1/3)*a[1]*k^2+(-c[-1]*(gamma-sigma)*c[1]+(-gamma+sigma)*c[0]^2+(1/3)*w*a[2]-(1/3)*alpha)*k+b*c[-1]*c[1]+b*c[0]^2-(1/3)*w)*c[-1]

 

phi[6] = 4*c[-1]*((1/2)*(V*a[2]-a[1])*(diff(G(xi), xi))^3+(3/2)*(m*mu+(1/2)*lambda)*(V*a[2]-a[1])*G(xi)*(diff(G(xi), xi))^2+(V*a[2]-a[1])*((m*mu+(1/2)*lambda)^2*G(xi)+(3/4)*mu)*G(xi)*(diff(G(xi), xi))+(1/2)*G(xi)^2*((3/2)*c[-1]*((-gamma+sigma)*k+b)*c[0]*G(xi)+(m*mu+(1/2)*lambda)*(V*a[2]-a[1])*mu))*G(xi)

 

phi[7] = 8*((1/4)*(V*a[2]-a[1])*(diff(G(xi), xi))^4+(V*a[2]-a[1])*G(xi)*(m*mu+(1/2)*lambda)*(diff(G(xi), xi))^3+(V*a[2]-a[1])*G(xi)*((m*mu+(1/2)*lambda)^2*G(xi)+(1/2)*mu)*(diff(G(xi), xi))^2+(V*a[2]-a[1])*G(xi)^2*(m*mu+(1/2)*lambda)*mu*(diff(G(xi), xi))+(1/4)*G(xi)^2*(-(1/2)*((-gamma+sigma)*k+b)*c[-1]^2*G(xi)^2+mu^2*(V*a[2]-a[1])))*c[-1]

(16)

# WATCHOUT: you have 9 coefficients and so its desirable to have the same number of unknowns

unknowns := indets(rhs~(phis), name);

COEFFS := solve(rhs~(phis), unknowns)

{V, alpha, b, gamma, k, lambda, m, mu, sigma, w, xi, a[1], a[2], c[-1], c[0], c[1]}

 

Error, (in solve) cannot solve expressions with diff(G(xi),xi) for xi

 

NULL

case1 := COEFFS[4]

{alpha = alpha, beta = gamma, delta = delta, gamma = gamma, k = k, lambda = 0, m = 2*n, mu = mu, n = n, sigma = 32*alpha*mu^2*n^4/a[-1]^2, w = -2*alpha*k^2*n-4*alpha*mu^2*n+delta^2, a[-1] = a[-1], a[0] = 0, a[1] = 0}

(17)

NULL

F1 := subs(case1, F)

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

(18)

F2 := subs(case1, ode)

128*V(xi)^4*n^6*alpha*mu^2/a[-1]^2+(16*alpha*k^2*n^4-8*delta^2*n^3+8*n^3*(-2*alpha*k^2*n-4*alpha*mu^2*n+delta^2))*V(xi)^2-4*V(xi)*(diff(diff(V(xi), xi), xi))*alpha*n^2 = 0

(19)

W := V(xi) = F1

V(xi) = a[-1]/(2*n+1/(diff(G(xi), xi)))

(20)

NULL

E := diff(G(xi), xi) = -(-2*m*mu-lambda)*exp(-(2*m*mu+lambda)*xi)*c__1/(2*m*mu+lambda)-mu/(2*m*mu+lambda)

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

(21)

W1 := subs(E, W)

V(xi) = a[-1]/(2*n+1/(-(-2*m*mu-lambda)*exp(-(2*m*mu+lambda)*xi)*c__1/(2*m*mu+lambda)-mu/(2*m*mu+lambda)))

(22)

W2 := subs(case1, W1)

V(xi) = a[-1]/(2*n+1/(exp(-4*mu*n*xi)*c__1-(1/4)/n))

(23)

W3 := rhs(V(xi) = a[-1]/(2*n+1/(exp(-4*mu*n*xi)*c__1-(1/4)/n)))

a[-1]/(2*n+1/(exp(-4*mu*n*xi)*c__1-(1/4)/n))

(24)

W4 := convert(W3, trig)

a[-1]/(2*n+1/((cosh(4*mu*n*xi)-sinh(4*mu*n*xi))*c__1-(1/4)/n))

(25)

W5 := W4

a[-1]/(2*n+1/((cosh(4*mu*n*xi)-sinh(4*mu*n*xi))*c__1-(1/4)/n))

(26)

odetest(W2, F2)

0

(27)
 

``

Download problem99.mw

In this activity, we are trying to simulate an outbreak of a new infectious disease that our population of 10^6people has not been exposed to before. This means that we are starting with a single case, everyone else is susceptible to the disease, and no one is yet immune or recovered. This can for example reflect a situation where an infected person introduces a new disease into a geographically isolated population, like on an island, or even when an infections "spill over" from other animals into a human population. In terms of the initial conditions for our model, we can define: "S=10^(6) -1=999999," I = 0and R = 0. NULL

Remember, the differential equations for the simple SIR model look like this:

dS/dt = `λS`*dI/dt and `λS`*dI/dt = `λS`-I*gamma, dR/dt = I*gamma

Initial number of people in each compartment
S = 10^6-1",I=0  "and R = 0.

NULL

Parameters:

gamma = .1*recovery*rate*beta and .1*recovery*rate*beta = .4*the*daily*infection*rate

restart; with(plots); _local(gamma)

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)

diff(s(t), t) = -lambda*s(t), diff(i(t), t) = lambda*s(t)-gamma*i(t), diff(r(t), t) = gamma*i(t)

(1)

ic := s(0) = s__0, i(0) = i__0, r(0) = r__0

gamma := .1; beta := .4; n := 10^6

.1

 

.4

 

1000000

(2)

lambda := beta*i(t)/n

s__0, i__0, r__0 := 10^6-1, 1, 0

NULL

sols := dsolve({ic, sys}, numeric, output = listprocedure)

display([odeplot(sols, [t, s(t)], 0 .. 100, color = red), odeplot(sols, [t, i(t)], 0 .. 100, color = blue), odeplot(sols, [t, r(t)], 0 .. 100, color = green)], labels = ["Time [day]", "Population"], labeldirections = [horizontal, vertical], legend = ["Susceptible", "Infected", "Recovered"], legendstyle = [location = right])

 

Remember that in a simple homogenous SIR model, `R__eff  `is directly related to the proportion of the population that is susceptible:

R__eff = R__0*S/N

Reff := proc (t) options operator, arrow; beta*s(t)/(gamma*n) end proc

odeplot(sols, [[t, Reff(t)]], t = 0 .. 100, size = [500, 300], labels = ["Time [day]", "Reff"], labeldirections = [horizontal, vertical])

 

The effective reproduction number is highest when everyone is susceptible: at the beginning, `R__eff  ` = R__0. At this point in our example, every infected cases causes an average of 4 secondary infections. Over the course of the epidemic, `R__eff  ` declines in proportion to susceptibility.

The peak of the epidemic happens when `R__eff  ` goes down to 1 (in the example here, after 50 days). As `R__eff  `decreases further below 1, the epidemic prevalence goes into decline. This is exactly what you would expect, given your understanding of the meaning of `R__eff  ` once the epidemic reaches the point where every infected case cannot cause at least one more infected case (that is, when `R__eff  ` < 1), the epidemic cannot sustain itself and comes to an end.

susceptible := eval(s(t), sols); infected := eval(i(t), sols); recovered := eval(r(t), sols)

susceptible(51)

HFloat(219673.04834159758)

(3)

infected(51)

HFloat(401423.4112878752)

(4)

recovered(51)

HFloat(378903.54037052736)

(5)

Reffe := proc (t) options operator, arrow; beta*susceptible(t)/(gamma*n) end proc

proc (t) options operator, arrow; beta*susceptible(t)/(gamma*n) end proc

(6)

Reffe(51)

HFloat(0.8786921933663903)

(7)

Prevalence is simply the value of Iat a given point in time. Now we can see that the incidence is the number of new cases arriving in the I compartment in a given interval of time. The way we represent this mathematically is by taking the integral of new cases over a given duration.

For example, if we wanted to calculate the incidence from day 7 to 14,

int(`&lambda;S`(t), t = 7 .. 14)

lamda := proc (t) options operator, arrow; beta*infected(t)/n end proc

proc (t) options operator, arrow; beta*infected(t)/n end proc

(8)

inflow := proc (t) options operator, arrow; lamda(t)*susceptible(t) end proc

proc (t) options operator, arrow; lamda(t)*susceptible(t) end proc

(9)

int(inflow(t), t = 7 .. 14)

HFloat(78.01804723222038)

(10)

incidence_plot := plot(inflow(t), t = 0 .. 14, color = orange, labels = ["Time (days)", "Incidence Rate"], labeldirections = [horizontal, vertical], title = "Incidence Rate between t=7 and t=14")

 

s, i, r := eval(s(t), sols), eval(i(t), sols), eval(r(t), sols); T := 100; dataArr := Array(-1 .. T, 1 .. 4); dataArr[-1, () .. ()] := `<,>`("Day", "Susceptible", "Infected", "Recovered")


Assign all the subsequent rows

for t from 0 to T do dataArr[t, () .. ()] := `~`[round](`<,>`(t, s(t), i(t), r(t))) end do

 

Tabulate through the DocumentTools

DocumentTools:-Tabulate(dataArr, alignment = left, width = 50, fillcolor = (proc (A, n, m) options operator, arrow; ifelse(n = 1, "DeepSkyBlue", "LightBlue") end proc))

Download dynamics_of_novel_disease_outbreak.mw

This is probaby more of a software request and I think it would be useful. 

You can obviously open two worksheets of maple and tile them vertically to give the effect of a split screen but then all the icons of each worksheet reduce the visible on screen real estate in which you can work.

It should work similar to how Excel does it when you split cells.  It would work nicely in situations where you have a diagram or picture you are referring to during the creation of your worksheet. 

Anyways just a request, I'm sure some people would find that functionality welcome. 

I have a global matrix with a default value set in a module. I also need the inverse of the matrix. Can the module do this?  I don't really want to have to get routines to calculate the inverse every time they are called.

restart

``

TM := module () local invMetric; export foo, bar; global Metric;  Metric := Matrix(3, shape = symmetric, [[1, 0, 0], [0, 1, 0], [0, 0, 1]]); invMetric := LinearAlgebra:-MatrixInverse(rtable_eval(Metric, 'inplace')); foo := proc () print('Metric' = Metric) end proc; bar := proc () print('invMetric' = invMetric) end proc end module

_m2278573910560

(1)

TM:-foo()

Metric = Matrix(%id = 36893490426002737860)

(2)

TM:-bar()

invMetric = Matrix(%id = 36893490426002738460)

(3)

Metric := Matrix(3, 3, {(1, 1) = 1, (1, 2) = 0, (1, 3) = 0, (2, 1) = 0, (2, 2) = 1, (2, 3) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = -2})

Matrix(%id = 36893490426002715820)

(4)

TM:-foo()

Metric = Matrix(%id = 36893490426002715820)

(5)

TM:-bar()

invMetric = Matrix(%id = 36893490426002738460)

(6)

NULL

Download 2024-12-30_Q_Module_Global_and_Local.mw

Hello 

I have a 3D vector plot with 3 vectors. It would be nice to have a legend for this, but so far, I have struggled to find a solution.

At the moment, I use a caption for this, but I am not fully happy with this.legend_question.mw 

Is there a simple solution?

Thanks in advance 

This time domain diagram has been drawn, but if you want to draw its outer outline, how should you command it?
saopinjifen1230.mw

 

Is there an easy way to convert a maple worksheet to a command line .mpl file to be executed from command line?

Basically strips all the comments and just keep the commands.in the .mpl file.

The exports in the Maple interface do not produce command line executable code.

It is ok if there is a third party script also to do this.

When I attempt to solve for a specific parameter in Maple, it results in an error stating that the parameter does not exist. However, if I solve for all parameters, it successfully finds them, as shown in the figure. How can I resolve this issue?

parameter.mw

Hi

Following on from this question, https://www.mapleprimes.com/questions/200909-Roster-Choose-Teams
I wanted to create the sequence for n>3 teams, where n:: even and two byes.
Currently, my AI-modified code produces the wrong output, can someone modify it?

# Example usage with 8 teams and 2 byes
PrintPairings(8); 

Round 1:
  1 vs 2
  3 vs 4
  5 sits out
  8 sits out
....
:Round_Robin.mw
It should be
Round 1:
  1 vs 2
  3 vs 4
  5 vs 6
  7 sits out
  8 sits out
......
etc

I use this type ckect elsewhere inside a package and it works. I can't get it to work in a stand alone procedure.

This was originally provided by @acer (best answer) in this question Experimental format for projective vectors - MaplePrimes

restart

 

 

test:=proc(V::{And('Vector(1)',satisfies( v->type(v[1],'Vector[:-column](3)') ) ),
               And('Vector(1)',satisfies( v->type(v[1],'Vector[:-row](3)') ) )})
print("works",V);
end proc

proc (V::{And('Vector(1)', satisfies(proc (v) options operator, arrow; type(v[1], 'Vector[:-column](3)') end proc)), And('Vector(1)', satisfies(proc (v) options operator, arrow; type(v[1], 'Vector[:-row](3)') end proc))}) print("works", V) end proc

(1)

v1:=<[<1,3,2>]>;
v2:=<[<a|b|c>]>

Vector(1, {(1) = Vector(3, {(1) = 1, (2) = 3, (3) = 2})})

 

Vector[column](%id = 36893490573309309044)

(2)

test(v1)

Error, invalid input: test expects its 1st argument, V, to be of type {And('Vector[1]',satisfies(v -> type(v[1],'Vector[:-column](3)'))), And('Vector[1]',satisfies(v -> type(v[1],'Vector[:-row](3)')))}, but received Vector(1, [Vector(3, [1,3,2])])

 

test(v2)

Error, invalid input: test expects its 1st argument, V, to be of type {And('Vector[1]',satisfies(v -> type(v[1],'Vector[:-column](3)'))), And('Vector[1]',satisfies(v -> type(v[1],'Vector[:-row](3)')))}, but received Vector(1, [Vector[row](3, [a,b,c])])

 

whattype(v1)

Vector[column]

(3)

whattype(v1[1])

Vector[column]

(4)

whattype(v2)

Vector[column]

(5)

whattype(v2[1])

Vector[row]

(6)
 

 

Download 2024-12-29_Q_Type_checking_not_working.mw

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