Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Under piecewise in ?updates,Maple2024,AdvancedMath I find

{simplify,combine}(piecewise(x <= 0, 2*ln(1 - x), 0 < x, ln((x - 1)^2))) assuming (x, real);
                         /  /       2\\ 
                        { ln\(x - 1) / }
                         \            / 

Same result without simplify

{combine}(piecewise(x <= 0, 2*ln(1 - x), 0 < x, ln((x - 1)^2))) assuming (x, real);
                         /  /       2\\ 
                        { ln\(x - 1) / }
                         \            / 

What I do not understand is the grouping of simplify and combine in a set. This looks like a function composition which is normally done with the composition operator

(simplify@combine)(expr)

Asking differently: What is

{simplify,combine}(expr)

supposed to do in the examples?


Why sorting these 4 vectors wrt L(+oo) norm returns a correct result bur sorting them wrt L2 norm doesn't (unless if I evaluate the norms as floats)?
 

restart:

kernelopts(version)

`Maple 2015.2, APPLE UNIVERSAL OSX, Dec 20 2015, Build ID 1097895`

(1)

V := [seq(LinearAlgebra:-RandomVector(2, generator=1..10), k=1..4)];

N2   := evalf(norm~(V, 2));
Ninf := norm~(V, +infinity);

V := [Vector(2, {(1) = 3, (2) = 5}), Vector(2, {(1) = 8, (2) = 7}), Vector(2, {(1) = 4, (2) = 5}), Vector(2, {(1) = 6, (2) = 2})]

 

[5.830951895, 10.63014581, 6.403124237, 6.324555320]

 

[5, 8, 5, 6]

(2)

Sorting wrt L(+oo) norm

sort(V, key=(t -> norm(t, +infinity)));  # correct

[Vector(2, {(1) = 3, (2) = 5}), Vector(2, {(1) = 4, (2) = 5}), Vector(2, {(1) = 6, (2) = 2}), Vector(2, {(1) = 8, (2) = 7})]

(3)

Sorting wrt L(2) norm

sort(V, key=(t -> norm(t, 2))); # not correct
is(norm(V[4], 2) < norm(V[3], 2));

[Vector(2, {(1) = 3, (2) = 5}), Vector(2, {(1) = 4, (2) = 5}), Vector(2, {(1) = 8, (2) = 7}), Vector(2, {(1) = 6, (2) = 2})]

 

true

(4)

sort(V, key=(t -> evalf(norm(t, 2)))); # correct

[Vector(2, {(1) = 3, (2) = 5}), Vector(2, {(1) = 6, (2) = 2}), Vector(2, {(1) = 4, (2) = 5}), Vector(2, {(1) = 8, (2) = 7})]

(5)

 


 

Download SortingVectors.mw


TIA

trouverTripletsDecroissants := proc(tripletInitial) local m, n, a, b, c, triplets, dernierTriplet; triplets := []; dernierTriplet := tripletInitial; m := dernierTriplet[3]; do m := m - 1; for n to m - 1 do if igcd(m, n) = 1 and (m - n) mod 2 = 1 then a := m^2 - n^2; b := 2*m*n; c := m^2 + n^2; if a^2 + b^2 = c^2 and a < dernierTriplet[1] and b < dernierTriplet[2] and c < dernierTriplet[3] then dernierTriplet := [a, b, c]; triplets := [op(triplets), dernierTriplet]; break; end if; end if; end do; break; if 0 < nops(triplets); end do; return triplets; end proc;
tripletInitial := [275, 252, 373];
tripletsDecroissants := trouverTripletsDecroissants(tripletInitial);
print(tripletsDecroissants);
               tripletInitial := [275, 252, 373]

           tripletsDecroissants := [[273, 136, 305]]

                       [[273, 136, 305]]

;
trouverTripletsDecroissants(275, 252, 373);
Error, (in trouverTripletsDecroissants) final value in for loop must be numeric or character
How to correct this error. Thank you.

I want to rescale a projective vector. Have been using gcd on the numerators and denominators. This works in simple situations. It doesn;t work well here, admitadely the points have been just made up for the question.  Square roots seem to make it mal-preform. I run into a lot of squate roots in symbolic situations. What would be a better way? I have been wondering if frontend would help?

restart

Prntmsg::boolean:=true;
Normalise_Projective_Point:=1;
ReScl::boolean:=true;

true

 

1

 

true

(1)

 

ProjLP:=overload([

      proc(A::Vector[row],B::Vector[row],prnt::boolean:=Prntmsg)
      description "2 projective points to create a projective line vector";
      option overload;
      local Vp ,gcdn,gcdd,vp ;
      uses LinearAlgebra;
       
      Vp:=CrossProduct(A,B)^%T;#print("2nd ",Vp);
      if ReScl then
         gcdn := gcd(gcd(numer(Vp[1]),numer(Vp[2])), numer(Vp[3]));
         gcdd := gcd(gcd(denom(Vp[1]),denom(Vp[2])), denom(Vp[3]));
         Vp:=simplify(Vp*gcdd/gcdn);
      end if;
      if Prntmsg then
         print("Line vector from two projective points. " );
      end if;
      return Vp
      end proc,



      proc(A::Vector[column],B::Vector[column],prnt::boolean:=Prntmsg)
      description "2 lines to get intersection projective point";
      option overload;
      uses LinearAlgebra;
      local  Vp;
    
      Vp:=CrossProduct(A,B)^%T;
     
     
      if Vp[3]<>0 and Normalise_Projective_Point<>0 then
           Vp:=Vp/Vp[3];
      end if;
      if Prntmsg then
           print("Meet of two Lines ");
      end if;
      return Vp
   end proc
     
]);

 

proc () option overload; [proc (A::(Vector[row]), B::(Vector[row]), prnt::boolean := Prntmsg) local Vp, gcdn, gcdd, vp; option overload; description "2 projective points to create a projective line vector"; Vp := LinearAlgebra:-CrossProduct(A, B)^%T; if ReScl then gcdn := gcd(gcd(numer(Vp[1]), numer(Vp[2])), numer(Vp[3])); gcdd := gcd(gcd(denom(Vp[1]), denom(Vp[2])), denom(Vp[3])); Vp := simplify(Vp*gcdd/gcdn) end if; if Prntmsg then print("Line vector from two projective points. ") end if; return Vp end proc, proc (A::(Vector[column]), B::(Vector[column]), prnt::boolean := Prntmsg) local Vp; option overload; description "2 lines to get intersection projective point"; Vp := LinearAlgebra:-CrossProduct(A, B)^%T; if Vp[3] <> 0 and Normalise_Projective_Point <> 0 then Vp := Vp/Vp[3] end if; if Prntmsg then print("Meet of two Lines ") end if; return Vp end proc] end proc

(2)

#maplemint(ProjLP)

pt1:=<a|sqrt(b^2+c^2)|1>:
pt2:=<c|sqrt(b^2+a^2)|1>:
pt3:=<f^2/sqrt(a^2+b^2)|f^2/sqrt(c^2+b^2)+sqrt(a^2+b^2)|1>:
pt4:=<b^2/sqrt(a^2+b^2)|f^2/sqrt(c^2+b^2)-sqrt(a^2+b^2)|1>:

 

l1:=ProjLP(pt1,pt2)

"Line vector from two projective points. "

 

Vector[column](%id = 36893490491002736020)

(3)

l2:=ProjLP(pt3,pt4)

"Line vector from two projective points. "

 

Vector[column](%id = 36893490491002712420)

(4)

l3:=ProjLP(pt1,pt4)

"Line vector from two projective points. "

 

Vector[column](%id = 36893490491064062908)

(5)

l4:=ProjLP(pt2,pt4)

"Line vector from two projective points. "

 

Vector[column](%id = 36893490491064037372)

(6)

pl1l2:=simplify(ProjLP(l1,l2))

"Meet of two Lines "

 

Vector[row](%id = 36893490491002741932)

(7)

pl2l3:=simplify(ProjLP(l2,l3))

"Meet of two Lines "

 

Vector[row](%id = 36893490491113907252)

(8)

(ProjLP(pl1l2,pl2l3));
length(%)

"Line vector from two projective points. "

 

Vector[column](%id = 36893490491113907972)

 

6223

(9)

ReScl:=false

false

(10)

# doing nothing seems to work better here than rescaling

(ProjLP(pl1l2,pl2l3));
length(%)

"Line vector from two projective points. "

 

Vector[column](%id = 36893490491125667468)

 

2796

(11)

 


 

Download 2024-05-09_Q_Rescale_projective_vector.mw

Hi everyone,

I'm having trouble in maple to do the following:
Plot the curve x^3-4xy+2y^3=0 , as x variesbetween -3 and 3 with the aid of the implicitplot command

find dy/dx at all points (x,y) on the curve for which x=1. and find the equations of the lines tangent to the curve at the points

plot the curve and tangent lines on the same set of axes

Any help would be appreciated , thank you.

I'm new to Mapple 2024, and probably miss something.
lie, e[i] i=1..4, and G are previously defined objects. Then whe I define:

cf:=(k,l,m,t,x,y,z)->seq(lie(p,e[k](t,x,y,z),e[l](t,x,y,z))*G(t,x,y,z)[p,m],p=1..4);
cf(2,4,2,t,x,y,z);

I get:

0, 0, 0, -6*(-6*z^3*(7*z - 4)*(z - 1)^2*(y^2 - 1)^3*(x^2 - 1)^2*x - 6*z^4*(1 - z)^3*(-x^2 + 1)^2*(-y^2 + 1)^3*x*(-3*z^2*(7*z - 4)*(z - 1)^2*(y^2 - 1)^3*(x^2 - 1)^3 - 7*z^3*(z - 1)^2*(y^2 - 1)^3*(x^2 - 1)^3 - 2*z^3*(7*z - 4)*(z - 1)*(y^2 - 1)^3*(x^2 - 1)^3) - (1 - z^3*(7*z - 4)*(z - 1)^2*(y^2 - 1)^3*(x^2 - 1)^3)*(-24*z^3*(1 - z)^3*(-x^2 + 1)^2*(-y^2 + 1)^3*x + 18*z^4*(1 - z)^2*(-x^2 + 1)^2*(-y^2 + 1)^3*x))*z^4*(1 - z)^3*(-x^2 + 1)^2*(-y^2 + 1)^3*x*(1 - z^3*(7*z - 4)*(z - 1)^2*(y^2 - 1)^3*(x^2 - 1)^3)

The 4th item eval as:
cf(2, 4, 2, t, x, y, z)[4] = -36*z^10*x^2*(x^2 - 1)^7*(7*z^2 - 8*z + 4)*(z - 1)^7*(y^2 - 1)^9*(-1 + z^3*(7*z - 4)*(z - 1)^2*(y^2 - 1)^3*(x^2 - 1)^3)

But when I define another function by just changing the seq operator with a sum operator:

cf2:=(k,l,m,t,x,y,z)->sum(lie(p,e[k](t,x,y,z),e[l](t,x,y,z))*G(t,x,y,z)[p,m],p=1..4);
cf2(2,4,2,t,x,y,z);

I get 0.

What do I miss ?

I want to define an alias L_2 in terms of another alias L_1, the latter being a RootOf(). I noticed that doing the following does not work: alias_in_alias.mw. How to fix it? Should I define the two alias sequantially? That is, L_1 first and then (in a follow up alias()) L_2?

Sorry for the super complicated expressions. You could perhaps show me with a simpler example. Thanks!

This is my code
 

restart;
with(Student:-MultivariateCalculus);
A := [0, 0, 0];
B := [a, 0, 0];
C := [a, a, 0];
DD := [0, a, 0];
S := [0, 0, h];
d1 := Line(A, C);
d2 := Line(S, DD);
(Distance(d1, d2) assuming (a::positive and h::positive));

I got 

abs(a)^2*abs(h)/sqrt(2*abs(a*h)^2 + abs(a)^4)

How can I remove abs?

Using with(plots) and with(plottools), how do you change the color of the line enclosing a disk? I can change the line style of the line, but I can't figure out how to change the color of the line. I didn't find anything in plot options that would fit my purpose.

how_do_i_change_the_color_of_the_line_around_a_disk_while_using_plottools.mw

I am trying to verify a solution by checking whether eval() returns 0 but it's taking me forever. If I recall correctly it once returned [0,0] so I am quite confident that the first and only positive root of that polynomial solves my system. I am now running again the same calculation but somehow eval() is stuck in "Evaluating...". I am not sure if it matters here, but parameters gamma, sigma_v, and sigma_d are strictly positive while -1<rho<+1 (rho is a correlation coefficient). 

How else can I verify such solution?

EDIT: THIS IS NOT A DUPLICATE QUESTION AND SHOULDN'T BE TAGGED AS SUCH

restart;

local gamma:

Equations:

eq1 := (gamma*sigma__v^2*(-1 + rho__v) - 2*lambda__2)*(rho__v*sigma__v^2 + sigma__v^2)/((2*gamma*(lambda__1 + lambda__2)*(-1 + rho__v)*sigma__v^2 - 8*lambda__1*lambda__2)*((gamma*sigma__v^2*(-1 + rho__v) - 2*lambda__2)^2*(2*rho__v*sigma__v^2 + 2*sigma__v^2)/(2*gamma*(lambda__1 + lambda__2)*(-1 + rho__v)*sigma__v^2 - 8*lambda__1*lambda__2)^2 + (-lambda__1*(gamma*sigma__v^2*(-1 + rho__v) - 4*lambda__2)/(2*gamma*(lambda__1 + lambda__2)*(-1 + rho__v)*sigma__v^2 - 8*lambda__1*lambda__2) + 1)^2*sigma__d^2 + gamma^2*lambda__2^2*sigma__v^4*(-1 + rho__v)^2*sigma__d^2/(2*gamma*(lambda__1 + lambda__2)*(-1 + rho__v)*sigma__v^2 - 8*lambda__1*lambda__2)^2)):

eq2 := (gamma*sigma__v^2*(-1 + rho__v) - 2*lambda__1)*(rho__v*sigma__v^2 + sigma__v^2)/((2*gamma*(lambda__1 + lambda__2)*(-1 + rho__v)*sigma__v^2 - 8*lambda__1*lambda__2)*((gamma*sigma__v^2*(-1 + rho__v) - 2*lambda__1)^2*(2*rho__v*sigma__v^2 + 2*sigma__v^2)/(2*gamma*(lambda__1 + lambda__2)*(-1 + rho__v)*sigma__v^2 - 8*lambda__1*lambda__2)^2 + (-(gamma*sigma__v^2*(-1 + rho__v) - 4*lambda__1)*lambda__2/(2*gamma*(lambda__1 + lambda__2)*(-1 + rho__v)*sigma__v^2 - 8*lambda__1*lambda__2) + 1)^2*sigma__d^2 + gamma^2*lambda__1^2*sigma__v^4*(-1 + rho__v)^2*sigma__d^2/(2*gamma*(lambda__1 + lambda__2)*(-1 + rho__v)*sigma__v^2 - 8*lambda__1*lambda__2)^2)):

Eq1, Eq2 := eq1 - lambda__1, eq2 - lambda__2:

Solution:

Gamma := gamma*sigma__v*sigma__d:
L__2 := RootOf(-8*(rho + 1)^4*_Z^4 + 12*(rho + 1)^3*Gamma*(rho - 1)*_Z^3 - 5*(rho + 1)^2*(-4/5 + Gamma^2*rho^2 + 2*(-2/5 - Gamma^2)*rho + Gamma^2)*_Z^2 - 4*(rho + 1)*Gamma*(rho^2 - 1)*_Z + Gamma^2*(rho + 1)*(rho - 1)^2);
l__2 := L__2*sigma__v*(rho__v + 1)/sigma__d:
quartic_solution := lambda__2 = simplify(allvalues~([l__2]))[1]:

RootOf((8*rho^3+24*rho^2+24*rho+8)*_Z^4+(-12*gamma*rho^3*sigma__d*sigma__v-12*gamma*rho^2*sigma__d*sigma__v+12*gamma*rho*sigma__d*sigma__v+12*gamma*sigma__d*sigma__v)*_Z^3+(5*gamma^2*rho^3*sigma__d^2*sigma__v^2-5*gamma^2*rho^2*sigma__d^2*sigma__v^2-5*gamma^2*rho*sigma__d^2*sigma__v^2+5*gamma^2*sigma__d^2*sigma__v^2-4*rho^2-8*rho-4)*_Z^2+(4*gamma*rho^2*sigma__d*sigma__v-4*gamma*sigma__d*sigma__v)*_Z-gamma^2*sigma__v^2*sigma__d^2*rho^2+2*rho*gamma^2*sigma__v^2*sigma__d^2-gamma^2*sigma__v^2*sigma__d^2)

(1)

Check: TOO SLOW

simplify(eval([eval(Eq1, lambda__1 = lambda__2), eval(Eq2, lambda__1 = lambda__2)], quartic_solution));


 

Download solution_check.mw

Hi,

I was just wondering if there is a init file for the Windows version of Maple, like there is one for the LInux version.

I'm not talking about the Maple.ini file located in the user's Application Data folder. In the Linux version, there is a file, .mapleinit, where you can place all of your initialization setups, like the packages you want to automatically load with the worksheet, defining constants, etc.

If someone has any ideas, I really appreciate it. Thanks very much in advance.

Hi,

is there any package out there to calculate Wigner J symbols and Clebsch-Gordon coefficients in Maple

Good day to all of you nice people.
I'm currently attempting to plot a vector field where each component of the vector is defined by the equations S_x, S_y, and S_z, which are functions of the radial coordinate. Here is a depiction of how the vectors change with respect to r:

The next step, which I'm unsure how to do, is to plot the vectors around the z-direction, or I should say, in phi direction, to achieve something similar to this example:

Thank you a lot for your kind help. 

Here is my code:
Maple_Question.mw

I am running Maple 2023 - yes I should update - and I found a weird "bug" if you could call it that. For different versions of the Physics package I am getting different answers on the same problem. 
 

This is what I was getting when I run Version 1410:

restart;

with(Physics):

 

Physics:-Version()

`The "Physics Updates" version in the MapleCloud is 1744. The version installed in this computer is 1410 created 2023, March 11, 12:59 hours Pacific Time, found in the directory /Users/b2hull/maple/toolbox/2023/Physics Updates/lib/`

(1)

Setup(mathematicalnotation=true):

g_[arbitrary]:

_______________________________________________________

 

`Systems of spacetime coordinates are:`*{X = (x1, x2, x3, x4)}

 

`Default differentiation variables for d_, D_ and dAlembertian are:`*{X = (x1, x2, x3, x4)}

 

`Setting `*lowercaselatin_is*` letters to represent `*space*` indices`

 

`The arbitrary metric in coordinates `*[x1, x2, x3, x4]

 

`Signature: `(`- - - +`)

 

_______________________________________________________

(2)

LG :=(g_[~mu,~nu]*Ricci[mu,nu])*sqrt(-%g_[determinant]);

Physics:-g_[`~mu`, `~nu`]*Physics:-Ricci[mu, nu]*(-%g_[determinant])^(1/2)

(3)

SG:=Intc(LG,X)

Int(Int(Int(Int(Physics:-g_[`~mu`, `~nu`]*Physics:-Ricci[mu, nu]*(-%g_[determinant])^(1/2), x1 = -infinity .. infinity), x2 = -infinity .. infinity), x3 = -infinity .. infinity), x4 = -infinity .. infinity)

(4)

EQ:=Fundiff(SG,%g_[~delta,~gamma])/sqrt(-%g_[determinant])

((1/2)*%g_[`~mu`, `~nu`]*Physics:-Ricci[mu, nu]*%g_[delta, gamma]*%g_[determinant]/(-%g_[determinant])^(1/2)+Physics:-Ricci[mu, nu]*(-%g_[determinant])^(1/2)*%g_[delta, `~mu`]*%g_[gamma, `~nu`])/(-%g_[determinant])^(1/2)

(5)

Simplify(subs(%g_=g_,EQ))

-(1/2)*Physics:-g_[delta, gamma]*Physics:-Ricci[nu, `~nu`]+Physics:-Ricci[delta, gamma]

(6)

 

 

 

And this is what I get if I used the latet update for 2023, Version 1683:

restart;

with(Physics):

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1744. The version installed in this computer is 1683 created 2024, March 6, 17:43 hours Pacific Time, found in the directory /Users/b2hull/maple/toolbox/2023/Physics Updates/lib/`

(1)

Setup(mathematicalnotation=true):

g_[arbitrary]:

_______________________________________________________

 

`Systems of spacetime coordinates are:`*{X = (x1, x2, x3, x4)}

 

`Default differentiation variables for d_, D_ and dAlembertian are:`*{X = (x1, x2, x3, x4)}

 

`Setting `*lowercaselatin_is*` letters to represent `*space*` indices`

 

`The arbitrary metric in coordinates `*[x1, x2, x3, x4]

 

`Signature: `(`- - - +`)

 

_______________________________________________________

(2)

LG :=(g_[~mu,~nu]*Ricci[mu,nu])*sqrt(-%g_[determinant]);

Physics:-g_[`~mu`, `~nu`]*Physics:-Ricci[mu, nu]*(-%g_[determinant])^(1/2)

(3)

SG:=Intc(LG,X)

Int(Int(Int(Int(Physics:-g_[`~mu`, `~nu`]*Physics:-Ricci[mu, nu]*(-%g_[determinant])^(1/2), x1 = -infinity .. infinity), x2 = -infinity .. infinity), x3 = -infinity .. infinity), x4 = -infinity .. infinity)

(4)

EQ:=Fundiff(SG,%g_[~delta,~gamma])/sqrt(-%g_[determinant])

-(1/2)*%g_[delta, gamma]*Physics:-g_[`~mu`, `~nu`]*Physics:-Ricci[mu, nu]

(5)

Simplify(subs(%g_=g_,EQ))

-(1/2)*Physics:-g_[delta, gamma]*Physics:-Ricci[nu, `~nu`]

(6)

 

 

Strange right? I bring this up because it makes me wonder about potential errors in other computations...

The answer - equation 6 - in 1410 is the correct answer. This is simply a derivation of the Einstein Tensor. 

In our recent project, we're diving deep into understanding the SIR model—a fundamental framework in epidemiology that helps us analyze how diseases spread through populations. The SIR model categorizes individuals into three groups: Susceptible (S), Infected (I), and Recovered (R). By tracking how people move through these categories, we can predict disease dynamics and evaluate interventions.

Key Points of the SIR Model:

  • Susceptible (S): Individuals who can catch the disease.
  • Infected (I): Those currently infected and capable of spreading the disease.
  • Recovered (R): Individuals who have recovered and developed immunity.

Vaccination Impact: One of the critical interventions in disease control is vaccination, which moves individuals directly from the susceptible to the recovered group. This simple action reduces the number of people at risk, thereby lowering the overall spread of the disease.

We're experimenting with a simple model to understand how different vaccination rates can significantly alter the dynamics of an outbreak. By simulating scenarios with varying vaccination coverage, students can observe how herd immunity plays a crucial role in controlling diseases. Our goal is to make these abstract concepts clear and relatable through practical modeling exercises.


 

In this exercise, we are going back to the simple SIR model, without births or deaths, to look at the effect of vaccination. The aim of this activity is to represent vaccination in a very simple way - we are assuming it already happened before we run our model! By changing the initial conditions, we can prepare the population so that it has received a certain coverage of vaccination.

We are starting with the transmission and recovery parameters  b = .4/daysand c = .1/days . To incorporate immunity from vaccination in the model, we assume that a proportion p of the total population starts in the recovered compartment, representing the vaccine coverage and assuming the vaccine is perfectly effective. Again, we assume the epidemic starts with a single infected case introduced into the population.​
We are going to model this scenario for a duration of 2 years, assuming that the vaccine coverage is 50%, and plot the prevalence in each compartment over time.

 

restart
with(plots)

b := .4; c := .1; n := 10^6; p := .5

deS := diff(S(t), t) = -b*S(t)*I0(t); deI := diff(I0(t), t) = b*S(t)*I0(t)-c*I0(t); deR := diff(R(t), t) = c*I0(t)

diff(R(t), t) = .1*I0(t)

(1)

F := dsolve([deS, deI, deR, S(0) = 1-p, I0(0) = 1/n, R(0) = p], [S(t), I0(t), R(t)], numeric, method = rkf45, maxfun = 100000)

odeplot(F, [[t, S(t)], [t, I0(t)], [t, R(t)]], t = 0 .. 730, colour = [blue, red, green], legend = ["S(t)", "I0(t)", "R(t)"], labels = ["Time (days)", "  Proportion\nof Population "], title = "SIR Model with vaccine coverage 50 %", size = [500, 300])

 

F(100)

[t = 100., S(t) = HFloat(0.46146837378273076), I0(t) = HFloat(0.018483974421123688), R(t) = HFloat(0.5200486517961457)]

(2)

eval(S(:-t), F(100))

HFloat(0.46146837378273076)

(3)

Reff := proc (s) options operator, arrow; b*(eval(S(:-t), F(s)))/(c*n) end proc; Reff(100)

HFloat(1.845873495130923e-6)

(4)

plot(Reff, 0 .. 730, size = [500, 300])

 

Increasing the vaccine coverage to 75%

NULL

restart
with(plots)

b := .4; c := .1; n := 10^6; p := .75

deS := diff(S(t), t) = -b*S(t)*I0(t); deI := diff(I0(t), t) = b*S(t)*I0(t)-c*I0(t); deR := diff(R(t), t) = c*I0(t)

diff(R(t), t) = .1*I0(t)

(5)

NULL

F1 := dsolve([deS, deI, deR, S(0) = 1-p, I0(0) = 1/n, R(0) = p], [S(t), I0(t), R(t)], numeric, method = rkf45, maxfun = 100000)

odeplot(F1, [[t, S(t)], [t, I0(t)], [t, R(t)]], t = 0 .. 730, colour = [blue, red, green], legend = ["S(t)", "I0(t)", "R(t)"], labels = ["Time (days)", "  Proportion\nof Population "], title = "SIR Model with vaccine coverage 75%", size = [500, 300])

 

F(1100)

eval(S(:-t), F1(100))

HFloat(0.249990000844159)

(6)

Reff := proc (s) options operator, arrow; b*(eval(S(:-t), F1(s)))/(c*n) end proc; Reff(100)

HFloat(9.99960003376636e-7)

(7)

plot(Reff, 0 .. 730, size = [500, 300])

 

Does everyone in the population need to be vaccinated in order to prevent an epidemic?What do you observe if you model the infection dynamics with different values for p?

No, not everyone in the population needs to be vaccinated in order to prevent an epidemic . In this scenario, if p equals 0.75 or higher, no epidemic occurs - 75 % is the critical vaccination/herd immunity threshold . Remember,, herd immunity describes the phenomenon in which there is sufficient immunity in a population to interrupt transmission . Because of this, not everyone needs to be vaccinated to prevent an outbreak .

What proportion of the population needs to be vaccinated in order to prevent an epidemic if b = .4and c = .2/days? What if b = .6 and "c=0.1 days^(-1)?"

In the context of the SIR model, the critical proportion of the population that needs to be vaccinated in order to prevent an epidemic is often referred to as the "herd immunity threshold" or "critical vaccination coverage."

• 

Scenario 1: b = .4and c = .2/days

``

restart
with(plots)

b := .4; c := .2; n := 10^6; p := .5``

deS := diff(S(t), t) = -b*S(t)*I0(t); deI := diff(I0(t), t) = b*S(t)*I0(t)-c*I0(t); deR := diff(R(t), t) = c*I0(t)

diff(R(t), t) = .2*I0(t)

(8)

F1 := dsolve([deS, deI, deR, S(0) = 1-p, I0(0) = 1/n, R(0) = p], [S(t), I0(t), R(t)], numeric, method = rkf45, maxfun = 100000)

odeplot(F1, [[t, S(t)], [t, I0(t)], [t, R(t)]], t = 0 .. 730, colour = [blue, red, green], legend = ["S(t)", "I0(t)", "R(t)"], labels = ["Time (days)", "  Proportion\nof Population "], title = "SIR Model with vaccine coverage 50 %", size = [500, 300])

 


The required vaccination coverage is around 50% .

• 

Scenario 1: b = .6and c = .1/days

restart
with(plots)

b := .6; c := .1; n := 10^6; p := .83NULL

deS := diff(S(t), t) = -b*S(t)*I0(t); deI := diff(I0(t), t) = b*S(t)*I0(t)-c*I0(t); deR := diff(R(t), t) = c*I0(t)

diff(R(t), t) = .1*I0(t)

(9)

NULL

F1 := dsolve([deS, deI, deR, S(0) = 1-p, I0(0) = 1/n, R(0) = p], [S(t), I0(t), R(t)], numeric, method = rkf45, maxfun = 100000)

odeplot(F1, [[t, S(t)], [t, I0(t)], [t, R(t)]], t = 0 .. 730, colour = [blue, red, green], legend = ["S(t)", "I0(t)", "R(t)"], labels = ["Time (days)", "  Proportion\nof Population "], title = "SIR Model with vaccine coverage 83% ", size = [500, 300])

 

"The required vaccination coverage is around 83 `%` ."


Download SIR_simple_vaccination_example.mw

First 107 108 109 110 111 112 113 Last Page 109 of 2216