Items tagged with ode

Hi everyone,

I'm tryng to find the equations of motion of a 5 DOF arm using Lagrange's method, but I'm pretty new at using Maple. So far, the code is:

restart:

#Método de lagrange
with(VectorCalculus):
with(LinearAlgebra):
#Origem

Orig:= <0|0|0>:
#Cinematica direta

T43:= Matrix([[1,0,0,0],[0,1,0,0],[0,0,1,L1],[0,0,0,1]]):
T76:= Matrix([[1,0,0,0],[0,1,0,0],[0,0,1,L2],[0,0,0,1]]):
R10:= Matrix([ [1,0,0,0] , [0,cos(q1(t)),-sin(q1(t)),0] , [0,sin(q1(t)),cos(q1(t)),0] , [0,0,0,1] ]):
R21:= Matrix([ [cos(q2(t)),0,-sin(q2(t)),0] , [0,1,0,0] , [sin(q2(t)),0,cos(q2(t)),0] , [0,0,0,1] ]):
R32:= Matrix([ [cos(q3(t)),sin(q3(t)),0,0] , [-sin(q3(t)),cos(q3(t)),0,0] , [0,0,1,0] , [0,0,0,1] ]):
R54:= Matrix([ [cos(q4(t)),0,-sin(q4(t)),0] , [0,1,0,0] , [sin(q4(t)),0,cos(q4(t)),0] , [0,0,0,1] ]):
R65:= Matrix([ [cos(q5(t)),sin(q5(t)),0,0] , [-sin(q5(t)),cos(q5(t)),0,0] , [0,0,1,0] , [0,0,0,1] ]):
Rr10:= Matrix([ [1,0,0] , [0,cos(q1(t)),-sin(q1(t))] , [0,sin(q1(t)),cos(q1(t))] ]):
Rr21:= Matrix([ [cos(q2(t)),0,-sin(q2(t))] , [0,1,0] , [sin(q2(t)),0,cos(q2(t))] ]):
Rr32:= Matrix([ [cos(q3(t)),sin(q3(t)),0] , [-sin(q3(t)),cos(q3(t)),0] , [0,0,1] ]):
Rr54:= Matrix([ [cos(q4(t)),0,-sin(q4(t))] , [0,1,0] , [sin(q4(t)),0,cos(q4(t))] ]):
Rr65:= Matrix([ [cos(q5(t)),sin(q5(t)),0] , [-sin(q5(t)),cos(q5(t)),0] , [0,0,1] ]):

#Coordenadas das juntas

A:= <0|0|0>:
Br:= R10.R21.R32.T43:

B:= <Br[1,4]|Br[2,4]|Br[3,4]>:
Cr:= R10.R21.R32.T43.R54.R65.T76:
C:= <Cr[1,4]|Cr[2,4]|Cr[3,4]>:

#Coordenadas dos centros de massa

TC43:= Matrix([[1,0,0,0],[0,1,0,0],[0,0,1,L1/2],[0,0,0,1]]):
MC1:=R10.R21.R32.TC43:
C1:=<MC1[1,4]|MC1[2,4]|MC1[3,4]>:
C1z := C1[3]:
TC76:= Matrix([[1,0,0,0],[0,1,0,0],[0,0,1,L2/2],[0,0,0,1]]):
MC2:=R10.R21.R32.T43.R54.R65.TC76:
C2:=<MC2[1,4]|MC2[2,4]|MC2[3,4]>:
C2z := C2[3]:

#Calculo da velocidade dos centros de massa

VPc1:= diff(C1,t):

VPc2:= diff(C2,t):


#Calculo da velocidade angular

wC1 := Transpose(Rr10.<v1,0,0> + Rr10.Rr21.<0,v2,0> + Rr10.Rr21.Rr32.<0,0,v3>):
wC2 := Transpose(Rr10.<v1,0,0> + Rr10.Rr21.<0,v2,0> + Rr10.Rr21.Rr32.<0,0,v3> + Rr10.Rr21.Rr32.Rr54.<0,v4,0>):

#Momento de inercia

Ic1:= (1/12)*m1*L1^2:
Ic2:= (1/12)*m2*L2^2:

#Energia cinética

Ec11:= (m1/2)*(VPc1.Transpose(VPc1)) + (Ic1/2)*(wC1.Transpose(wC1)):
Ec1:= simplify(Ec11):
Ec22:= (m2/2)*(VPc2.Transpose(VPc2)) + (Ic2/2)*(wC2.Transpose(wC2)):
Ec2:= simplify(Ec22):

#Energia potencial
Uc1:=m1.g.C1z:
Uc2:=m2.g.C2z:


#Energia cinetica - energia potencial

T1 := Ec1 + Ec2 - Uc1 - Uc2:

#T:= subs(diff(q1(t),t)=v1(t),diff(q2(t),t)=v2(t),diff(q3(t),t)=v3(t),diff(q4(t),t)=v4(t),diff(q5(t),t)=v5(t),diff(v1(t),t)=a1(t),diff(v2(t),t)=a2(t),diff(v3(t),t)=a3(t),diff(v4(t),t)=a4(t),diff(v5(t),t)=a5(t), T1):
T:= subs(diff(q1(t),t)=v1,diff(q2(t),t)=v2,diff(q3(t),t)=v3,diff(q4(t),t)=v4,diff(q5(t),t)=v5,q1(t)=q1,q2(t)=q2,q3(t)=q3,q4(t)=q4,q5(t)=q5, T1):

Eq11:=diff(T,v1):
#Tv1:=convert(Tv1,diff):


Eq12:=diff(T,q1):
#Tq1:=convert(Tq1,diff):


Eq13 := subs(q1=q1(t),q2=q2(t),q3=q3(t),q4=q4(t),q5=q5(t),v1=diff(q1(t),t),v2=diff(q2(t),t),v3=diff(q3(t),t),v4=diff(q4(t),t),v5=diff(q5(t),t), Eq11):

Eq14 := subs(q1=q1(t),q2=q2(t),q3=q3(t),q4=q4(t),q5=q5(t),v1=diff(q1(t),t),v2=diff(q2(t),t),v3=diff(q3(t),t),v4=diff(q4(t),t),v5=diff(q5(t),t), Eq12):

Eq15:= diff(Eq13,t):

Eqqqq16 := Eq15-Eq14=0:

##Lagrangiano

Eqqq16:=expand(Eqqqq16):
Eqq16:=convert(Eqqq16,diff):
Eq16:=collect(Eqq16,diff):

Eq21:=diff(T,v2):
#Tv1:=convert(Tv1,diff):


Eq22:=diff(T,q2):
#Tq1:=convert(Tq1,diff):


Eq23 := subs(q1=q1(t),q2=q2(t),q3=q3(t),q4=q4(t),q5=q5(t),v1=diff(q1(t),t),v2=diff(q2(t),t),v3=diff(q3(t),t),v4=diff(q4(t),t),v5=diff(q5(t),t), Eq21):

Eq24 := subs(q1=q1(t),q2=q2(t),q3=q3(t),q4=q4(t),q5=q5(t),v1=diff(q1(t),t),v2=diff(q2(t),t),v3=diff(q3(t),t),v4=diff(q4(t),t),v5=diff(q5(t),t),Eq22):

Eq25:= diff(Eq23,t):

Eqqqq26 := Eq25-Eq24=0:

##Lagrangiano

Eqqq26:=expand(Eqqqq26):
Eqq26:=convert(Eqqq26,diff):
Eq26:=collect(Eqq26,diff):


Eq31:=diff(T,v3):
#Tv1:=convert(Tv1,diff):


Eq32:=diff(T,q3):
#Tq1:=convert(Tq1,diff):


Eq33 := subs(q1=q1(t),q2=q2(t),q3=q3(t),q4=q4(t),q5=q5(t),v1=diff(q1(t),t),v2=diff(q2(t),t),v3=diff(q3(t),t),v4=diff(q4(t),t),v5=diff(q5(t),t), Eq31):

Eq34 := subs(vq1=q1(t),q2=q2(t),q3=q3(t),q4=q4(t),q5=q5(t),v1=diff(q1(t),t),v2=diff(q2(t),t),v3=diff(q3(t),t),v4=diff(q4(t),t),v5=diff(q5(t),t), Eq32):

Eq35:= diff(Eq33,t):

Eqqqq36 := Eq35-Eq34=0:

##Lagrangiano

Eqqq36:=expand(Eqqqq36):
Eqq36:=convert(Eqqq36,diff):
Eq36:=collect(Eqq36,diff):


Eq41:=diff(T,v4):
#Tv1:=convert(Tv1,diff):


Eq42:=diff(T,q4):
#Tq1:=convert(Tq1,diff):


Eq43 := subs(q1=q1(t),q2=q2(t),q3=q3(t),q4=q4(t),q5=q5(t),v1=diff(q1(t),t),v2=diff(q2(t),t),v3=diff(q3(t),t),v4=diff(q4(t),t),v5=diff(q5(t),t), Eq41):

Eq44 := subs(q1=q1(t),q2=q2(t),q3=q3(t),q4=q4(t),q5=q5(t),v1=diff(q1(t),t),v2=diff(q2(t),t),v3=diff(q3(t),t),v4=diff(q4(t),t),v5=diff(q5(t),t), Eq42):

Eq45:= diff(Eq43,t):

Eqqqq46 := Eq45-Eq44=0:

##Lagrangiano

Eqqq46:=expand(Eqqqq46):
Eqq46:=convert(Eqqq46,diff):
Eq46:=collect(Eqq46,diff):


Eq51:=diff(T,v5):
#Tv1:=convert(Tv1,diff):

Eq52:=diff(T,q5):
#Tq1:=convert(Tq1,diff):


Eq53 := subs(q1=q1(t),q2=q2(t),q3=q3(t),q4=q4(t),q5=q5(t),v1=diff(q1(t),t),v2=diff(q2(t),t),v3=diff(q3(t),t),v4=diff(q4(t),t),v5=diff(q5(t),t), Eq15):

Eq54 := subs(q1=q1(t),q2=q2(t),q3=q3(t),q4=q4(t),q5=q5(t),v1=diff(q1(t),t),v2=diff(q2(t),t),v3=diff(q3(t),t),v4=diff(q4(t),t),v5=diff(q5(t),t), Eq52):

Eq55:= diff(Eq53,t):

Eqqqq56 := Eq55-Eq54=0:

##Lagrangiano

Eqqq56:=expand(Eqqqq56):
Eqq56:=convert(Eqqq56,diff):
Eq56:=collect(Eqq56,diff):


##Substituicao de dados

Lagran1 := subs[eval](L1=1, m1=1, L2=1, m2=1, g=9.81 , Eq16):
Lagran2 := subs[eval](L1=1, m1=1, L2=1, m2=1, g=9.81 , Eq26):
Lagran3 := subs[eval](L1=1, m1=1, L2=1, m2=1, g=9.81 , Eq36):
Lagran4 := subs[eval](L1=1, m1=1, L2=1, m2=1, g=9.81 , Eq46):
Lagran5 := subs[eval](L1=1, m1=1, L2=1, m2=1, g=9.81 , Eq56):

## Solucao do sistema para encontrar as derivadas segundas ddqn/dt


ini:= q1(0)= Pi/10, q2(0)=0, q3(0)=0, q4(0)=0, q5(0)=0, eval (diff (q1(t), t), t=0)=0,eval (diff (q2(t), t), t=0)=0, eval (diff (q3(t), t), t=0)=0, eval (diff (q4(t), t), t=0)=0, eval (diff (q5(t), t), t=0)=0,eval (diff (q1(t), t$2), t=0)=0,eval (diff (q2(t), t$2), t=0)=0, eval (diff (q3(t), t$2), t=0)=0, eval (diff (q4(t), t$2), t=0)=0, eval (diff (q5(t), t$2), t=0)=0:


sol := dsolve({Lagran1, Lagran2, Lagran3, Lagran4, Lagran5, ini},{q1(t), q2(t), q3(t), q4(t), q5(t)}, numeric, output=listprocedure):

The problem is I'm stuck with the following error using dsolve:

Error, (in dsolve/numeric/process_input) unknown q1(t) present in ODE system is not a specified dependent variable or evaluatable procedure

Could someone show me what's wrong? 

Any help would be greatly appreciated, thanks in advance!

Can some one help me for converting three or two coupled pdes to odes using Lie group or any other method in maple

 

 

                                                                      

                                                                   

                                                                     

                                                                        

                                                                      

 

In a recent conversation I explained whyLSODE was giving wrong results (http://www.mapleprimes.com/questions/210948-Can-We-Trust-Maple#comment230167). After a lot of confusions and weird infinite loops for answers, it turned out that Newton Raphson was not properly done.

Both LSODE and MEBDFI are currently incompletely implemented (only one iteration is done instead of Newton Raphson till convergence). Maplesoft should update the help files accordingly.

The post below explains how better results are obtained with method = mgear. To run the command mgear you will need Maple 6 or earlier versions. For lsode, any current version is fine.  Unfortunately Maple deprecated an algorithm that worked fine. From Maple 8, the algorithm moved to Rosenbrock methods for stiff equations. This is still not ideal.

If Maple had a working algorithm, I am hoping that Maplesoft folks would consider bringing it back in future versions. (At least with the same functionality as in Maple 6).

PLEASE NOTE, the issue is not with solving this example (Very simple). This example is chosen to show how a popular algorithm in the literature is wrongly implemented.

 

Here Maple's lsode is forced to take only one step and use first order back ward difference formula to integrate from 0 to 1.  LSODE mimics Eulerbackward using the options given below. The post shows that LSODE does not do Newton Raphson and just performs only iteration for nonlinear equations.

restart;

Digits:=15;

Digits := 15

(1)

eq:=diff(y(t),t)=-y(t);

eq := diff(y(t), t) = -y(t)

(2)

C:=array([0$22]);

C := Vector[row](22, {(1) = 0, (2) = 0, (3) = 0, (4) = 0, (5) = 0, (6) = 0, (7) = 0, (8) = 0, (9) = 0, (10) = 0, (11) = 0, (12) = 0, (13) = 0, (14) = 0, (15) = 0, (16) = 0, (17) = 0, (18) = 0, (19) = 0, (20) = 0, (21) = 0, (22) = 0})

(3)

C[9]:=1;

C[9] := 1

(4)

sol:=dsolve({eq,y(0)=1},type=numeric,method=lsode[backfull],ctrl=C,initstep=0.1,minstep=0.1,abserr=1,relerr=1):

sol(0.1);

[t = .1, y(t) = .909090909090834]

(5)

subs(diff(y(t),t)=(y1-1)/0.1,y(t)=y1,eq);

0.1e2*y1-0.1e2 = -y1

(6)

fsolve(%,y1=0.5);

.909090909090909

(7)

 While for linear it gave the expected result, it gives wrong results for nonlinear problems.

sol1:=dsolve({eq,y(0)=1},type=numeric):

sol1(0.1);

[t = .1, y(t) = .904837355407810]

(8)

eq:=diff(y(t),t)=-y(t)^2*exp(-y(t))-10*y(t)*(1+0.01*exp(y(t)));

eq := diff(y(t), t) = -y(t)^2*exp(-y(t))-10*y(t)*(1+0.1e-1*exp(y(t)))

(9)

sol:=dsolve({eq,y(0)=1},type=numeric,method=lsode[backfull],ctrl=C,initstep=0.1,minstep=0.1,abserr=1,relerr=1):

sol(0.1);

[t = .1, y(t) = .501579294869466]

(10)

subs(diff(y(t),t)=(y1-1)/0.1,y(t)=y1,eq);

0.1e2*y1-0.1e2 = -y1^2*exp(-y1)-10*y1*(1+0.1e-1*exp(y1))

(11)

fsolve(%,y1=1);

.488691779256025

(12)

sol1:=dsolve({eq,y(0)=1},type=numeric):

 the expected answer is correctly obtained with default tolerance as

sol1(0.1);

[t = .1, y(t) = .349614721994122]

(13)

 The results obtained are worse than single iteration using jacobian.

eq2:=(lhs-rhs)(subs(diff(y(t),t)=(y1-1)/0.1,y(t)=y1,eq));

eq2 := 0.1e2*y1-0.1e2+y1^2*exp(-y1)+10*y1*(1+0.1e-1*exp(y1))

(14)

jac:=unapply(diff(eq2,y1),y1);

jac := proc (y1) options operator, arrow; 20.+2*y1*exp(-y1)-y1^2*exp(-y1)+.10*exp(y1)+.10*y1*exp(y1) end proc

(15)

f:=unapply(eq2,y1);

f := proc (y1) options operator, arrow; 0.1e2*y1-0.1e2+y1^2*exp(-y1)+10*y1*(1+0.1e-1*exp(y1)) end proc

(16)

y0:=1;

y0 := 1

(17)

dy:=-evalf(f(y0)/jac(y0));

dy := -.508796088545793

(18)

ynew:=y0+dy;

ynew := .491203911454207

(19)

 Following procedures confirm that it is indeed calling the procedure only at 0 and 0.1, with backdiag giving slightly better results.

myfun:= proc(x,y) if not type(x,'numeric') or not type(evalf(y),numeric)then 'procname'(x,y);
    else lprint(`Request at x=`,x); -y^2*exp(-y(x))-10*y*(1+0.01*exp(y)); end if; end proc;

myfun := proc (x, y) if not (type(x, 'numeric') and type(evalf(y), numeric)) then ('procname')(x, y) else lprint(`Request at x=`, x); -y^2*exp(-y(x))-10*y*(1+0.1e-1*exp(y)) end if end proc

(20)

sol1:=dsolve({diff(y(x),x)=myfun(x,y(x)),y(0)=1},numeric,method=lsode[backfull],ctrl=C,initstep=0.1,minstep=0.1,abserr=1,relerr=1,known={myfun}):

sol1(0.1);

`Request at x=`, 0.

`Request at x=`, 0.

`Request at x=`, .1

`Request at x=`, .1

[x = .1, y(x) = .501579304183583]

(21)

sol2:=dsolve({diff(y(x),x)=myfun(x,y(x)),y(0)=1},numeric,method=lsode[backdiag],ctrl=C,initstep=0.1,minstep=0.1,abserr=1,relerr=1,known={myfun}):

sol2(0.1);

`Request at x=`, 0.

`Request at x=`, 0.

`Request at x=`, .1

`Request at x=`, .1

[x = .1, y(x) = .497831388424072]

(22)

 

Download Lsodeanalysistrunc.mws

 

Next see how dsolve method = mgear works just fine in Maple 6 (gives the expected answer upto 3 Digits accuracy). To run this code you will need Maple 6 or earlier versions. Maple 7 has this algorithm, but I don't know to use it as it is hidden. I would like to get support from other members to get Maplesoft's attention to bring this algorithm back.

If Mdy/dt = f(y) is solved using mgear algorithm (instead of dy/dt =f ), then one can have a good DAE solver based on this (M being singular). 

 

restart;

myfun:= proc(x,y) if not type(x,'numeric') or not type(evalf(y),numeric)then 'procname'(x,y);
    else lprint(`Request at x=`,x); -y^2*exp(-y(x))-10*y*(1+0.01*exp(y)); end if; end proc;

myfun := proc (x, y) if not (type(x, 'numeric') and type(evalf(y), numeric)) then ('procname')(x, y) else lprint(`Request at x=`, x); -y^2*exp(-y(x))-10*y*(1+0.1e-1*exp(y)) end if end proc

(1)

sol2:=dsolve({diff(y(x),x)=myfun(x,y(x)),y(0)=1},{y(x)},numeric,method=mgear[mstepnum],stepsize=0.1,minstep=0.1,errorper=1):

sol2(0.1);

`Request at x=`, 0.

`Request at x=`, .1

`Request at x=`, .1

`Request at x=`, .1

[x = .1, y(x) = .4887165263]

(2)

 

 

Download Mgearworks.mws

Hi everyone!

I have a problem solving the nonlinear ode (as attached below). I got this error ---> Error, (in fproc) unable to store '-1.32352941215398+(-0.441176470717993e-1, -0.)' when datatype=float[8]

1) Could someone please explain to me what does the unable store .... error means? 

and i will be grateful if you could help me finding the solution out. Thanks in advance



Trying to solve this IVP of the SHO  (second order linear costant-coefficient).

Everything works fine until I come to the solving even after using dsolve with initial conditions (even using the differential operator D in the initial conditions)  , the answer still contains _C1, an unknown constant.

The full worksheet is below.  The code for dsolve is:

sol3 := dsolve(subs(par1, {de1, D(x)*0 = 0, x(0) = 1}), x(t));

 

Hoping you can help with a solution.

 

 

 

 

 

Hi

Please find the attachment

It seems a singularity has been occurred at left end point for n less than unit (say n=0.5, n>0)

Is there a way to fix it?

 

n.mw

DEAR SIR,

PLEASE HELP ME WITH THAT QUESTION

Hi...

 

I want to solve  this ODEs using Maple...

f’’’ + f f’’ – f’2 + λ θ = 0

(1/Pr) θ’’ + f θ’ – f’ θ = 0


and boundary conditions

f(0) = s,  f’(0) = σ + a f’’(0) + b f’’’(0),  θ(0) = 1,

f’(η) = 0, θ(η) = 0  as  η → ∞.

 

Can anyone help me to solve this problem? Thank you... =)

Hello,

 

I tried to plot the problem presented below:

restart; with(plots); C := setcolors(); with(LinearAlgebra);

formula1 := 2.6*BodyWeight*abs(sin(4*Pi*t));
2.6 BodyWeight |sin(4 Pi t)|
BodyWeight := 80*9.81;
plot(formula1, t = 0 .. 2);


eq2 := formula1-SpringConstant*y(t)-DampConstant*(diff(y(t), t)) = Mass*(diff(y(t), `$`(t, 2)));
2040.480 |sin(4 Pi t)| - SpringConstant y(t)

/ d \ / d / d \\
- DampConstant |--- y(t)| = Mass |--- |--- y(t)||
\ dt / \ dt \ dt //
DampConstant := 50;
50
Mass := .200;
Springt := 200;
200
SpringConstant := Youngsmodulus*Surface/DeltaLength;
DeltaLength := 0.2e-1-y(t);
Surface := .15;
Youngsmodulus := 6.5*10^6/(t+1)+6.5*10^6;
plot(Youngsmodulus, t = 0 .. 10000);

eq2;
2040.480 |sin(4 Pi t)|

/ 6 \
|6.5000000 10 6|
0.15 |------------- + 6.5000000 10 | y(t)
\ t + 1 / / d \
- ----------------------------------------- - 50 |--- y(t)| =
0.02 - y(t) \ dt /

/ d / d \\
0.200 |--- |--- y(t)||
\ dt \ dt //

incs := y(0) = 0, (D(y))(0) = 0;
eq4 := dsolve({eq2, incs}, y(t), type = numeric, method = lsode[backfull], maxfun = 0);
proc(x_lsode) ... end;

plots:-odeplot(eq4, [t, y(t)], 0 .. 5);

 When I try to plot it beyond t=5, Maple gives the following error:

Warning, could not obtain numerical solution at all points, plot may be incomplete

Does anyone know how to plot it even further?

 

 

Here is ODE

restart:
with(plots):
Digits:=35:

ini1:=D(x)(0)=0,x(0)=1:
dsys:=diff(x(t),t,t)+(x(t)-2)*diff(x(t),t)+5*x(t)=0;
dsol1 :=dsolve({dsys,ini1},numeric,abserr=1e-9, relerr=1e-8,maxfun=0);
plots:-odeplot(dsol1,[[t,x(t)]],0..20,axes=boxed,color=black,linestyle=1,tickmarks=[6, 6],axes=boxed,titlefont=[SYMBOL,12]);

1-Why when i run for long time>1.5 give me error

2- how to plot phase plot of x'(t) against x(t)

Any comments will be helpful

Hi!

I am simulate the code for fractional differential equation. But the out put is not wright...
sir_(2).mw

``

S[0] := .8;

.8

(1)

V[0] := .2;

.2

(2)

R[0] := 0;

0

(3)

alpha := 1;

1

 

.4

 

.8

 

gamma = 0.3e-1

(4)

q := .9;

.9

(5)

T := 1;

1

(6)

N := 5;

5

(7)

h := T/N;

1/5

(8)

``

for i from 0 to N do for j from 0 to 0 do a[j, i+1] := i^(alpha+1)-(i-alpha)*(i+1)^alpha; b[j, i+1] := h^alpha*((i+1-j)^alpha-(i-j)^alpha)/alpha end do end do;

for n from 0 to N do Sp[n+1] = S[0]+(sum(b[d, n+1]*(mu*(1-q)-beta*S[d]*V[d]-mu*S[d]), d = 0 .. n))/GAMMA(alpha); Vp[n+1] = V[0]+(sum(b[d, n+1]*(beta*S[d]*V[d]-(mu+gamma)*S[d]), d = 0 .. n))/GAMMA(alpha); Rp[n+1] = R[0]+(sum(b[d, n+1]*(mu*q-mu*R[d]+gamma*V[d]), d = 0 .. n))/GAMMA(alpha); S[n+1] = S[0]+h^alpha*(mu*(1-q)-beta*Sp[n+1]*Vp[n+1]-mu*Sp[n+1])/GAMMA(alpha+2)+h^alpha*(sum(a[e, n+1]*(mu*(1-q)-beta*S[e]*V[e]-mu*S[e]), e = 0 .. n))/GAMMA(alpha+2); V[n+1] = V[0]+h^alpha*(beta*Sp[n+1]*Vp[n+1]-(mu+gamma)*Sp[n+1])/GAMMA(alpha+2)+h^alpha*(sum(a[e, n+1]*(beta*S[e]*V[e]-(mu+gamma)*S[e]), e = 0 .. n))/GAMMA(alpha+2); R[n+1] = R[0]+h^alpha*(mu*q-mu*Rp[n+1]-gamma*Vp[n+1])/GAMMA(alpha+2)+h^alpha*(sum(a[e, n+1]*(mu*q-mu*R[e]-gamma*V[e]), e = 0 .. n))/GAMMA(alpha+2) end do;

Sp[1] = .7184000000

 

Vp[1] = 0.692454936e-1

 

Rp[1] = 0.9508862660e-1

 

S[1] = .7632000000-0.8000000000e-1*Sp[1]*Vp[1]-0.4000000000e-1*Sp[1]

 

V[1] = .1346227468+0.8000000000e-1*Sp[1]*Vp[1]-(1/10)*(.4+gamma)*Sp[1]

 

R[1] = 0.6045568670e-1-(1/10)*gamma*Vp[1]-0.4000000000e-1*Rp[1]

 

Sp[2] = .7264000000-.1600000000*S[1]*V[1]-0.8000000000e-1*S[1]

 

Vp[2] = 0.692454936e-1+.1600000000*S[1]*V[1]-.1954431330*S[1]

 

Rp[2] = .1670886266+.1154431330*V[1]-0.8000000000e-1*R[1]

 

S[2] = .7712000000-0.8000000000e-1*Sp[2]*Vp[2]-0.4000000000e-1*Sp[2]-.1600000000*S[1]*V[1]-0.8000000000e-1*S[1]

 

V[2] = .1346227468+0.8000000000e-1*Sp[2]*Vp[2]-(1/10)*(.4+gamma)*Sp[2]+.1600000000*S[1]*V[1]-.1954431330*S[1]

 

R[2] = .1324556867-(1/10)*gamma*Vp[2]-0.4000000000e-1*Rp[2]-.1154431330*V[1]-0.8000000000e-1*R[1]

 

Sp[3] = .7344000000-.1600000000*S[1]*V[1]-0.8000000000e-1*S[1]-.1600000000*S[2]*V[2]-0.8000000000e-1*S[2]

 

Vp[3] = 0.692454936e-1+.1600000000*S[1]*V[1]-.1954431330*S[1]+.1600000000*S[2]*V[2]-.1954431330*S[2]

 

Rp[3] = .2390886266+.1154431330*V[1]-0.8000000000e-1*R[1]+.1154431330*V[2]-0.8000000000e-1*R[2]

 

S[3] = .7792000000-0.8000000000e-1*Sp[3]*Vp[3]-0.4000000000e-1*Sp[3]-.1600000000*S[1]*V[1]-0.8000000000e-1*S[1]-.1600000000*S[2]*V[2]-0.8000000000e-1*S[2]

 

V[3] = .1346227468+0.8000000000e-1*Sp[3]*Vp[3]-(1/10)*(.4+gamma)*Sp[3]+.1600000000*S[1]*V[1]-.1954431330*S[1]+.1600000000*S[2]*V[2]-.1954431330*S[2]

 

R[3] = .2044556867-(1/10)*gamma*Vp[3]-0.4000000000e-1*Rp[3]-.1154431330*V[1]-0.8000000000e-1*R[1]-.1154431330*V[2]-0.8000000000e-1*R[2]

 

Sp[4] = .7424000000-.1600000000*S[1]*V[1]-0.8000000000e-1*S[1]-.1600000000*S[2]*V[2]-0.8000000000e-1*S[2]-.1600000000*S[3]*V[3]-0.8000000000e-1*S[3]

 

Vp[4] = 0.692454936e-1+.1600000000*S[1]*V[1]-.1954431330*S[1]+.1600000000*S[2]*V[2]-.1954431330*S[2]+.1600000000*S[3]*V[3]-.1954431330*S[3]

 

Rp[4] = .3110886266+.1154431330*V[1]-0.8000000000e-1*R[1]+.1154431330*V[2]-0.8000000000e-1*R[2]+.1154431330*V[3]-0.8000000000e-1*R[3]

 

S[4] = .7872000000-0.8000000000e-1*Sp[4]*Vp[4]-0.4000000000e-1*Sp[4]-.1600000000*S[1]*V[1]-0.8000000000e-1*S[1]-.1600000000*S[2]*V[2]-0.8000000000e-1*S[2]-.1600000000*S[3]*V[3]-0.8000000000e-1*S[3]

 

V[4] = .1346227468+0.8000000000e-1*Sp[4]*Vp[4]-(1/10)*(.4+gamma)*Sp[4]+.1600000000*S[1]*V[1]-.1954431330*S[1]+.1600000000*S[2]*V[2]-.1954431330*S[2]+.1600000000*S[3]*V[3]-.1954431330*S[3]

 

R[4] = .2764556867-(1/10)*gamma*Vp[4]-0.4000000000e-1*Rp[4]-.1154431330*V[1]-0.8000000000e-1*R[1]-.1154431330*V[2]-0.8000000000e-1*R[2]-.1154431330*V[3]-0.8000000000e-1*R[3]

 

Sp[5] = .7504000000-.1600000000*S[1]*V[1]-0.8000000000e-1*S[1]-.1600000000*S[2]*V[2]-0.8000000000e-1*S[2]-.1600000000*S[3]*V[3]-0.8000000000e-1*S[3]-.1600000000*S[4]*V[4]-0.8000000000e-1*S[4]

 

Vp[5] = 0.692454936e-1+.1600000000*S[1]*V[1]-.1954431330*S[1]+.1600000000*S[2]*V[2]-.1954431330*S[2]+.1600000000*S[3]*V[3]-.1954431330*S[3]+.1600000000*S[4]*V[4]-.1954431330*S[4]

 

Rp[5] = .3830886266+.1154431330*V[1]-0.8000000000e-1*R[1]+.1154431330*V[2]-0.8000000000e-1*R[2]+.1154431330*V[3]-0.8000000000e-1*R[3]+.1154431330*V[4]-0.8000000000e-1*R[4]

 

S[5] = .7952000000-0.8000000000e-1*Sp[5]*Vp[5]-0.4000000000e-1*Sp[5]-.1600000000*S[1]*V[1]-0.8000000000e-1*S[1]-.1600000000*S[2]*V[2]-0.8000000000e-1*S[2]-.1600000000*S[3]*V[3]-0.8000000000e-1*S[3]-.1600000000*S[4]*V[4]-0.8000000000e-1*S[4]

 

V[5] = .1346227468+0.8000000000e-1*Sp[5]*Vp[5]-(1/10)*(.4+gamma)*Sp[5]+.1600000000*S[1]*V[1]-.1954431330*S[1]+.1600000000*S[2]*V[2]-.1954431330*S[2]+.1600000000*S[3]*V[3]-.1954431330*S[3]+.1600000000*S[4]*V[4]-.1954431330*S[4]

 

R[5] = .3484556867-(1/10)*gamma*Vp[5]-0.4000000000e-1*Rp[5]-.1154431330*V[1]-0.8000000000e-1*R[1]-.1154431330*V[2]-0.8000000000e-1*R[2]-.1154431330*V[3]-0.8000000000e-1*R[3]-.1154431330*V[4]-0.8000000000e-1*R[4]

 

Sp[6] = .7584000000-.1600000000*S[1]*V[1]-0.8000000000e-1*S[1]-.1600000000*S[2]*V[2]-0.8000000000e-1*S[2]-.1600000000*S[3]*V[3]-0.8000000000e-1*S[3]-.1600000000*S[4]*V[4]-0.8000000000e-1*S[4]-.1600000000*S[5]*V[5]-0.8000000000e-1*S[5]

 

Vp[6] = 0.692454936e-1+.1600000000*S[1]*V[1]-.1954431330*S[1]+.1600000000*S[2]*V[2]-.1954431330*S[2]+.1600000000*S[3]*V[3]-.1954431330*S[3]+.1600000000*S[4]*V[4]-.1954431330*S[4]+.1600000000*S[5]*V[5]-.1954431330*S[5]

 

Rp[6] = .4550886266+.1154431330*V[1]-0.8000000000e-1*R[1]+.1154431330*V[2]-0.8000000000e-1*R[2]+.1154431330*V[3]-0.8000000000e-1*R[3]+.1154431330*V[4]-0.8000000000e-1*R[4]+.1154431330*V[5]-0.8000000000e-1*R[5]

 

S[6] = .8032000000-0.8000000000e-1*Sp[6]*Vp[6]-0.4000000000e-1*Sp[6]-.1600000000*S[1]*V[1]-0.8000000000e-1*S[1]-.1600000000*S[2]*V[2]-0.8000000000e-1*S[2]-.1600000000*S[3]*V[3]-0.8000000000e-1*S[3]-.1600000000*S[4]*V[4]-0.8000000000e-1*S[4]-.1600000000*S[5]*V[5]-0.8000000000e-1*S[5]

 

V[6] = .1346227468+0.8000000000e-1*Sp[6]*Vp[6]-(1/10)*(.4+gamma)*Sp[6]+.1600000000*S[1]*V[1]-.1954431330*S[1]+.1600000000*S[2]*V[2]-.1954431330*S[2]+.1600000000*S[3]*V[3]-.1954431330*S[3]+.1600000000*S[4]*V[4]-.1954431330*S[4]+.1600000000*S[5]*V[5]-.1954431330*S[5]

 

R[6] = .4204556867-(1/10)*gamma*Vp[6]-0.4000000000e-1*Rp[6]-.1154431330*V[1]-0.8000000000e-1*R[1]-.1154431330*V[2]-0.8000000000e-1*R[2]-.1154431330*V[3]-0.8000000000e-1*R[3]-.1154431330*V[4]-0.8000000000e-1*R[4]-.1154431330*V[5]-0.8000000000e-1*R[5]

(9)

``

``

 

Download sir_(2).mw

 

Hello guys,

I was just playing around with differential equations, when I noticed that symbolic solution is  different from the numerical.What is the reason for this strange behavior?


ODE := (diff(y(x), x))*(ln(y(x))+x) = 1

sol := dsolve({ODE, y(1) = 1}, y(x))

a := plot(op(2, sol), x = .75 .. 2, color = "Red");
sol2 := dsolve([ODE, y(1) = 1], numeric, range = .75 .. 2);

with(plots);
b := odeplot(sol2, .75 .. 2, thickness = 4);
display({a, b});

 

 

Strange_issue.mw

Mariusz Iwaniuk

Hi everyone. I'm going to solve a problem of an article with hpm. well I wrote some initial codes(I uploaded both codes and article). but now I face with a problem. I cant reach to the correct plot that is in the article. could you please help me???

(dont think I am lazy ;))) I found f and g (by make a system with A1 and B1 and solve it i found f[0] and g[0], with p^3 coefficient in A-->f[1] and then with B2 I foud g[1]) and their plot was correct. but the problem is theta and phi and their plots :(( )

Project.mw

2.pdf   this is article



 

restart;

lambda:=0.5;K[r]:=0.5;Sc:=0.5;Nb:=0.1;Nt:=0.1;Pr:=10;

.5

 

.5

 

.5

 

.1

 

.1

 

10

(1)

EQUATIONS

equ1:=diff(f(eta),eta$4)-R*(diff(f(eta),eta)*diff(f(eta),eta$2)-f(eta)*diff(f(eta),eta$2))-2*K[r]*diff(g(eta),eta)=0;

equ2:=diff(g(eta),eta$2)-R*(diff(f(eta),eta)*g(eta)-f(eta)*diff(g(eta),eta))+2*K[r]*diff(f(eta),eta)=0;

equ3:=diff(theta(eta),eta$2)+Pr*R*f(eta)*diff(theta(eta),eta)+Nb*diff(phi(eta),eta)*diff(theta(eta),eta)+Nt*diff(theta(eta),eta)^2=0;

equ4:=diff(phi(eta),eta$2)+R*Sc*f(eta)*diff(phi(eta),eta)+diff(theta(eta),eta$2)*(Nt/Nb)=0;

diff(diff(diff(diff(f(eta), eta), eta), eta), eta)-R*((diff(f(eta), eta))*(diff(diff(f(eta), eta), eta))-f(eta)*(diff(diff(f(eta), eta), eta)))-1.0*(diff(g(eta), eta)) = 0

 

diff(diff(g(eta), eta), eta)-R*((diff(f(eta), eta))*g(eta)-f(eta)*(diff(g(eta), eta)))+1.0*(diff(f(eta), eta)) = 0

 

diff(diff(theta(eta), eta), eta)+10*R*f(eta)*(diff(theta(eta), eta))+.1*(diff(phi(eta), eta))*(diff(theta(eta), eta))+.1*(diff(theta(eta), eta))^2 = 0

 

diff(diff(phi(eta), eta), eta)+.5*R*f(eta)*(diff(phi(eta), eta))+1.000000000*(diff(diff(theta(eta), eta), eta)) = 0

(2)

BOUNDARY*CONDITIONS

ics:=
f(0)=0,D(f)(0)=1,g(0)=0,theta(0)=1,phi(0)=1;
f(1)=lambda,D(f)(1)=0,g(1)=0,theta(1)=0,phi(1)=0;

f(0) = 0, (D(f))(0) = 1, g(0) = 0, theta(0) = 1, phi(0) = 1

 

f(1) = .5, (D(f))(1) = 0, g(1) = 0, theta(1) = 0, phi(1) = 0

(3)

HPMs

hpm1:=(1-p)*(diff(f(eta),eta$4)-2*K[r]*diff(g(eta),eta))+p*(diff(f(eta),eta$4)-R*(diff(f(eta),eta)*diff(f(eta),eta$2)-f(eta)*diff(f(eta),eta$2))-2*K[r]*diff(g(eta),eta))=0;

hpm2:=(1-p)*(diff(g(eta),eta$2)+2*K[r]*diff(f(eta),eta))+p*(diff(g(eta),eta$2)-R*(diff(f(eta),eta)*g(eta)-f(eta)*diff(g(eta),eta))+2*K[r]*diff(f(eta),eta))=0;

hpm3:=(1-p)*(diff(theta(eta),eta$2))+p*(diff(theta(eta),eta$2)+Pr*R*f(eta)*diff(theta(eta),eta)+Nb*diff(phi(eta),eta)*diff(theta(eta),eta)+Nt*diff(theta(eta),eta)^2)=0;

hpm4:=(1-p)*(diff(phi(eta),eta$2)+diff(theta(eta),eta$2)*(Nt/Nb))+p*(diff(phi(eta),eta$2)+R*Sc*f(eta)*diff(phi(eta),eta)+diff(theta(eta),eta$2)*(Nt/Nb))=0;

(1-p)*(diff(diff(diff(diff(f(eta), eta), eta), eta), eta)-1.0*(diff(g(eta), eta)))+p*(diff(diff(diff(diff(f(eta), eta), eta), eta), eta)-R*((diff(f(eta), eta))*(diff(diff(f(eta), eta), eta))-f(eta)*(diff(diff(f(eta), eta), eta)))-1.0*(diff(g(eta), eta))) = 0

 

(1-p)*(diff(diff(g(eta), eta), eta)+1.0*(diff(f(eta), eta)))+p*(diff(diff(g(eta), eta), eta)-R*((diff(f(eta), eta))*g(eta)-f(eta)*(diff(g(eta), eta)))+1.0*(diff(f(eta), eta))) = 0

 

(1-p)*(diff(diff(theta(eta), eta), eta))+p*(diff(diff(theta(eta), eta), eta)+10*R*f(eta)*(diff(theta(eta), eta))+.1*(diff(phi(eta), eta))*(diff(theta(eta), eta))+.1*(diff(theta(eta), eta))^2) = 0

 

(1-p)*(diff(diff(phi(eta), eta), eta)+1.000000000*(diff(diff(theta(eta), eta), eta)))+p*(diff(diff(phi(eta), eta), eta)+.5*R*f(eta)*(diff(phi(eta), eta))+1.000000000*(diff(diff(theta(eta), eta), eta))) = 0

(4)

f(eta)=sum(f[i](eta)*p^i,i=0..1);

f(eta) = f[0](eta)+f[1](eta)*p

(5)

g(eta)=sum(g[i](eta)*p^i,i=0..1);

g(eta) = g[0](eta)+g[1](eta)*p

(6)

theta(eta)=sum(theta[i](eta)*p^i,i=0..1);

theta(eta) = theta[0](eta)+theta[1](eta)*p

(7)

phi(eta)=sum(phi[i](eta)*p^i,i=0..1);

phi(eta) = phi[0](eta)+phi[1](eta)*p

(8)

FORequ1

A:=collect(expand(subs(f(eta)=f[0](eta)+f[1](eta)*p,g(eta)=g[0](eta)+g[1](eta)*p,hpm1)),p);

(-1.*R*(diff(f[1](eta), eta))*(diff(diff(f[1](eta), eta), eta))+R*f[1](eta)*(diff(diff(f[1](eta), eta), eta)))*p^3+(-1.*R*(diff(f[0](eta), eta))*(diff(diff(f[1](eta), eta), eta))-1.*R*(diff(f[1](eta), eta))*(diff(diff(f[0](eta), eta), eta))+R*f[0](eta)*(diff(diff(f[1](eta), eta), eta))+R*f[1](eta)*(diff(diff(f[0](eta), eta), eta)))*p^2+(diff(diff(diff(diff(f[1](eta), eta), eta), eta), eta)-1.0*(diff(g[1](eta), eta))-1.*R*(diff(f[0](eta), eta))*(diff(diff(f[0](eta), eta), eta))+R*f[0](eta)*(diff(diff(f[0](eta), eta), eta)))*p+diff(diff(diff(diff(f[0](eta), eta), eta), eta), eta)-1.0*(diff(g[0](eta), eta)) = 0

(9)

A1:=diff(f[0](eta),eta$4)-2*K[r]*(diff(g[0](eta),eta))=0;
A2:=diff(f[1](eta),eta$4)-2*K[r]*(diff(g[1](eta),eta))-R*(diff(f[0](eta),eta))*(diff(f[0](eta),eta$2))+R*f[0](eta)*(diff(f[0](eta),eta$2))=0;

diff(diff(diff(diff(f[0](eta), eta), eta), eta), eta)-1.0*(diff(g[0](eta), eta)) = 0

 

diff(diff(diff(diff(f[1](eta), eta), eta), eta), eta)-1.0*(diff(g[1](eta), eta))-R*(diff(f[0](eta), eta))*(diff(diff(f[0](eta), eta), eta))+R*f[0](eta)*(diff(diff(f[0](eta), eta), eta)) = 0

(10)

icsA1:=f[0](0)=0,D(f[0])(0)=1,g[0](0)=0,f[0](1)=lambda,D(f[0])(1)=0,g[0](1)=0;
icsA2:=f[1](0)=0,D(f[1])(0)=0,g[1](0)=0,f[1](1)=0,D(f[1])(1)=0,g[1](1)=0;

f[0](0) = 0, (D(f[0]))(0) = 1, g[0](0) = 0, f[0](1) = .5, (D(f[0]))(1) = 0, g[0](1) = 0

 

f[1](0) = 0, (D(f[1]))(0) = 0, g[1](0) = 0, f[1](1) = 0, (D(f[1]))(1) = 0, g[1](1) = 0

(11)

NULLFORequ2

B:=collect(expand(subs(f(eta)=f[0](eta)+f[1](eta)*p,g(eta)=g[0](eta)+g[1](eta)*p,hpm2)),p);

(-1.*R*(diff(f[1](eta), eta))*g[1](eta)+R*f[1](eta)*(diff(g[1](eta), eta)))*p^3+(-1.*R*(diff(f[0](eta), eta))*g[1](eta)-1.*R*(diff(f[1](eta), eta))*g[0](eta)+R*f[0](eta)*(diff(g[1](eta), eta))+R*f[1](eta)*(diff(g[0](eta), eta)))*p^2+(diff(diff(g[1](eta), eta), eta)+1.0*(diff(f[1](eta), eta))-1.*R*(diff(f[0](eta), eta))*g[0](eta)+R*f[0](eta)*(diff(g[0](eta), eta)))*p+diff(diff(g[0](eta), eta), eta)+1.0*(diff(f[0](eta), eta)) = 0

(12)

B1:=diff(g[0](eta),eta$2)+2*K[r]*(diff(f[0](eta),eta))=0;
B2:=diff(g[1](eta),eta$2)+2*K[r]*(diff(f[1](eta),eta))-R*(diff(f[0](eta),eta))*g[0](eta)+R*f[0](eta)*(diff(g[0](eta),eta))=0;

diff(diff(g[0](eta), eta), eta)+1.0*(diff(f[0](eta), eta)) = 0

 

diff(diff(g[1](eta), eta), eta)+1.0*(diff(f[1](eta), eta))-R*(diff(f[0](eta), eta))*g[0](eta)+R*f[0](eta)*(diff(g[0](eta), eta)) = 0

(13)

icsB1:=f[0](0)=0,D(f[0])(0)=1,g[0](0)=0,f[0](1)=lambda,D(f[0])(1)=0,g[0](1)=0;
icsB2:=f[1](0)=0,D(f[1])(0)=0,g[1](0)=0,f[1](1)=0,D(f[1])(1)=0,g[1](1)=0;

f[0](0) = 0, (D(f[0]))(0) = 1, g[0](0) = 0, f[0](1) = .5, (D(f[0]))(1) = 0, g[0](1) = 0

 

f[1](0) = 0, (D(f[1]))(0) = 0, g[1](0) = 0, f[1](1) = 0, (D(f[1]))(1) = 0, g[1](1) = 0

(14)

FORequ3

C:=collect(expand(subs(theta(eta)=theta[0](eta)+theta[1](eta)*p,phi(eta)=phi[0](eta)+phi[1](eta)*p,f(eta)=f[0](eta)+f[1](eta)*p,hpm3)),p);

(10.*R*f[1](eta)*(diff(theta[1](eta), eta))+.1*(diff(phi[1](eta), eta))*(diff(theta[1](eta), eta))+.1*(diff(theta[1](eta), eta))^2)*p^3+(10.*R*f[0](eta)*(diff(theta[1](eta), eta))+10.*R*f[1](eta)*(diff(theta[0](eta), eta))+.1*(diff(phi[0](eta), eta))*(diff(theta[1](eta), eta))+.1*(diff(phi[1](eta), eta))*(diff(theta[0](eta), eta))+.2*(diff(theta[0](eta), eta))*(diff(theta[1](eta), eta)))*p^2+(diff(diff(theta[1](eta), eta), eta)+10.*R*f[0](eta)*(diff(theta[0](eta), eta))+.1*(diff(phi[0](eta), eta))*(diff(theta[0](eta), eta))+.1*(diff(theta[0](eta), eta))^2)*p+diff(diff(theta[0](eta), eta), eta) = 0

(15)

C1:=diff(theta[0](eta),eta$2)=0;
C2:=diff(theta[1](eta), eta, eta)+Pr*R*f[0](eta)*(diff(theta[0](eta), eta))+Nb*(diff(phi[0](eta), eta))*(diff(theta[0](eta), eta))+Nt*(diff(theta[0](eta), eta))^2=0;

diff(diff(theta[0](eta), eta), eta) = 0

 

diff(diff(theta[1](eta), eta), eta)+10*R*f[0](eta)*(diff(theta[0](eta), eta))+.1*(diff(phi[0](eta), eta))*(diff(theta[0](eta), eta))+.1*(diff(theta[0](eta), eta))^2 = 0

(16)

icsC1:=theta[0](0)=1,theta[0](1)=0;
icsC2:=f[0](0)=0,D(f[0])(0)=1,f[1](1)=0,D(f[1])(1)=0,theta[1](0)=0,theta[1](1)=0,phi[0](0)=0,phi[0](1)=0;

theta[0](0) = 1, theta[0](1) = 0

 

f[0](0) = 0, (D(f[0]))(0) = 1, f[1](1) = 0, (D(f[1]))(1) = 0, theta[1](0) = 0, theta[1](1) = 0, phi[0](0) = 0, phi[0](1) = 0

(17)

FORequ4

E:=collect(expand(subs(theta(eta)=theta[0](eta)+theta[1](eta)*p,phi(eta)=phi[0](eta)+phi[1](eta)*p,f(eta)=f[0](eta)+f[1](eta)*p,hpm4)),p);

.5*R*f[1](eta)*p^3*(diff(phi[1](eta), eta))+(.5*R*f[0](eta)*(diff(phi[1](eta), eta))+.5*R*f[1](eta)*(diff(phi[0](eta), eta)))*p^2+(diff(diff(phi[1](eta), eta), eta)+1.000000000*(diff(diff(theta[1](eta), eta), eta))+.5*R*f[0](eta)*(diff(phi[0](eta), eta)))*p+diff(diff(phi[0](eta), eta), eta)+1.000000000*(diff(diff(theta[0](eta), eta), eta)) = 0

(18)

E1:=diff(phi[0](eta),eta$2)+Nt*(diff(theta[0](eta),eta$2))/Nb=0;
E2:=diff(phi[1](eta),eta$2)+Nt*(diff(theta[1](eta),eta$2))/Nb+R*Sc*f[0](eta)*(diff(phi[0](eta),eta))=0;

diff(diff(phi[0](eta), eta), eta)+1.000000000*(diff(diff(theta[0](eta), eta), eta)) = 0

 

diff(diff(phi[1](eta), eta), eta)+1.000000000*(diff(diff(theta[1](eta), eta), eta))+.5*R*f[0](eta)*(diff(phi[0](eta), eta)) = 0

(19)

icsE1:=phi[0](0)=1,phi[0](1)=0;
icsE2:=f[0](0)=0,D(f[0])(0)=1,f[1](1)=0,D(f[1])(1)=0,theta[1](0)=0,theta[1](1)=0,phi[1](0)=0,phi[1](1)=0;

phi[0](0) = 1, phi[0](1) = 0

 

f[0](0) = 0, (D(f[0]))(0) = 1, f[1](1) = 0, (D(f[1]))(1) = 0, theta[1](0) = 0, theta[1](1) = 0, phi[1](0) = 0, phi[1](1) = 0

(20)

``

NULL



Download Project.mw


Project.mw

Download Project.mw

thanks for your favorits

Hi, i am trying to solve my PDEs with HPM method ,but i get strange errors.

first one is :Error, (in trig/reduce/reduce) Maple was unable to allocate enough memory to complete this computation.  Please see ?alloc,

but when i run my last function again,the error chages,let me show you.


restart;
lambda:=0.5;K[r]:=0.5;Sc:=0.5;Nb:=0.1;Nt:=0.1;Pr:=10;
                              0.5
                              0.5
                              0.5
                              0.1
                              0.1
                               10
> EQUATIONS;


equ1:=diff(f(eta),eta$4)-R*(diff(f(eta),eta)*diff(f(eta),eta$2)-f(eta)*diff(f(eta),eta$2))-2*K[r]*diff(g(eta),eta)=0;

equ2:=diff(g(eta),eta$2)-R*(diff(f(eta),eta)*g(eta)-f(eta)*diff(g(eta),eta))+2*K[r]*diff(f(eta),eta)=0;

equ3:=diff(theta(eta),eta$2)+Pr*R*f(eta)*diff(theta(eta),eta)+Nb*diff(phi(eta),eta)*diff(theta(eta),eta)+Nt*diff(theta(eta),eta)^2=0;

equ4:=diff(phi(eta),eta$2)+R*Sc*f(eta)*diff(phi(eta),eta)+diff(theta(eta),eta$2)*(Nt/Nb)=0;
/  d   /  d   /  d   /  d         \\\\     //  d         \ /  d  
|----- |----- |----- |----- f(eta)|||| - R ||----- f(eta)| |-----
\ deta \ deta \ deta \ deta       ////     \\ deta       / \ deta

   /  d         \\          /  d   /  d         \\\
   |----- f(eta)|| - f(eta) |----- |----- f(eta)|||
   \ deta       //          \ deta \ deta       ///

         /  d         \    
   - 1.0 |----- g(eta)| = 0
         \ deta       /    
     /  d   /  d         \\
     |----- |----- g(eta)||
     \ deta \ deta       //

            //  d         \                 /  d         \\
        - R ||----- f(eta)| g(eta) - f(eta) |----- g(eta)||
            \\ deta       /                 \ deta       //

              /  d         \    
        + 1.0 |----- f(eta)| = 0
              \ deta       /    
  /  d   /  d             \\               /  d             \
  |----- |----- theta(eta)|| + 10 R f(eta) |----- theta(eta)|
  \ deta \ deta           //               \ deta           /

           /  d           \ /  d             \
     + 0.1 |----- phi(eta)| |----- theta(eta)|
           \ deta         / \ deta           /

                             2    
           /  d             \     
     + 0.1 |----- theta(eta)|  = 0
           \ deta           /     
    /  d   /  d           \\                /  d           \
    |----- |----- phi(eta)|| + 0.5 R f(eta) |----- phi(eta)|
    \ deta \ deta         //                \ deta         /

                     /  d   /  d             \\    
       + 1.000000000 |----- |----- theta(eta)|| = 0
                     \ deta \ deta           //    
> BOUNDARY*CONDITIONS;


ics:=
f(0)=0,D(f)(0)=1,g(0)=0,theta(0)=1,phi(0)=1;
f(1)=lambda,D(f)(1)=0,g(1)=0,theta(1)=0,phi(1)=0;
   f(0) = 0, D(f)(0) = 1, g(0) = 0, theta(0) = 1, phi(0) = 1
  f(1) = 0.5, D(f)(1) = 0, g(1) = 0, theta(1) = 0, phi(1) = 0
> HPMs;


hpm1:=(1-p)*(diff(f(eta),eta$4)-2*K[r]*diff(g(eta),eta))+p*(diff(f(eta),eta$4)-R*(diff(f(eta),eta)*diff(f(eta),eta$2)-f(eta)*diff(f(eta),eta$2))-2*K[r]*diff(g(eta),eta))=0;

hpm2:=(1-p)*(diff(g(eta),eta$2)+2*K[r]*diff(f(eta),eta))+p*(diff(g(eta),eta$2)-R*(diff(f(eta),eta)*g(eta)-f(eta)*diff(g(eta),eta))+2*K[r]*diff(f(eta),eta))=0;

hpm3:=(1-p)*(diff(theta(eta),eta$2))+p*(diff(theta(eta),eta$2)+Pr*R*f(eta)*diff(theta(eta),eta)+Nb*diff(phi(eta),eta)*diff(theta(eta),eta)+Nt*diff(theta(eta),eta)^2)=0;

hpm4:=(1-p)*(diff(phi(eta),eta$2)+diff(theta(eta),eta$2)*(Nt/Nb))+p*(diff(phi(eta),eta$2)+R*Sc*f(eta)*diff(phi(eta),eta)+diff(theta(eta),eta$2)*(Nt/Nb))=0;

        //  d   /  d   /  d   /  d         \\\\
(1 - p) ||----- |----- |----- |----- f(eta)||||
        \\ deta \ deta \ deta \ deta       ////

         /  d         \\     //  d   /  d   /  d   /  d         \
   - 1.0 |----- g(eta)|| + p ||----- |----- |----- |----- f(eta)|
         \ deta       //     \\ deta \ deta \ deta \ deta       /

  \\\     //  d         \ /  d   /  d         \\
  ||| - R ||----- f(eta)| |----- |----- f(eta)||
  ///     \\ deta       / \ deta \ deta       //

            /  d   /  d         \\\       /  d         \\    
   - f(eta) |----- |----- f(eta)||| - 1.0 |----- g(eta)|| = 0
            \ deta \ deta       ///       \ deta       //    
        //  d   /  d         \\       /  d         \\     //  d  
(1 - p) ||----- |----- g(eta)|| + 1.0 |----- f(eta)|| + p ||-----
        \\ deta \ deta       //       \ deta       //     \\ deta

   /  d         \\
   |----- g(eta)||
   \ deta       //

       //  d         \                 /  d         \\
   - R ||----- f(eta)| g(eta) - f(eta) |----- g(eta)||
       \\ deta       /                 \ deta       //

         /  d         \\    
   + 1.0 |----- f(eta)|| = 0
         \ deta       //    
                                       /                         
        /  d   /  d             \\     |/  d   /  d             \
(1 - p) |----- |----- theta(eta)|| + p ||----- |----- theta(eta)|
        \ deta \ deta           //     \\ deta \ deta           /

  \               /  d             \
  | + 10 R f(eta) |----- theta(eta)|
  /               \ deta           /

         /  d           \ /  d             \
   + 0.1 |----- phi(eta)| |----- theta(eta)|
         \ deta         / \ deta           /

                           2\    
         /  d             \ |    
   + 0.1 |----- theta(eta)| | = 0
         \ deta           / /    
        //  d   /  d           \\
(1 - p) ||----- |----- phi(eta)||
        \\ deta \ deta         //

                 /  d   /  d             \\\     //  d   /  d   
   + 1.000000000 |----- |----- theta(eta)||| + p ||----- |-----
                 \ deta \ deta           ///     \\ deta \ deta

          \\                /  d           \
  phi(eta)|| + 0.5 R f(eta) |----- phi(eta)|
          //                \ deta         /

                 /  d   /  d             \\\    
   + 1.000000000 |----- |----- theta(eta)||| = 0
                 \ deta \ deta           ///    
f(eta)=sum(f[i](eta)*p^i,i=0..1);
                f(eta) = f[0](eta) + f[1](eta) p
g(eta)=sum(g[i](eta)*p^i,i=0..1);
                g(eta) = g[0](eta) + g[1](eta) p
theta(eta)=sum(theta[i](eta)*p^i,i=0..1);
          theta(eta) = theta[0](eta) + theta[1](eta) p
phi(eta)=sum(phi[i](eta)*p^i,i=0..1);
             phi(eta) = phi[0](eta) + phi[1](eta) p
> FORequ1;


A:=collect(expand(subs(f(eta)=f[0](eta)+f[1](eta)*p,g(eta)=g[0](eta)+g[1](eta)*p,hpm1)),p);
/      /  d            \ /  d   /  d            \\
|-1. R |----- f[1](eta)| |----- |----- f[1](eta)||
\      \ deta          / \ deta \ deta          //

                 /  d   /  d            \\\  3   /
   + R f[1](eta) |----- |----- f[1](eta)||| p  + |
                 \ deta \ deta          ///      \
      /  d            \ /  d   /  d            \\
-1. R |----- f[0](eta)| |----- |----- f[1](eta)||
      \ deta          / \ deta \ deta          //

          /  d            \ /  d   /  d            \\
   - 1. R |----- f[1](eta)| |----- |----- f[0](eta)||
          \ deta          / \ deta \ deta          //

                 /  d   /  d            \\
   + R f[0](eta) |----- |----- f[1](eta)||
                 \ deta \ deta          //

                 /  d   /  d            \\\  2   //  d   /  d   /
   + R f[1](eta) |----- |----- f[0](eta)||| p  + ||----- |----- |
                 \ deta \ deta          ///      \\ deta \ deta \

    d   /  d            \\\\       /  d            \
  ----- |----- f[1](eta)|||| - 1.0 |----- g[1](eta)|
   deta \ deta          ////       \ deta          /

          /  d            \ /  d   /  d            \\
   - 1. R |----- f[0](eta)| |----- |----- f[0](eta)||
          \ deta          / \ deta \ deta          //

                 /  d   /  d            \\\  
   + R f[0](eta) |----- |----- f[0](eta)||| p
                 \ deta \ deta          ///  

     /  d   /  d   /  d   /  d            \\\\
   + |----- |----- |----- |----- f[0](eta)||||
     \ deta \ deta \ deta \ deta          ////

         /  d            \    
   - 1.0 |----- g[0](eta)| = 0
         \ deta          /    
A1:=diff(f[0](eta),eta$4)-2*K[r]*(diff(g[0](eta),eta))=0;
A2:=diff(f[1](eta),eta$4)-2*K[r]*(diff(g[1](eta),eta))-R*(diff(f[0](eta),eta))*(diff(f[0](eta),eta$2))+R*f[0](eta)*(diff(f[0](eta),eta$2))=0;
/  d   /  d   /  d   /  d            \\\\       /  d            \   
|----- |----- |----- |----- f[0](eta)|||| - 1.0 |----- g[0](eta)| =
\ deta \ deta \ deta \ deta          ////       \ deta          /   

  0
/  d   /  d   /  d   /  d            \\\\       /  d            \
|----- |----- |----- |----- f[1](eta)|||| - 1.0 |----- g[1](eta)|
\ deta \ deta \ deta \ deta          ////       \ deta          /

       /  d            \ /  d   /  d            \\
   - R |----- f[0](eta)| |----- |----- f[0](eta)||
       \ deta          / \ deta \ deta          //

                 /  d   /  d            \\    
   + R f[0](eta) |----- |----- f[0](eta)|| = 0
                 \ deta \ deta          //    
icsA1:=f[0](0)=0,D(f[0])(0)=1,g[0](0)=0,f[0](1)=lambda,D(f[0])(1)=0,g[0](1)=0;
icsA2:=f[1](0)=0,D(f[1])(0)=0,g[1](0)=0,f[1](1)=0,D(f[1])(1)=0,g[1](1)=0;
   f[0](0) = 0, D(f[0])(0) = 1, g[0](0) = 0, f[0](1) = 0.5,

     D(f[0])(1) = 0, g[0](1) = 0
    f[1](0) = 0, D(f[1])(0) = 0, g[1](0) = 0, f[1](1) = 0,

      D(f[1])(1) = 0, g[1](1) = 0
>
FORequ2;


B:=collect(expand(subs(f(eta)=f[0](eta)+f[1](eta)*p,g(eta)=g[0](eta)+g[1](eta)*p,hpm2)),p);
/      /  d            \          
|-1. R |----- f[1](eta)| g[1](eta)
\      \ deta          /          

                 /  d            \\  3   /
   + R f[1](eta) |----- g[1](eta)|| p  + |
                 \ deta          //      \
      /  d            \          
-1. R |----- f[0](eta)| g[1](eta)
      \ deta          /          

          /  d            \          
   - 1. R |----- f[1](eta)| g[0](eta)
          \ deta          /          

                 /  d            \
   + R f[0](eta) |----- g[1](eta)|
                 \ deta          /

                 /  d            \\  2   //  d   /  d            
   + R f[1](eta) |----- g[0](eta)|| p  + ||----- |----- g[1](eta)
                 \ deta          //      \\ deta \ deta          

  \\       /  d            \        /  d            \          
  || + 1.0 |----- f[1](eta)| - 1. R |----- f[0](eta)| g[0](eta)
  //       \ deta          /        \ deta          /          

                 /  d            \\     /  d   /  d            \\
   + R f[0](eta) |----- g[0](eta)|| p + |----- |----- g[0](eta)||
                 \ deta          //     \ deta \ deta          //

         /  d            \    
   + 1.0 |----- f[0](eta)| = 0
         \ deta          /    
B1:=diff(g[0](eta),eta$2)+2*K[r]*(diff(f[0](eta),eta))=0;
B2:=diff(g[1](eta),eta$2)+2*K[r]*(diff(f[1](eta),eta))-R*(diff(f[0](eta),eta))*g[0](eta)+R*f[0](eta)*(diff(g[0](eta),eta))=0;
     /  d   /  d            \\       /  d            \    
     |----- |----- g[0](eta)|| + 1.0 |----- f[0](eta)| = 0
     \ deta \ deta          //       \ deta          /    
       /  d   /  d            \\       /  d            \
       |----- |----- g[1](eta)|| + 1.0 |----- f[1](eta)|
       \ deta \ deta          //       \ deta          /

              /  d            \          
          - R |----- f[0](eta)| g[0](eta)
              \ deta          /          

                        /  d            \    
          + R f[0](eta) |----- g[0](eta)| = 0
                        \ deta          /    
icsB1:=f[0](0)=0,D(f[0])(0)=1,g[0](0)=0,f[0](1)=lambda,D(f[0])(1)=0,g[0](1)=0;
icsB2:=f[1](0)=0,D(f[1])(0)=0,g[1](0)=0,f[1](1)=0,D(f[1])(1)=0,g[1](1)=0;
   f[0](0) = 0, D(f[0])(0) = 1, g[0](0) = 0, f[0](1) = 0.5,

     D(f[0])(1) = 0, g[0](1) = 0
    f[1](0) = 0, D(f[1])(0) = 0, g[1](0) = 0, f[1](1) = 0,

      D(f[1])(1) = 0, g[1](1) = 0
> FORequ3;


C:=collect(expand(subs(theta(eta)=theta[0](eta)+theta[1](eta)*p,phi(eta)=phi[0](eta)+phi[1](eta)*p,f(eta)=f[0](eta)+f[1](eta)*p,hpm3)),p);
 /                                     
 |                /  d                \
 |10. R f[1](eta) |----- theta[1](eta)|
 \                \ deta              /

          /  d              \ /  d                \
    + 0.1 |----- phi[1](eta)| |----- theta[1](eta)|
          \ deta            / \ deta              /

                               2\                              
          /  d                \ |  3   /                /  d   
    + 0.1 |----- theta[1](eta)| | p  + |10. R f[0](eta) |-----
          \ deta              / /      \                \ deta

                \                   /  d                \
   theta[1](eta)| + 10. R f[1](eta) |----- theta[0](eta)|
                /                   \ deta              /

          /  d              \ /  d                \
    + 0.1 |----- phi[0](eta)| |----- theta[1](eta)|
          \ deta            / \ deta              /

          /  d              \ /  d                \
    + 0.1 |----- phi[1](eta)| |----- theta[0](eta)|
          \ deta            / \ deta              /

                                                            /
          /  d                \ /  d                \\  2   |/
    + 0.2 |----- theta[0](eta)| |----- theta[1](eta)|| p  + ||
          \ deta              / \ deta              //      \\

     d   /  d                \\
   ----- |----- theta[1](eta)||
    deta \ deta              //

                      /  d                \
    + 10. R f[0](eta) |----- theta[0](eta)|
                      \ deta              /

          /  d              \ /  d                \
    + 0.1 |----- phi[0](eta)| |----- theta[0](eta)|
          \ deta            / \ deta              /

                               2\  
          /  d                \ |  
    + 0.1 |----- theta[0](eta)| | p
          \ deta              / /  

      /  d   /  d                \\    
    + |----- |----- theta[0](eta)|| = 0
      \ deta \ deta              //    
C1:=diff(theta[0](eta),eta$2)=0;
C2:=diff(theta[1](eta), eta, eta)+Pr*R*f[0](eta)*(diff(theta[0](eta), eta))+Nb*(diff(phi[0](eta), eta))*(diff(theta[0](eta), eta))+Nt*(diff(theta[0](eta), eta))^2=0;
                  d   /  d                \    
                ----- |----- theta[0](eta)| = 0
                 deta \ deta              /    
       /  d   /  d                \\
       |----- |----- theta[1](eta)||
       \ deta \ deta              //

                           /  d                \
          + 10 R f[0](eta) |----- theta[0](eta)|
                           \ deta              /

                /  d              \ /  d                \
          + 0.1 |----- phi[0](eta)| |----- theta[0](eta)|
                \ deta            / \ deta              /

                                     2    
                /  d                \     
          + 0.1 |----- theta[0](eta)|  = 0
                \ deta              /     
icsC1:=theta[0](0)=1,theta[0](1)=0;
icsC2:=theta[1](0)=0,theta[1](1)=0,phi[0](0)=0,phi[0](1)=0;
                theta[0](0) = 1, theta[0](1) = 0
 theta[1](0) = 0, theta[1](1) = 0, phi[0](0) = 0, phi[0](1) = 0
> FORequ4;


E:=collect(expand(subs(theta(eta)=theta[0](eta)+theta[1](eta)*p,phi(eta)=phi[0](eta)+phi[1](eta)*p,f(eta)=f[0](eta)+f[1](eta)*p,hpm4)),p);
                 3 /  d              \   /                /  d   
0.5 R f[1](eta) p  |----- phi[1](eta)| + |0.5 R f[0](eta) |-----
                   \ deta            /   \                \ deta

             \                   /  d              \\  2   //
  phi[1](eta)| + 0.5 R f[1](eta) |----- phi[0](eta)|| p  + ||
             /                   \ deta            //      \\

    d   /  d              \\
  ----- |----- phi[1](eta)||
   deta \ deta            //

                 /  d   /  d                \\
   + 1.000000000 |----- |----- theta[1](eta)||
                 \ deta \ deta              //

                     /  d              \\  
   + 0.5 R f[0](eta) |----- phi[0](eta)|| p
                     \ deta            //  

     /  d   /  d              \\
   + |----- |----- phi[0](eta)||
     \ deta \ deta            //

                 /  d   /  d                \\    
   + 1.000000000 |----- |----- theta[0](eta)|| = 0
                 \ deta \ deta              //    
E1:=diff(phi[0](eta),eta$2)+Nt*(diff(theta[0](eta),eta$2))/Nb=0;
E2:=diff(phi[1](eta),eta$2)+Nt*(diff(theta[1](eta),eta$2))/Nb+R*Sc*f[0](eta)*(diff(phi[0](eta),eta))=0;
       /  d   /  d              \\
       |----- |----- phi[0](eta)||
       \ deta \ deta            //

                        /  d   /  d                \\    
          + 1.000000000 |----- |----- theta[0](eta)|| = 0
                        \ deta \ deta              //    
         /  d   /  d              \\
         |----- |----- phi[1](eta)||
         \ deta \ deta            //

                          /  d   /  d                \\
            + 1.000000000 |----- |----- theta[1](eta)||
                          \ deta \ deta              //

                              /  d              \    
            + 0.5 R f[0](eta) |----- phi[0](eta)| = 0
                              \ deta            /    
icsE1:=theta[0](0)=1,theta[0](1)=0,phi[0](0)=1,phi[0](1)=0;
icsE2:=theta[1](0)=0,theta[1](1)=0,phi[1](0)=0,phi[1](1)=0;
 theta[0](0) = 1, theta[0](1) = 0, phi[0](0) = 1, phi[0](1) = 0
 theta[1](0) = 0, theta[1](1) = 0, phi[1](0) = 0, phi[1](1) = 0
       
theta[0](eta) = -(152675527/100000000)*eta+1;
                                152675527        
              theta[0](eta) = - --------- eta + 1
                                100000000        
U:=f[1](eta)=0;
                         f[1](eta) = 0
Dsolve(A1,B1,icsA1,icsB1);
                  Dsolve(A1, B1, icsA1, icsB1)


sys:={ diff(g[0](eta), eta, eta)+1.0*(diff(f[0](eta), eta)) = 0, diff(f[0](eta), eta, eta, eta, eta)-1.0*(diff(g[0](eta), eta)) = 0};
    //  d   /  d   /  d   /  d            \\\\
   { |----- |----- |----- |----- f[0](eta)||||
    \\ deta \ deta \ deta \ deta          ////

            /  d            \      
      - 1.0 |----- g[0](eta)| = 0,
            \ deta          /      

     /  d   /  d            \\       /  d            \    \
     |----- |----- g[0](eta)|| + 1.0 |----- f[0](eta)| = 0 }
     \ deta \ deta          //       \ deta          /    /
IC_1:={ f[0](0) = 0, (D(f[0]))(0) = 1, g[0](0) = 0, f[0](1) = .5, (D(f[0]))(1) = 0, g[0](1) = 0,f[0](0) = 0, (D(f[0]))(0) = 1, g[0](0) = 0, f[0](1) = .5, (D(f[0]))(1) = 0, g[0](1) = 0};
    {f[0](0) = 0, f[0](1) = 0.5, g[0](0) = 0, g[0](1) = 0,

      D(f[0])(0) = 1, D(f[0])(1) = 0}
ans1 := combine(dsolve(sys union IC_1,{f[0](eta),g[0](eta)}),trig);
Error, (in dsolve) expecting an ODE or a set or list of ODEs. Received `union`(IC_1, sys)
>

Hello everybody.

I'm trying to obtain the numerical solution of a differential equation. Unfortunately, this prove to be quite challenging. I was able to obtain a rough solution using mathematica, but nothing more. The function is strictly increasing (for sure).

Any help is really REALLY appreciated, thanks!

 

``

deq1 := 1/(b-f(b)) = (2*(3-(1-f(b)*(diff(f(b), b, b)))/((diff(f(b), b))*(diff(f(b), b)))))/(1-2*(b-(1-f(b))/(diff(f(b), b))))

1/(b-f(b)) = 2*(3-(1-f(b)*(diff(diff(f(b), b), b)))/(diff(f(b), b))^2)/(1-2*b+2*(1-f(b))/(diff(f(b), b)))

(1)

ic1 := eval(f(b), b = 3/8) = 0, eval(f(b), b = 1/2) = 1/2

f(3/8) = 0, f(1/2) = 1/2

(2)

digits := 3

3

(3)

dsol1 := dsolve({deq1, ic1}, method = bvp[middefer], numeric, range = 3/8 .. 1/2)

Error, (in dsolve/numeric/bvp) initial Newton iteration is not converging

 

``

 

Download diffeqn.mw

1 2 3 4 5 6 7 Last Page 3 of 31