## 135 Reputation

13 years, 255 days

## what is the error of second order of pde...

Maple

restart:

sys:={-diff(v(x,t),t)+0.5*p*diff(u(x,t),x,x)+q*u(x,t)*(u(x,t)^2+v(x,t)^2)=0,diff(u(x,t),t)+0.5*p*diff(v(x,t),x,x)+q*v(x,t)*(u(x,t)^2+v(x,t)^2)=0};
/                      /  2         \
|/ d         \         | d          |
sys := < |--- u(x, t)| + 0.5 p |---- v(x, t)|
|\ dt        /         |   2        |
\                      \ dx         /

/       2          2\       / d         \
+ q v(x, t) \u(x, t)  + v(x, t) / = 0, -|--- v(x, t)|
\ dt        /

/  2         \                                      \
| d          |             /       2          2\    |
+ 0.5 p |---- u(x, t)| + q u(x, t) \u(x, t)  + v(x, t) / = 0 >
|   2        |                                      |
\ dx         /                                      /
eq1 := diff(u(x,t),t) = u__t(x,t):
eq2 := diff(v(x,t),t) = v__t(x,t):

sys_tmp := subs(eq1, eq2, sys):

sys_new := sys_tmp union {eq1, eq2}:

Boundary conditions:
bc :=
u(0,t) = 2,
v(0,t) = 0;
bc := u(0, t) = 2, v(0, t) = 0
Initial conditions:
ic :=
u(x,0) = tanh(2*Pi),
v(x,0) = tanh(2*Pi),
u__t(x,0) = 0,
v__t(x,0) = 0;

ic := u(x, 0) = tanh(2 Pi), v(x, 0) = tanh(2 Pi), u__t(x, 0) = 0,

v__t(x, 0) = 0
Solve the system:
pdsol := pdsolve(subs(p=1, q=0.5, sys_new), {ic, bc}, numeric);

## how to use semilogplot with odeplot...

Maple

Hi all,

how to use semilogplot here

plots[odeplot](res1, [[t, N(t)]], 0.1e-2 .. 1000, axes = boxed, tickmarks = [3, 2], color = red, thickness = 1, linestyle = solid, titlefont = [Helvetica, roman, 18], labeldirections = [horizontal, vertical], labelfont = [Helvetica, roman, 24])

## how to display the output as point value...

Maple

Hi

I forgot how to display the output ar an array i.e. (r,u(r)) (table of data)

I am sure i will find answers here.

a:=-0.1:alpha:=0.2:

dsys:={diff(u(r),r,r)+((1-alpha)/r+r^(alpha-2))*diff(u(r),r)=a};

res1:=dsolve(dsys union {u(0.05)=0,u(1)=0},numeric);

## how this code works?...

Maple

When a and b are from 0 to 1 it works!! but from -1 to -0.05 not i wonder why?

a1:=1.9:alpha:=0.2:
ode1 := diff( y(x), x\$2 ) + x^(-1)* diff( y(x), x )  = 2*a1*(1+x^(2-alpha)/((2-alpha)^2*GAMMA(2-alpha))):
bc1 := y(0)=subs(r=-0.05,a1/4*(r^2-1)), y(-1)=0:
a:=-1:b:=-0.05:
N := 20:h := (b-a)/N:
X := k -> a+k*h:
'X'[k] = X(k):
Yp  := k -> (y[k+1]-y[k-1])/2/((1+alpha)*GAMMA(1+alpha)*h^(alpha)):Ypp := k -> (y[k+1]-2*y[k]+y[k-1])/((2-alpha)*GAMMA(2-alpha)*(h^(2-alpha))^2):
for k from 1 to N-1 do
eq[k] := eval( ode1,
{x=X(k), y(x)=y[k],
diff(y(x),x)=Yp(k),
diff(y(x),x\$2)=Ypp(k)} ):
end do:

eq[0] := y[0] = rhs(bc1[1]):
eq[N] := y[N] = rhs(bc1[2]):
fd_sol1 := fsolve( {seq( eq[k], k=0..N )}, {seq( y[k], k=0..N )} ):
fd_table1 := eval( seq([X(k),y[k]],k=0..N), fd_sol1 ):Matrix([fd_table1]):
infolevel[dsolve] := 3:
#exact_sol1 := combine(dsolve( { ode1, bc1 }, y(x) )):
infolevel[dsolve] := 0:

P1:=plot([fd_table1], x=a..b,color=[black], linestyle = solid, symbolsize=16,axes=boxed);

## how to use dsolve for arbitrary paramete...

Maple

Hi experts in the field of solving complex system of ODE

I have this sytem of var. are  (n(t),u(t),z(t)) with delta and t are (real)

then want to plot 3d n(t) as a function of( t, delta)

restart:assume(delta,real):
phi:=0:lambda:=0.1:N:=5:M:=sqrt(N*(N+1))*exp(I*phi):omegap:=10:
var:={n(t),u(t),z(t)}:
dsys:={diff(n(t),t)=-2*(n(t)-N)+(u(t)-M)*exp(-2*I*omegap*t/lambda)+((z(t)-conjugate(M))*exp(2*I*omegap*t/lambda)),diff(u(t),t)=-2*(1-I*delta)*u(t)+2*(n(t)-N)*exp(2*I*omegap*t/lambda)+2*M,diff((z(t),t))=-2*(1+I*delta)*z(t)+2*(n(t)-N)*exp(-2*I*omegap*t/lambda)+2*conjugate(M)}:
res1:=dsolve(dsys union {n(0)=0,u(0)=0,z(0)=0},numeric,output=listprocedure);

P3:=plots3d(n(t),t=0..1,delta=-10..10,axes=boxed,tickmarks = [3, 2], color = black, thickness = 1, linestyle = solid, titlefont = [Helvetica, roman, 18], labeldirections = [horizontal, vertical], labelfont = [Helvetica, roman, 24]);

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