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);