adel-00

125 Reputation

9 Badges

11 years, 173 days

MaplePrimes Activity


These are replies submitted by adel-00

It is to long to solve excplicit 

any way how to assign the solution.. for example how to use one of the unknown (x or y) in another  function 

thanks all

@Carl Love i do appreciated your comments..

1) is this programme work if  there are more that two points have the same value of N'=10^-4 then in this case we take only the smallest  first argument for example (40,10^-4) and (10,10^-4) in this case we take the time 10

2) please can you run the programme its take long time and the figure isn't smooth

restart:Digits:=14:t0:=0.0:tN:=5000.0: N1:=5000:th:=evalf((tN-t0)/N1):N2:=500;
assume(beta,real):
F:=0.85:B:=0.5:

t1:=array(0..N1,[]):u1:=array(0..N1,[]):pt1:=array(0..N1,[]):pt2:=array(0..N1,[]):

var:={N(t)}:ini1:=N(0)=0.61299467707789:
for j from 1 to N2 do
beta[j]:=j*0.005;
K:=3.6631021787038-beta[j]: dsys1 :=diff(N(t),t)=N(t)*((1-N(t)/K)-F*N(t)/(N(t)^2+B^2)); dsol1 :=dsolve({dsys1,ini1},var,numeric, output=listprocedure, abserr=1e-9, relerr=1e-8,range=0..1); dsolu:=subs(dsol1,N(t)): for i from 0 to N1 do t1[i]:=evalf(th*i):u1[i]:=evalf(dsolu(t1[i]));pt1[i]:=[t1[i],u1[i]]:pt2[i]:=[t1[i],dsolu(t1[i])*((1-dsolu(t1[i])/K)-F*dsolu(t1[i])/(dsolu(t1[i])^2+B^2))]:pt4[j]:=[beta[j],C[j]];
od: mytab2:=eval([seq(pt2[i],i=0..N1)]);mytab4:=eval([seq(pt4[j],j=1..N2)]);
Min:= proc(L::{list, set, rtable}, Val)
local x, min:= infinity, v, X;
for x in L do
v:= Val(x);
if v < min then min:= v; X:= x end if
end do;
X
end proc:

Val:= x-> abs(x[2] - 1e-1):

C[j]:=Min(mytab2, Val)[1]; od:

with(plots):plot(mytab4,beta=0.01..0.5,tickmarks=[4, 5],linestyle=1,color=black,axes=boxed,titlefont=[SYMBOL,12],thickness=2,font=[1,1,18],view=[0.1..0.5,100..500]);

@Carl Love 

Many thanks... the second line of i.e min=infinity I keep it as it is??? or change it to 10^-4????

Min:= proc(L::{list, set, rtable}, Val)
local x, min:= infinity, v, X;
for x in L do
v:= Val(x);
if v < min then min:= v; X:= x end if
end do;
X
end proc:

Val:= x-> abs(x[2] - 1e-4):

@Carl Love 

Dear Carl;

Thank you for explain how to figure out the first argument and now I can obtained the pair (beta,C[j]:=Min(mytab2, Val)[1])..

I noticed that the condition for N' approaches to infinity, the time will be very large .. this isn't correct. 
now how can we change the condition N' approaches to 10^(-4) in this case will take the shortest time. For example  if the pair (t, N'=10^-4)=(60,10^-4) or (70,10^-4) , then here will take the shortest time t=60
 

restart:Digits:=14:t0:=0.0:tN:=5000.0: N1:=5000:th:=evalf((tN-t0)/N1):N2:=10;
assume(beta,real):
F:=0.85:B:=0.5:

t1:=array(0..N1,[]):u1:=array(0..N1,[]):pt1:=array(0..N1,[]):pt2:=array(0..N1,[]):

var:={N(t)}:ini1:=N(0)=0.61299467707789:
for j from 1 to N2 do
beta[j]:=j*0.01;
K:=3.6631021787038+beta[j]: dsys1 :=diff(N(t),t)=N(t)*((1-N(t)/K)-F*N(t)/(N(t)^2+B^2)); dsol1 :=dsolve({dsys1,ini1},var,numeric, output=listprocedure, abserr=1e-9, relerr=1e-8,range=0..1); dsolu:=subs(dsol1,N(t)): for i from 0 to N1 do t1[i]:=evalf(th*i):u1[i]:=evalf(dsolu(t1[i]));pt1[i]:=[t1[i],u1[i]]:pt2[i]:=[t1[i],dsolu(t1[i])*((1-dsolu(t1[i])/K)-F*dsolu(t1[i])/(dsolu(t1[i])^2+B^2))]:pt4[j]:=[beta[j],C[j]];
od: mytab2:=eval([seq(pt2[i],i=0..N1)]);mytab4:=eval([seq(pt4[j],j=1..N2)]);
Min:= proc(L::{list, set, rtable}, Val)
local x, min:= infinity, v, X;
for x in L do
v:= Val(x);
if v < min then min:= v; X:= x end if
end do;
X
end proc:

Val:= x-> abs(x[2]):

C[j]:=Min(mytab2, Val)[1]; od:

with(plots):plot(mytab4,beta=0.01..0.1,tickmarks=[4, 5],linestyle=1,color=black,axes=boxed,titlefont=[SYMBOL,12],thickness=2,font=[1,1,18]);

@Carl Love Thanks for the procedure I noticed that t ver very larg.. mathematically it is better to make the approches to 10^(-4) how can we make lettle change in your procedure.

Q2: how can i get only the first argument of i.e 4994

Min(mytab2, Val);
       [4994.00000000000, -2.784601937964963e-11]

the reson is to make it a point (beta,t)

plz take a look here

restart:Digits:=14:t0:=0.0:tN:=5000.0: N1:=5000:th:=evalf((tN-t0)/N1):
assume(beta,real):
F:=0.85:B:=0.5:

t1:=array(0..N1,[]):u1:=array(0..N1,[]):pt1:=array(0..N1,[]):pt2:=array(0..N1,[]):

var:={N(t)}:ini1:=N(0)=0.61299467707789:
for j from 1 to 1 do
beta[j]:=j*0.01;
K:=3.6631021787038+beta[j]: dsys1 :=diff(N(t),t)=N(t)*((1-N(t)/K)-F*N(t)/(N(t)^2+B^2)); dsol1 :=dsolve({dsys1,ini1},var,numeric, output=listprocedure, abserr=1e-9, relerr=1e-8,range=0..1); dsolu:=subs(dsol1,N(t)): for i from 0 to N1 do t1[i]:=evalf(th*i):u1[i]:=evalf(dsolu(t1[i]));pt1[i]:=[t1[i],u1[i]]:pt2[i]:=[t1[i],dsolu(t1[i])*((1-dsolu(t1[i])/K)-F*dsolu(t1[i])/(dsolu(t1[i])^2+B^2))]:
od: mytab2:=eval([seq(pt2[i],i=0..N1)]);
Min:= proc(L::{list, set, rtable}, Val)
local x, min:= infinity, v, X;
for x in L do
v:= Val(x);
if v < min then min:= v; X:= x end if
end do;
X
end proc:

Val:= x-> abs(x[2]):

C[j]:=Min(mytab2, Val); od:

have a nice vacation and happy new year.

Nk:= unapply([solve(subs(a=4.34839390939816894,eq1))]);

the above now is work.

One more thing 

the function V wanted to do the same thing max and min???

eq1:=(alpha+(l+alpha)*u+alpha*k*u^2)*a=
u*(alpha+(l+alpha)*u+alpha*k*u^2)*(1+l*alpha*b/((alpha+(l+alpha)*u+alpha*k*u^2)));
eq2:=v=alpha*b*(1+u+k*u^2)/(alpha+(l+alpha)*u+alpha*k*u^2);
factor((rhs-lhs)(eq1));
eq1:=collect(%,u);
params:={l=10,alpha=0.5,b=100,k=20};
U:=[solve(eval(eq1,params),u)]; #3 solutions for u
#plots:-complexplot(U,a=0..20,style=point); #plot in the complex u-plane
vua:=eval(solve(eq2,v),params): #v expressed in terms of u and a
V:=eval~(vua,u=~U): #the 3 solutions for v in terms of a

## PLOT the function V
plot(V,a=0..75,v=0..100,color=black,labels=[a,v],axes=boxed,numpoints=90,linestyle=1,font=[1,1,18],thickness=2,tickmarks=[4,4],view=[0..65,25..100]);

@Carl Love 

i did this which is work now

Optimization:-Minimize(a,{eq1},u=1..5);

for maximum and minimum

now wanted to substitute the value of the maximum to which have 2 two values

Nk:= unapply([solve(eq1=9.34, u)], eq1);

plz little advise

thanks 

@Carl Love 

Dear carl

do you remember the previous qaustion that you told me

maximize(eq, u=1..12, location);

minimize(eq, u=1..12, location);

why it doesn't work here

thanks many thanks

Also,

these functions I plot them

as

eq1:=(alpha+(l+alpha)*u+alpha*k*u^2)*a=
u*(alpha+(l+alpha)*u+alpha*k*u^2)*(1+l*alpha*b/((alpha+(l+alpha)*u+alpha*k*u^2)));
eq2:=v=alpha*b*(1+u+k*u^2)/(alpha+(l+alpha)*u+alpha*k*u^2);
factor((rhs-lhs)(eq1));
eq1:=collect(%,u);
params:={l=10,alpha=0.5,a=10,k=20};
U:=[solve(eval(eq1,params),u)]: #3 solutions for u
#plots:-complexplot(U,a=0..20,style=point); #plot in the complex u-plane
vua:=eval(solve(eq2,v),params); #v expressed in terms of u and a
V:=eval~(vua,u=~U): #the 3 solutions for v in terms of a
#plots:-complexplot(V,a=0..20,style=point); #plot in the complex v-plane
#plot skips imaginary values of u, but notice 3 colors.
#plot(U,a=0..20,labels=[a,u]);
##
plot(V,b=0..75,v=0..100,color=black,labels=[b,v],axes=boxed,numpoints=90,linestyle=1,font=[1,1,18],thickness=2,tickmarks=[4,4],view=[0..65,0..60]);

any advise how to find the maximum and the mninmum vales in (b,v)

Q2: why this command doesn't work here.. befoure i tried it in ex-example

 

minimize(eq, u=1..5, location);

i do appreciate any advises.

 

Thanks alot

can I do the same code for the minimum?

@Carl Love 

u instead of N

maximize((alpha+(l+alpha)*u+alpha*k*u^2)*a=u*(alpha+(l+alpha)*u+alpha*k*u^2)*(1+l*alpha*b/((alpha+(l+alpha)*u+alpha*k*u^2))), u=0.5..1, location);

i.e vales of (a,u)

Best regards

@Kitonum 

Dear,

thanks again,

becuse of the function is expilicit it is not easy to find values of n if values of K known

for example:

(3.6631021787038-0.1,N)

but I believe you have a way to substitute K in the equaion to get N.

Thanks in advanced.

@adel-00 many many thanks

@Kitonum Thanks, how can I get the values of N at the maximum and minimum points, respectivily.

(3.663102179, N  ) and (3.019929556, N) 

 

Many thanks that was helpful 

First 7 8 9 10 11 Page 9 of 11