3 Badges

1 years, 259 days

How to return y=2+0*I as y = 2...

Maple

I want to  return {x = 0., y = 1.158748796 + 0. I}  as  {x = 0., y = 1.158748796 }.  The solution is coming from:

soln3:= fsolve({b1, b2}, {x = 0 .. infinity, y = 0 .. infinity});

and the second solution is coming from:
soln4:= fsolve({b1, b2}, {x = -infinity ..0, y = -infinity .. 0});

See my code below

restart:

Procedure

doCalc:= proc( xi )

# Import Packages
uses ArrayTools, Student:-Calculus1, LinearAlgebra,
ListTools, RootFinding, plots, ListTools:
local gamma__1:= .1093,
alpha__3:= -0.1104e-2,
k__1:= 6*10^(-12),
d:= 0.2e-3,
theta0:= 0.0001,
eta__1:= 0.240e-1,
alpha:= 1-alpha__3^2/(gamma__1*eta__1),
c:= alpha__3*xi*alpha/(eta__1*(4*k__1*q^2/d^2-alpha__3*xi/eta__1)),
theta_init:= theta0*sin(Pi*z/d),
n:= 30,
g, f, b1, b2, qstar, OddAsymptotes, ModifiedOddAsym,
qstarTemporary, indexOfqstar2, qstar2, AreThereComplexRoots,
soln1, soln2, qcomplex1, qcomplex2, gg, qq, m, pp, j, i,
AllAsymptotes, p, Efun, b, aa, F, A, B, Ainv, r, theta_sol, v, Vfun, v_sol,minp,nstar,
soln3, soln4, Imagroot1, Imagroot2;

# Assign g for q and plot g, Set q as a complex and Compute the Special Asymptotes

g:= q-(1-alpha)*tan(q)+ c*tan(q):
f:= subs(q = x+I*y, g):
b1:= evalc(Re(f)) = 0:
b2:= y-(1-alpha)*tanh(y) -(alpha__3*xi*alpha/(eta__1*(4*k__1*y^2/d^2+alpha__3*xi/eta__1)))*tanh(y) = 0:
qstar:= (fsolve(1/c = 0, q = 0 .. infinity)):
OddAsymptotes:= Vector[row]([seq(evalf(1/2*(2*j + 1)*Pi), j = 0 .. n)]);

# Compute Odd asymptote

ModifiedOddAsym:= abs(`-`~(OddAsymptotes, qstar));
qstarTemporary:= min(ModifiedOddAsym);
indexOfqstar2:= SearchAll(qstarTemporary, ModifiedOddAsym);
qstar2:= OddAsymptotes(indexOfqstar2);

# Compute complex roots

AreThereComplexRoots:= type(true, 'truefalse');
try
soln1:= fsolve({b1, b2}, {x = min(qstar2, qstar) .. max(qstar2, qstar), y = 0 .. infinity});
soln2:= fsolve({b1, b2}, {x = min(qstar2, qstar) .. max(qstar2, qstar), y = -infinity .. 0});
qcomplex1:= subs(soln1, x+I*y);
qcomplex2:= subs(soln2, x+I*y);
catch:
AreThereComplexRoots:= type(FAIL, 'truefalse');
end try;

# Compute the rest of the Roots
soln3:= fsolve({b1, b2}, {x = 0 .. infinity, y = 0 .. 10});
soln4:= fsolve({b1, b2}, {x = -infinity ..0, y = -infinity .. 0});
Imagroot1:=subs(soln3, I*y);
Imagroot2:= subs(soln4, I*y);
OddAsymptotes:= Vector[row]([seq(evalf((1/2)*(2*j+1)*Pi), j = 0 .. n)]);
AllAsymptotes:= sort(Vector[row]([OddAsymptotes, qstar]));

if AreThereComplexRoots
then gg:= [qcomplex1, qcomplex2,op(Roots(g, q = 0.1e-3 .. AllAsymptotes[1])),
seq(op(Roots(g, q = AllAsymptotes[i] .. AllAsymptotes[i+1])), i = 1 .. n)];
elif not AreThereComplexRoots
then gg:= [op(Roots(g, q = 0.1e-3 .. AllAsymptotes[1])), seq(op(Roots(g, q = AllAsymptotes[i] .. AllAsymptotes[i+1])), i = 1 .. n)];
end if:

# Remove the repeated roots if any & Redefine n

qq:= MakeUnique(gg):
m:= numelems(qq):

## Return all the plots
return qq, Imagroot1,Imagroot2, p, soln3, soln4;
end proc:

ans:=[doCalc(0.06)]:
ans[5];
{x = 0., y = 1.158748796 + 0. I}
ans[6];
{x = 0., y = -1.158748796}

Outout not return when using proc...

Maple

I'm using a procedure but the out is not returned. Please why?

restart:

Procedure

doCalc:= proc( xi )

# Import Packages
uses ArrayTools, Student:-Calculus1, LinearAlgebra,
ListTools, RootFinding, plots, ListTools:
local gamma__1:= .1093,
alpha__3:= -0.1104e-2,
k__1:= 6*10^(-12),
d:= 0.2e-3,
theta0:= 0.0001,
eta__1:= 0.240e-1,
alpha:= 1-alpha__3^2/(gamma__1*eta__1),
c:= alpha__3*xi*alpha/(eta__1*(4*k__1*q^2/d^2-alpha__3*xi/eta__1)),
theta_init:= theta0*sin(Pi*z/d),
n:= 30,
g, f, b1, b2, qstar, OddAsymptotes, ModifiedOddAsym,
qstarTemporary, indexOfqstar2, qstar2, AreThereComplexRoots,
soln1, soln2, qcomplex1, qcomplex2, gg, qq, m, pp, j, i,
AllAsymptotes, w, Efun, b, aa, F, A, B, Ainv, r, theta_sol, v, Vfun, v_sol,minp,nstar,
soln3, soln4, Imagroot1, Imagroot2;

# Assign g for q and plot g, Set q as a complex and Compute the Special Asymptotes

qq := [2.106333379+.6286420119*I, 2.106333379-.6286420119*I, 4.654463885, 7.843624703, 10.99193295,14.13546782, 17.27782732, 20.41978346, 23.56157073, 26.70327712, 29.84494078, 32.98658013,         36.12820481, 39.26982019, 42.41142944, 45.55303453, 48.69463669, 51.83623675, 54.97783528,                     58.11943264, 61.26102914, 64.40262495, 67.54422024, 70.68581510, 73.82740963,                                 76.96900389, 80.11059792, 83.25219177, 86.39378546, 89.53537903, 92.67697249];
m:= numelems(qq):

for i from 1 to m do
w[i] := gamma__1*alpha/(4*k__1*qq[i]^2/d^2-alpha__3*xi/eta__1);
end do;

## Return all the plots
return w;
end proc:

ans:=[doCalc(0.06)]:
ans[1];

Roots of a function complex...

Maple

Hi, please how do I return the roots of a function in the form of I*y. The roots are [-.2381948477, -0.1434221912e-3, 0., 0.1434221912e-3, .2381948477] and I want to return them as [-.2381948477*I, -0.1434221912e-3*I, 0., 0.1434221912e-3*I, .2381948477*I]. I tried to use subs () function but couldn't work.

with(Student[Calculus1]):

soln := Roots(y-0.4646295e-3*tanh(y)+0.1839145082e-2*tanh(y)/(0.6000000000e-3*y^2-0.1840000000e-2), y);

subs(soln, I*y);

Numerical schemes for second order mixed...

Maple

Is it possible to solve the mixed PDEs below using the method of lines or any other numerical scheme?

B.C:

theta(0,t) = theta(d,t) = 0

v(0,t) = v(d,t) = 0

I.C: theta(z,0) = \thetab*sin(pi/2)*z,  v(z,0) =0 at t =0  for both the initial conditions, where thetab = 0.0001

% parameters.

K3 = 7.5*10^(-12);

eta2 = 0.1361;

alpha2 = -0.1104;

gamma1 = 0.1093;

d = 0.0002;

xi = 0.1;

Note: xi is the controlling parameter. For instance, we can plot theta and v for different values of xi.

I tried matlab but no standard scheme to solve the problem because of the partial^2 theta/partial d partial t term. It would have been possible to use pdepe in Matlab if not for the mixed derivative. Please any help.

Thank you

Bifurcation of SEIR...

Maple 18

Hi,

Please can someone help me with a sample code for bifurcation? You can use parameter values for the parameters. I'm using maple 18. Below is my model:

 > restart:
 > f__1 := Delta -(psi + mu)*S(t);
 (1)
 > f__2 := psi*S(t) -(delta + mu)*E(t);
 (2)
 > f__3 := Delta*E(t) -(gamma+gamma__1 + mu)*X(t);
 (3)
 > f__4 := gamma__1*X(t)-(eta + xi + mu)*H(t);
 (4)
 > f__5 := xi*H(t) - mu*R(t);
 (5)
 > f__6 := gamma*X(t)-eta*H(t) - d*D(t);
 (6)
 > f__7 := b*D(t) - b*B(t);
 (7)
 > f__8 := phi__p + sigma*X(t)+eta__1*H(t) +d__1*D(t)+ b__1*B(t) - alpha*P(t);
 (8)

Download Bifurcation.mw

 1 2 3 4 5 6 Page 4 of 6
﻿