MaplePrimes Questions

hi im currently doing my thesis and can somebody help me to develope the code? pls im stuck..

restart;
_local(I);
Digits := 15;
de1 := (1 - p)*(diff(S(t), t) + mu*S(t)) + p*(diff(S(t), t) + mu*S(t) + beta*S(t)*I(t) - rho*R(t) - varepsilon);
de2 := (1 - p)*(diff(E(t), t) + (alpha1 + mu)*E(t)) + p*(diff(E(t), t) + (alpha1 + mu)*E(t) - beta*S(t)*I(t));
de3 := (1 - p)*(diff(I(t), t) + (alpha2 + delta + mu)*I(t)) + p*(diff(I(t), t) + (alpha2 + delta + mu)*I(t) - alpha1*E(t));
de4 := (1 - p)*(diff(R(t), t) + (mu + rho)*R(t)) + p*(diff(R(t), t) + (mu + rho)*R(t) - alpha2*I(t));
ibvc := S(0) = 2304219, E(0) = 84929, I(0) = 299, R(0) = 71411;
sys1 := eval([de1, de2, de3, de4], p = 1);
dsolve(sys1);
sys0 := eval~(sys1, [{I = 0, R = 0}, {I = 0, S = 0}, {E = 0}, {I = 0}]);
sys_p := `*`~(1 - p, sys0) +~ `*`~(p, sys1);
ode1, ode2, ode3, ode4 := seq(sys_p[j], j = 1 .. 4);
ode1;
de1;
collect(expand(ode1 - de1), S(t), factor);
ode2 - de2;
ode3 - de3;
ode4 - de4;
mu := 0.133*10^(-5);
varepsilon := 0.99879;
delta := 0.004554;
beta := 0.1009*10^(-6);
alpha1 := 0.0008999;
alpha2 := 0.1997;
rho := 0.00090021;
res := dsolve({ibvc, ode1, ode2, ode3, ode4}, numeric, parameters = [p], abserr = 0.1*10^(-14), relerr = 0.1*10^(-12));
res(parameters = [0.5]);
res(50);
plots:-odeplot(res, [t, S(t)], 0 .. 100);
res(parameters = [1]);
plots:-odeplot(res, [t, S(t)], 0 .. 100);
Q := proc(p, {scene::list := [t, S(t)], range::range := 0 .. 100}) if not p::realcons then return 'procname(_passed)'; end if; res(parameters = [p]); plots:-odeplot(res, scene, range, _rest); end proc;
Q(0.5, color = blue);
plots:-animate(Q, [p, range = 0 .. 50], p = 0 .. 1, trace = 24);
n := 4;
s := unapply(add(g[k](t)*p^k, k = 0 .. n), t);
e := unapply(add(h[k](t)*p^k, k = 0 .. n), t);
i := unapply(add(i[k](t)*p^k, k = 0 .. n), t);
r := unapply(add(j[k](t)*p^k, k = 0 .. n), t);
Error, (in i[0]) too many levels of recursion
DE1 := series(eval(ode1, {E = e, I = i, R = r, S = s}), p = 0, n + 1);
DE2 := series(eval(ode2, {E = e, I = i, R = r, S = s}), p = 0, n + 1);
DE3 := series(eval(ode3, {E = e, I = i, R = r, S = s}), p = 0, n + 1);
DE4 := series(eval(ode4, {E = e, I = i, R = r, S = s}), p = 0, n + 1);
Error, (in i[0]) too many levels of recursion
Error, (in i[0]) too many levels of recursion
Error, (in i[0]) too many levels of recursion
Error, (in i[0]) too many levels of recursion
M := eval([ibvc], {E(0) = e(0), I(0) = i(0), R(0) = r(0), S(0) = s(0)});
Error, (in i[0]) too many levels of recursion

I have say  I am taking for example purpose only i need in general

v:="1:1":
k:=4

printf("%s]  is %g, v, k) 

Now i want the %s] part in some other color say green or red some dark color.

the %s is inside which need to replaced by the v which will keep coming

I want it for a general say for some part of the printf in some color

At present atleast i want

let F be a function say F(v,k) and it prints out 

printf("%s]  is %g, v, k)  where it prints out the %s] part in dark color

I want to collect up the equation terms by the numerical value of the terms coefficient? Have tried sort collect combine...
So far the best I have come up with is nops(indets(on each term). And put them in seperate lists. This still doesn't quiet do the trick.
I am looking to achieve. Would to happy to have then as seperate lists or equations.

(a_1^5+a_2^5...)+5(a_1^4a_2+a_1^4a_3....)+10(a_1^3a_2^2 ....)+20(  ....   )+......+60(a_1^2a_2a_3a_4+ a_1a_2^2a_3a_4....)


 

restart

pn := (a[1]+a[2]+a[3]+a[4])^5

(a[1]+a[2]+a[3]+a[4])^5

pn1 := expand(pn)

a[1]^5+5*a[1]^4*a[2]+5*a[1]^4*a[3]+5*a[1]^4*a[4]+10*a[1]^3*a[2]^2+20*a[1]^3*a[2]*a[3]+20*a[1]^3*a[2]*a[4]+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]^2+10*a[1]^2*a[2]^3+30*a[1]^2*a[2]^2*a[3]+30*a[1]^2*a[2]^2*a[4]+30*a[1]^2*a[2]*a[3]^2+60*a[1]^2*a[2]*a[3]*a[4]+30*a[1]^2*a[2]*a[4]^2+10*a[1]^2*a[3]^3+30*a[1]^2*a[3]^2*a[4]+30*a[1]^2*a[3]*a[4]^2+10*a[1]^2*a[4]^3+5*a[1]*a[2]^4+20*a[1]*a[2]^3*a[3]+20*a[1]*a[2]^3*a[4]+30*a[1]*a[2]^2*a[3]^2+60*a[1]*a[2]^2*a[3]*a[4]+30*a[1]*a[2]^2*a[4]^2+20*a[1]*a[2]*a[3]^3+60*a[1]*a[2]*a[3]^2*a[4]+60*a[1]*a[2]*a[3]*a[4]^2+20*a[1]*a[2]*a[4]^3+5*a[1]*a[3]^4+20*a[1]*a[3]^3*a[4]+30*a[1]*a[3]^2*a[4]^2+20*a[1]*a[3]*a[4]^3+5*a[1]*a[4]^4+a[2]^5+5*a[2]^4*a[3]+5*a[2]^4*a[4]+10*a[2]^3*a[3]^2+20*a[2]^3*a[3]*a[4]+10*a[2]^3*a[4]^2+10*a[2]^2*a[3]^3+30*a[2]^2*a[3]^2*a[4]+30*a[2]^2*a[3]*a[4]^2+10*a[2]^2*a[4]^3+5*a[2]*a[3]^4+20*a[2]*a[3]^3*a[4]+30*a[2]*a[3]^2*a[4]^2+20*a[2]*a[3]*a[4]^3+5*a[2]*a[4]^4+a[3]^5+5*a[3]^4*a[4]+10*a[3]^3*a[4]^2+10*a[3]^2*a[4]^3+5*a[3]*a[4]^4+a[4]^5

L1 := []; L2 := []; L3 := []; L4 := []; for i to nops(els) do if nops(indets(els[i])) = 1 then L1 := [op(L1), els[i]] elif nops(indets(els[i])) = 2 then L2 := [op(L2), els[i]] elif nops(indets(els[i])) = 3 then L3 := [op(L3), els[i]] else L4 := [op(L4), els[i]] end if end do; L1; L2; L3; L4

[60*a[1]*a[2]*a[3]*a[4]^2, 60*a[1]*a[2]*a[3]^2*a[4], 60*a[1]*a[2]^2*a[3]*a[4], 60*a[1]^2*a[2]*a[3]*a[4]]

indets(els[7])

{a[1], a[4]}

NULL

indets(els(5))

{}

`~`[op](1 .. -1, L2)

[5, a[1], a[2]^4, 5, a[1], a[3]^4, 5, a[1], a[4]^4, 10, a[1]^2, a[2]^3, 10, a[1]^2, a[3]^3, 10, a[1]^2, a[4]^3, 10, a[1]^3, a[2]^2, 10, a[1]^3, a[3]^2, 10, a[1]^3, a[4]^2, 5, a[1]^4, a[2], 5, a[1]^4, a[3], 5, a[1]^4, a[4], 5, a[2], a[3]^4, 5, a[2], a[4]^4, 10, a[2]^2, a[3]^3, 10, a[2]^2, a[4]^3, 10, a[2]^3, a[3]^2, 10, a[2]^3, a[4]^2, 5, a[2]^4, a[3], 5, a[2]^4, a[4], 5, a[3], a[4]^4, 10, a[3]^2, a[4]^3, 10, a[3]^3, a[4]^2, 5, a[3]^4, a[4]]

NULL

op(2, L2[1])

a[1]

op(3, L2[1])

a[2]^4``

Download 30-7-22_Q_sort_equation_by_numerical_coeffs.mw

Why maple return trivial solution after integration (see (11) in the attached .mw))? The result should be some non-trivial solution.

solutionsg.mw

Hello everybody.

I wrote the attached code. this code gives a good result when "H" parameter is equal to 0.5. Even in this condition if I change other parameters, I can get a true result as well. But when I change "H" parameter to 0.6,0.7,0.8 or 0.9 the code can't be executed anymore and I can't get a result.

based on the paper, for H=0.6,0.7,0.8 or 0.9. we have a result.

what's the problem?

can anyone please help me to solve this problem?

thank you for your help in advance.

1.mw

Dear all

I need your help to plot

1)   First:  a three dimensionl curve, that is plot F(X,Y), where X, Y, and F(X,y) is given  

curve_three_d.mw

2) Second: can plot all the curves in the same graph ( 2-dimensional curve)  obtained from the following idea 
for j from 0 by 5 to 40
plot( F(X,j), X)
end for

thank you for your help

Need help to use DrawGraph to align vertices and edges and length etc for very large large size graph which i want to analyze 

even if the graph even if it requires to writen to a file to make it more big and neatly visible.

kind kind help please it will be acknowledged

Program attached those cartesian product graphs are huge extra parameters and layouts and may others may be required to make such big big graphs visible. Kind help please.

Please help i am not that great on the stylesheet options please please help

 

Some kind of patterned way to set vertex positions for least crossings in grid form say I am trying but not able to achive kind help.

Any progression type loop based on size number of vertices et.

Graph_draw.mw

Hi,

I am making good progress in getting Maple to do the simple tasks I need it to do, but there are a few things that I am unable to get looking the way I want. I have looked repeatedly for answers, but I have come up empty every time.

1. No Leading Zero: If I have a variable equal to 0.75, I want it to display as 0.75 not .75. This is not a problem when I do calculations, but when I, for example, display the value in a plot legend, I would like it to have a leading zero.

2. Scientific Notation Threshold: Is there a threshold defining when the display of a value changes from a regular decimal number to a number in scientific notation? For example, I have a number with a value of 0.0094, and I would like it to display (again, in a plot legend) as 0.0094, but it keeps coming out as .94e-2. Yes, it is the same value.

3. Scientific Notation Format: The number in #2 shows up as .94e-2, but it seems like it should be 9.4e-3. Am I missing something? It seems like I was always taught that the mantissa should be between 1 and 10, but Maple seems to want to give me a number between 0 and 1.

Thanks,

John

restart:local D:
with(plots):
with(plottools):

a := 7;
b := a/2;
NULL;

r := b/2;
c := 2*sqrt(10)*r;
A := [c/2, c/2];
B := [c/2, -1/2*c];
C := [-c/2, (-c)/2];
D := [-c/2, c/2];
f := (x, y) -> x^2/a^2 + y^2/b^2 = 1;
Ell1 := rotate(implicitplot(f(x, y), x = -9 .. 9, y = -6 .. 6, color = blue), Pi/4);

g := (x, y) -> x^2/b^2 + y^2/a^2 = 1;
Ell2 := rotate(implicitplot(g(x, y), x = -10 .. 10, y = -10 .. 10, color = blue), Pi/4);

quadri := plot([A, B, C, D, A], x = -6 .. 6, y = -6 .. 6, filled = true, color = red, transparency = 0.7);
Cir1 := disk([c/2 - r, -c/2 + r], r, color = blue);
Cir2 := disk([-c/2 + r, -c/2 + r], r, color = blue);
Cir3 := disk([-c/2 + r, c/2 - r], r, color = blue);
Cir4 := disk([c/2 - r, c/2 - r], r, color = blue);
display([quadri, Ell1, Ell2, Cir1, Cir2, Cir3, Cir4], scaling = constrained, axes = normal);
how to find the equations of ellipses in order to fit them to discs and whiten the interior of ellipses ? Thank you.

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

I have two plots that I want to overlay.  I can do that, but I want the units to be in english units ("lbf" instead of "N" for force).  Individually each plot will switch the units, but the "display" command throws an error!  Help, please.

plot_issue_Flow.zip

I have a set of equations gathered in a vector. The number of equations varies each time. Here in this example it is 4. How you suggest so solve them with fsolve? I tried to use seq but faced error.

restart

EQ := Matrix(4, 1, {(1, 1) = 32.1640740637930*Tau[1]-0.172224519601111e-4*Tau[2]-0.270626540730518e-3*Tau[3]+0.1570620334e-9*P[1]+0.3715450960e-14*sin(t), (2, 1) = -0.172224519601111e-4*Tau[1]+32.1667045885952*Tau[2]+0.587369829416537e-4*Tau[3]-0.1589565489e-8*P[1]+0.1004220091e-12*sin(t), (3, 1) = -0.270626540730518e-3*Tau[1]+0.587369829416537e-4*Tau[2]+32.1816411689934*Tau[3]-0.7419658527e-8*P[1]+0.5201228088e-12*sin(t), (4, 1) = 0.1570620334e-9*Tau[1]-0.1589565489e-8*Tau[2]-0.7419658527e-8*Tau[3]+601.876235436204*P[1]})

V := Matrix(1, 4, {(1, 1) = Tau[1], (1, 2) = Tau[2], (1, 3) = Tau[3], (1, 4) = P[1]})

q := 0

X := Matrix(4, 1, {(1, 1) = -0.1156532164e-15*sin(t), (2, 1) = -0.3121894613e-14*sin(t), (3, 1) = -0.1616209235e-13*sin(t), (4, 1) = -0.2074537757e-24*sin(t)})

t := 1

Xf := fsolve({seq(EQ[r], r = 1 .. 4)}, {seq(V[r] = q .. X[r], r = 1 .. 4)})

Error, Matrix index out of range``

``

Download SoalNewton.mw

 

Dear All,

I have a question about "fraddiff" command to compute the fractional derivative of a function.
I need to produce  a procedure to manually compute Caputo fractional derivative of a function, instead of using "fracdiff", as the following:

Frac_C:=proc()
description "Frac_C(function,lower bound, variable (upper bound), order of differentiation)";
a:=args[2];
x:=args[3];
alpha:=args[4];
f:=unapply(args[1],args[3]);
m:=ceil(alpha);
return 1/GAMMA(m-alpha)*int((x-tau)^(m-alpha-1)*diff(f(tau),tau$m),tau=a..x);
end proc;

when I call the above procedure, as Frac_C(x^(3.4),0,x,3/4), Maple is not able to calculate the integral defined in the Caputo fractional derivative. However, I saw the pre-defined Maple command, namely fracdiff, is able to do.
Where is the trouble?
can anyone help me?

It is worth mentioning that I can calculate the fractional derivative of a functional by procedure "Frac_C()" when I try to use it at the given x as the following which is not desirable for me.
evalf(subs(x=2,Frac_C(x^(3.4),0,x,3/4)));
evalf(subs(x=2,fracdiff(x^(3.4),x,3/4)));

Best wishes

t is removed from gamma(t)

sqrt(1+(cos(alpha(t))^2-1)*cos(gamma(t))^2)

(1+(cos(alpha(t))^2-1)*cos(gamma(t))^2)^(1/2)

(1)

simplify((1+(cos(alpha(t))^2-1)*cos(gamma(t))^2)^(1/2))

(cos(alpha(t))^2*cos(gamma)^2-cos(gamma)^2+1)^(1/2)

(2)

lprint((1+(cos(alpha(t))^2-1)*cos(gamma(t))^2)^(1/2))

(1+(cos(alpha(t))^2-1)*cos(gamma(t))^2)^(1/2)

 

subs(gamma(t) = gamma(t), (1+(cos(alpha(t))^2-1)*cos(gamma(t))^2)^(1/2))

(1+(cos(alpha(t))^2-1)*cos(`γ`(t))^2)^(1/2)

(3)

simplify((1+(cos(alpha(t))^2-1)*cos(`γ`(t))^2)^(1/2))

(cos(`γ`(t))^2*cos(alpha(t))^2-cos(`γ`(t))^2+1)^(1/2)

(4)

lprint((1+(cos(alpha(t))^2-1)*cos(`γ`(t))^2)^(1/2))

(1+(cos(alpha(t))^2-1)*cos(`γ`(t))^2)^(1/2)

 

NULL

Download arg_removed.mw

First 289 290 291 292 293 294 295 Last Page 291 of 2426