imparter

90 Reputation

8 Badges

9 years, 161 days

MaplePrimes Activity


These are questions asked by imparter

Dear maple user how to rectify the error  in solving the coupled differential equation using homotropy perturbation method and direct differentiations and compare the two result by plotting the graphs :

restart:
with(PDEtools):
L:=4:Nb:=1:Nt:=1:#k is some constant
f(x):=sum((p^i)*f[i](x),i=0..L):  
g(x):=sum((p^i)*g[i](x),i=0..L):
HO1:=(1-p)*(diff(f(x),x,x))+p*(((1/x)*(diff(f(x),x))+Nb*((diff(f(x),x))*diff(g(x),x))+Nt(diff(f(x),x)^2))):                                                   
expand(%):                                                                                                                                          
collect(%,p):
HO2:=(1-p)*(diff(g(x),x,x))+p*(((1/x)*(diff(g(x),x))+(Nb/Nt)*((diff(f(x),x,x))+(1/x)*diff(f(x),x)))):                                                                                        
expand(%):                                                                                                               
collect(%,p):                                                                                                              
HO2:=%:                                                                                                                 
declare(f(x),g(x),prime=x): 
for i from 0 to L+1 do equa[1][i]:=coeff(HO1,p,i)=0 end  do:                                     
for i from 0 to L+1 do equa[2][i]:=coeff(HO2,p,i)=0 end  do:           
con[1][0]:=f[0](0)=(h(x)/64),(D(f[0]))(0)=0:                                                                                                                  
con[2][0]:=g[0](0)=-(k-h(x)^2/4),(D(g[0]))(0)=0: 
for j from 1 to L do:                                                                                                    
 con[1][j]:=f[j](0)=h(x),(D(f[j]))(0)=0:                                                                           
 con[2][j]:=g[j](0)=h(x),(D(g[j]))(0)=0:                                                                         
 end do;
for i from 0 to L do;                                                                                                     
dsolve({equa[1][i],con[1][i]},f[i](x));                                                                              
f[i](x):=rhs(%);                                                                                                         
 f[i](x):=evalf(%);                                                                                                          
dsolve({equa[2][i],con[2][i]},g[i](x));                                                                            
 g[i](x):=rhs(%);                                                                                                          
g[i](x):=evalf(%);                                                                                                         
end do; 
for u from 0 to L-1 do:                                                                                                
  f[u](_z1):subs(x=_z1,f[u](x));                                                                                    
 g[u](_z1):subs(x=_z1,g[u](x));                                                                                  
 f[u+1](x):=value(simplify(f[u+1](x)));                                                                         
   f[u+1](x):=simplify(%);                                                                                               
g[u+1](x):=value(simplify(g[u+1](x)));                                                                        
g[u+1](x):=simplify(%);                                                                                                
end do:  
f(x):=evalf(simplify(sum(f[n](x),n=0..L))); 
#### direct calculations                      
#direct solve the two equations in terms of f(x) and g(x) for h(x)=e^x where Nt and Nb #are parameters and its takes some values example 1,1
restart:
with(DETools):
with(plots):
with(IntegrationTools):
Nb:=1:Nt:=1:h(x):=e^x:
Eq1 := (diff(f(x),x,x))+(((1/x)*(diff(f(x),x))+Nb*((diff(f(x),x))*diff(g(x),x))+Nt(diff(f(x),x)^2))):   
Eq2 := (diff(g(x),x,x))+(((1/x)*(diff(g(x),x))+(Nb/Nt)*((diff(f(x),x,x))+(1/x)*diff(f(x),x)))):       

Cd1 := f(0) = h(x), (D(f))(0) = 0:
dsys := {Cd1, Eq1}:
dsol := dsolve(dsys, numeric, output = operator):
#dsol(.1):
plots[odeplot](dsol, [x, diff(f(x), x$1)], 0 .. 5, color = green):
Cd2 := g(0) = h(x), (D(g))(0) = 0:
dsys := {Cd1, Cd2, Eq1, Eq2}:
dsol := dsolve(dsys, numeric, output = operator):
plots[odeplot](dsol, [x, f(x)], 0 .. 5, color = red);
plots[odeplot](dsol, [x,g(x)], 0 .. 5, color = black);
                                                                         

Dear maple user,

I have codes for Differential equations while applying one do and end loop i am able to plot the graph of G(x) while same problem with other way of applying do and end loop i am unable to plot. whats wrong with do and end loop. These are codes available in maple primes . while combining i am unable to plot .

any one resolve it.

Thanks in advance . 

 

restart:
with(DETools):
with(plots):
with(IntegrationTools):
de0 := {
    (1-p)*(diff(f(x),x,x,x))+p*(diff(f(x),x,x,x)+(1/2)*f(x)*(diff(f(x),x,x))),
    (1-p)*(diff(g(x),x$2))/Pr+p*((diff(g(x),x$2))/Pr+(1/2)*f(x)*(diff(g(x),x)))}:

ibvc0 := {f(0),(D(f))(0),(D(f))(5)-1,g(0)-1,g(5)}:
n:=2:

F := unapply( add(b[k](x)*p^k,k=0..n), x ):
G := unapply( add(c[k](x)*p^k,k=0..n), x ):

de := map( series, eval( de0, {f=F,g=G} ), p=0, n+1 ):

for k from 0 to n do

    if k = 0 then
        ibvc := expand( eval[recurse]( ibvc0, {f=F,g=G,p=0} ) ):
    else
        ibvc := { b[k](0), D(b[k])(0), (D@@2)(b[k])(0), c[k](0), D(c[k])(0) }:
    end if:

    sys := simplify( map( coeff, de, p, k ) ) union ibvc:
    soln := dsolve( sys ):
    
    b[k] := unapply( eval( b[k](x), soln ), x ):
    c[k] := unapply( eval( c[k](x), soln ), x ): 

end do:

'F(x)' = F(x)+O(p^(n+1)):
'G(x)' = G(x)+O(p^(n+1)):

Pr:=1:
plot(eval(G(x), p = 1), x = 0 .. 5, color = blue):
###### Same problem with other  way of do and and end loop unable to plot with G(x)
restart:
with(DETools):
with(plots):
with(IntegrationTools):
Pr:=1:
de1 := (1-p)*(diff(f(x), `$`(x, 3)))+p*(diff(f(x), `$`(x, 3))+(1/2)*f(x)*(diff(f(x), `$`(x, 2))));
de2 := (1-p)*(diff(g(x), `$`(x, 2)))/Pr+p*((diff(g(x), `$`(x, 2)))/Pr+(1/2)*f(x)*(diff(g(x), x)));
ibvc := f(0), (D(f))(0), (D(f))(5)-1, g(0)-1, g(5); n := 2; F := unapply(add(b[k](x)*p^k, k = 0 .. n), x); G := unapply(add(c[k](x)*p^k, k = 0 .. n), x);
DE1 := series(eval(de1, f = F), p = 0, n+1);
DE2 := series(eval(de2, g = G), p = 0, n+1);
CO := map(coeffs, eval([ibvc], f = F), p); CT := map(coeffs, eval([ibvc], g = G), p);

for k from 0 to n do IBVC1 := select(has, C*T, c[k]); slv := dsolve({coeff(DE2, p, k), op(IBVC1)}); c[k] := unapply(rhs(slv), x) end do;
G(x) = G(x)+O(p^(n+1));
plot(eval(G(x), p = 1), x = 0 .. 5);
 

Hellow, 

I am unable to combine the graphs. I have a plot structure as

P1:=plots[odeplot](dsol, [x, F(x)], 0 .. 5, color = red);

P2:=plot(eval(F(x), p = 1), x = 0 .. 5, color = blue);

I want to combine two structure and display in same plot

display (P1,P2);

 thank in advance

Help required to plot the real part only in  multiple plots. i have written some codes  please help me to rectify the errors.Thanks in advance

 

restart:
with(plots):
n:=0.75:Eh:=100:mn:=1:t0:=0.2:
a1:=(mn/t0)^((n-1)/(n))*(tb)^(1/n):a3:=Eh/tb:a4:=(Eh)^2:
U1:=(a1/Eh)*(-1+(a3*r/Eh))^(1/n)*(n*a4/(1+n))*(1/a3-(r/Eh))-a1*(-1+(1/tb))^(1/n)*(n/(n+1)*(tb-1)):
plot([Re(seq(eval(U1,tb=j),j in[0.8,0.9,1.0]))],r=0..1,legend = [tb =0.8, tb=0.9,tb =1.0],  labels = ["z ", "U"], labeldirections = ["horizontal", "vertical"],  linestyle = [solid,dash,dot],color = [black, red,green]);

Dear maple user ,

I want to draw the area outside r=2+2*cos(theta) and inside r=3 ,where theta=0..2*pi.

 I am attacing the sample figure. 

thanks in advance

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