## 135 Reputation

13 years, 243 days

## IVP of 3 EQS u(t), v(t), w(t)...

Maple 15

I seperate the variables in Real and Imigneray parts,  as follows:

restart:
Dijits:=20:
------------------------- Defining the nature of the variables used ----------------------
assume(t,real):

x(0):=-1:y(0):=1:z(0):=conjugate(y(0)):N:=10:Delta:=5:omega:=10^(6):N1:=1+2*N:M:=sqrt(N*(N+1)):
t0:=0.0:tN:=30.0: M1:=5000;:th:=evalf((tN-t0)/M1):
5000
ini1:=u(0)=Re(y(0)), v(0)=Im(z(0)),w(0)=x(0);
u(0) = 1, v(0) = 0, w(0) = -1
var:={u(t),v(t),w(t)}:
dsys1 :=diff(w(t),t)=-(N1+M*cos(2*omega*t))*w(t)-1+2*u(t)*cos(2*omega*t)+2*v(t)*sin(2*omega*t), diff(u(t),t)=-N1*u(t)+Delta*v(t)-2*M+(2*M*u(t)-N1-w(t))*cos(2*omega*t)-2*M*v(t)*sin(2*omega*t), diff(v(t),t)=-N1*v(t)-Delta*u(t)-2*M+(2*M*u(t)-N1-w(t))*sin(2*omega*t)+2*M*v(t)*cos(2*omega*t):
dsol1 :=dsolve({dsys1,ini1},var,numeric, output=listprocedure, abserr=1e-9, relerr=1e-8,range=0..1,maxfun=5000):
Warning, cannot evaluate the solution further right of .46544244e-3, maxfun limit exceeded (see ?dsolve,maxfun for details)
dsolu:=subs(dsol1,u(t)):dsolv:=subs(dsol1,v(t)):dsolw:=subs(dsol1,w(t)):
t1:=array(0..M1,[]): u1:=array(0..M1,[]): v1:=array(0..M1,[]): w1:=array(0..M1,[]): pt1:=array(0..M1,[]):pt2:=array(0..M1,[]):pt3:=array(0..M1,[]):
for i from 0 to M1 do t1[i]:=evalf(th*i):u1[i]:=evalf(dsolu(t1[i]));v1[i]:=evalf(dsolv(t1[i])):w1[i]:=evalf(dsolw(t1[i])):pt1[i]:=[t1[i],u1[i]]:pt2[i]:=[t1[i],v1[i]]:pt3[i]:=[t1[i],w1[i]]:od:
Error, (in dsolu) cannot evaluate the solution further right of 0.46544244e-3, maxfun limit exceeded (see ?dsolve,maxfun for details)

with(plots):
unassign('i'):mytab1:=[seq(pt1[i],i=0..M1)]:mytab2:=[seq(pt2[i],i=0..M1)]:mytab3:=[seq(pt3[i],i=0..M1)]:
plot(mytab3,t=0..5,tickmarks=[6, 6],axes=boxed);

but I got an error

## How to solve complex-valued IVP?...

Maple

Hi experts,

attached the following code,, but i dont know what is the wrong with it, looking forward for helpful advise.

dsys :={diff(u(t),t)=-(N1+M*cos(2*I*omega*t))*u(t)-1+v(t)*exp(-2*I*omega*t)+w(t)*exp(2*I*omega*t), diff(v(t),t)=-(N1+I*Delta-2*M*exp(2*I*omega*t))*v(t)-(N1+u(t))*exp(2*I*omega*t)-2*M, diff(w(t),t)=-(N1-I*Delta-2*M*exp(-2*I*omega*t))*w(t)-(N1+u(t))*exp(-2*I*omega*t)-2*M}:
res:=dsolve(dsys union {u(0)=-1,v(0)=0,w(0)=0},numeric,output=listprocedure,maxfun=0):
plots[odeplot](res,[[t,(Re(w(t)))]],0..10,axes=boxed,titlefont=[SYMBOL,14],font=[1,1,18],color=black,linestyle=1,tickmarks=[3, 4],font=[1,1,14],thickness=2,titlefont=[SYMBOL,12]);
Warning, computation interrupted

## Warning in dsolve,numeric...

Maple

Hi all,

restart;#part1
epsilon:=5:Delta1:=2:Delta2:=-4: N1:=1000:
dsys :={diff(x(t),t)=-I*Delta1*x(t)+y(t)+epsilon, diff(y(t),t)=-I*Delta2*y(t)+x(t)*z(t), diff(z(t),t)=-2*(conjugate(x(t))*y(t)+conjugate(y(t))*x(t))};

res:=dsolve(dsys union {x(0)=2*I,y(0)=0,z(0)=1},numeric,output=listprocedure);

P1:=plots:-odeplot(res,[[t,Im(y(t))],[t,Re(x(t))]],0..2):

/ d
{ --- x(t) = -2 I x(t) + y(t) + 5,
\ dt

d
--- y(t) = 4 I y(t) + x(t) z(t),
dt

d ____ ____ \
--- z(t) = -2 x(t) y(t) - 2 y(t) x(t) }
dt /
tit:=sprintf("D1=%g,D2=%g",Delta1,Delta2);
"D1=2,D2=-4"
plots[odeplot](res,[[t,Im(y(t))]],0..200,axes=boxed,titlefont=[SYMBOL,14],font=[1,1,18],color=black,linestyle=1,tickmarks=[3, 4],font=[1,1,14],thickness=2,titlefont=[SYMBOL,12]);
Warning, cannot evaluate the solution further right of 90.013890, maxfun limit exceeded (see ?dsolve,maxfun for details)

when I increase the time give this msn:

Warning, cannot evaluate the solution further right of 90.013890, maxfun limit exceeded (see ?dsolve,maxfun for details)

## Real and Imaginary of an expression ...

Maple 15

Hi,

I got the Real and Imaginary of an expression J1

assume(d,real):

Gamma:=0.04:tau:=10*Pi:j:=0:

J1:=(exp((1-I*d)*Gamma*tau)-1)/((1-I*d));

J1mod:=simplify((Re(J1))^2+(Im(J1))^2): (I works here this amont is real)

################

but when I change the expression  for J1 to be

J1:=((2*e^(-2^(-j-1)*(1-I*d))-e^(-2^(-j)*(1-I*d))-1)*exp((1-I*d)*Gamma*tau)-1)/((1-I*d)):

J1mod:=simplify((Re(J1))^2+(Im(J1))^2):

J1mod here is complex(I dont know why? it doesnt separate the real and the im )

Thanks

## Solve IVP with complex coefficients...

Maple

Solve IVP with complex coef. with compplex varables numerically..

the sys. is x'=-iDelta1x(t)+y(t)+epsilon

y'=-iDelta2y(t)+x(t)z(t)

z'=-2(x*(t)y(t)+x(t)y*(t)), where * means complex conjugate

I solve it as:

epsilon:=5:Delta1:=4:Delta2:=4:assume(z(t),real):

var:={x_R(t),y_R(t),z_R(t),x_I(t),y_I(t),z_I(t)}:
dsys :={diff(x(t),t)=-I*Delta1*x(t)+y(t)+epsilon, diff(y(t),t)=-I*Delta2*y(t)+x(t)*z(t), diff(z(t),t)=-2*(conjugate(x(t))*y(t)+conjugate(y(t))*x(t))}:
functions := indets(dsys, anyfunc(identical(t))):
redefinitions := map(f -> f = cat(op(0, f), _R)(t) + I*cat(op(0,f), _I)(t), functions):
newsys := map(evalc @ Re, redefinitions) union map(evalc @ Im, redefinitions):

incs := {x_R(0)=0, x_I(0)=0, y_R(0)=0, y_I(0)=0,z_R(0)=-1/2, z_I(0)=0}:
dsol1 :=dsolve({newsys,incs},var,numeric, output=listprocedure, abserr=1e-9, relerr=1e-8,range=0..1):

but it seems there is not runing propebly

 First 7 8 9 10 11 12 13 Page 9 of 13
﻿