adel-00

120 Reputation

9 Badges

11 years, 63 days

MaplePrimes Activity


These are replies submitted by adel-00

@tomleslie 

thanks,

how can i calculate the last line which is the summation of L1[n] from -10 to 10

@Carl Love @tomleslie

Thanks for all ur reply

I guess this code need a litle improvement and will work

plsease check thisnew_code.mw

@Carl Love 

you are right about r. 

numerical_int.mw

@Carl Love 

r must be real

that is the main reason i write it down  in if statement 

@Carl Love 

no r has two caes

as:

if N*(N+1)>(delta+Delta-w)^2 then 
r:=sqrt(N*(N+1)-(delta+Delta-w)^2):
elif 
N*(N+1)<(delta+Delta-w)^2 then
r:=sqrt(-(N*(N+1)+(delta+Delta-w)^2)):
end if:

 

and d is from -5 to 5

so if we could make a seq. of points (d, int(L1)) then it would be easy to me to plot Re( int(L1)) agianst d

 

@Carl Love 

if N*(N+1)>(delta+Delta-w)^2 then 
r:=sqrt(N*(N+1)-(delta+Delta-w)^2):
elif 
N*(N+1)<(delta+Delta-w)^2 then
r:=sqrt(-(N*(N+1)-(delta+Delta-w)^2)):
end if:

 

@Carl Love 

L1:=(-2*Cp*z+Cz*x)*f; 

where f depends on w and Cp, Cz depend on (d,w)

@Carl Love 

I totally agree with you.

my concern is: 1) regarding expression (r) I cant dermine whether is it false or true (that the main reson I do it in loop). since (r) has two cases 

2) the expression L1 is dependent on both w and d  (if i remove the do loop).

3) finally i would like to plot Re(gd) agianst (d)

check the code pleaseI do appreciate ur help 

numerical_int.mw

 

@Carl Love 

Thanks Carl

the expressions are too lengthy and depends on w, d that why I did do loop

here some changes in the codenumerical_int.mw

@mmcdara 

Many thanks

@adel-00 

lambda:=0.1:N:=5:M:=sqrt(N(N+1)):omegap:=10:phi:=0:

var:={n(t),u(t)}:
dsys:={diff(n(t),t)=-2*(n(t)-N)+(u(t)-abs(M)*exp(I*phi))*exp(-2*I*omegap*t/lambda)+conjugate((u(t)-abs(M)*exp(I*phi))*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*abs(M)*exp(I*phi)}:
res1:=dsolve(dsys union {n(0)=0,u(0)=0},numeric,output=listprocedure,parameters=[delta]):

    
WV := eval(n(t), res1):

tlo,thi := 0.0, 2.0;
U0lo,U0hi := -10, 10;(m,n) := 51,51;
    
str := time[real]():
M:=Matrix(m,n,datatype=float[8]):
for j from 1 to n do
  u0 := U0lo+(j-1)*(U0hi-U0lo)/(n-1);
  WV(parameters=[delta=u0]);
  for i from 1 to m do
    T := tlo+(i-1)*(thi-tlo)/(m-1);
    try
      M[i,j] := WV(T);
    catch:
      # mostly maxfun complaint for t above some value.
      M[i,j] := Float(undefined);
    end try;
  end do:
end do:
plots:-surfdata(M, tlo..thi, U0lo..U0hi,
                labels=["t","delta","n(t)"]);

 

Found similar to my problem  which explained by Carl

@mmcdara 

thanks

want to plot 3d as (n(t,delta))

@Carl Love 

Thanks very much...

 

@Carl Love 

very usefull

u := proc (x, t) options operator, arrow; gamma1*tanh(2*Pi-t-x) end proc;
v := proc (x, t) options operator, arrow; gamma2*tanh(2*Pi+t+x) end proc;
A := 1/4*(-2*u(x, t)*(diff(v(x, t), x))+2*beta1*u(x, t)*(diff(u(x, t), t, t))+beta2*u(x, t)^2*(u(x, t)^2+v(x, t)^2)-2*alpha1*u(x, t)*(diff(v(x, t), t, t, t))-alpha2*u(x, t)*(u(x, t)^2+v(x, t)^2)*(diff(v(x, t), t))+2*v(x, t)*(diff(u(x, t), x))+2*beta1*v(x, t)*(diff(v(x, t), t, t))+beta2*v(x, t)^2*(u(x, t)^2+v(x, t)^2)+2*alpha1*v(x, t)*(diff(u(x, t), t, t, t))+alpha2*v(x, t)*(u(x, t)^2+v(x, t)^2)*(diff(u(x, t), t))):
            u := (x, t) -> gamma1 tanh(2 Pi - t - x)
            v := (x, t) -> gamma2 tanh(2 Pi + t + x)
Coeffs:= proc(e::algebraic, V::{list,set}(name))
local T, C;
    try C:= coeffs(e, V, T)
    catch "invalid argument":
        C:= coeffs(collect(e, V, ':-distributed'), V, T)
    end try;
    table([T]=~[C])
end proc
:
V:= [gamma1,gamma2,alpha1, alpha2, beta1, beta2]:
C:= Coeffs(A, V):
r1:= add(v*int(C[v], [x= -3..3, t= -10..10], numeric), v= [indices](C, nolist)):


eq1:=(diff(r1,gamma1)):eq2:=(diff(r1,gamma2)):
sol = evalf(solve({eq1, eq2}, {gamma1, gamma2}));

Root_Z.. appear in the sol


Thanks for ue comments

still i got error

``

u := proc (x, t) options operator, arrow; a*tanh(2*Pi-t-x) end proc;
v := proc (x, t) options operator, arrow; b*tanh(2*Pi+t+x) end proc;
A := 1/4*(-2*u(x, t)*(diff(v(x, t), x))+2*beta1*u(x, t)*(diff(u(x, t), t, t))+beta2*u(x, t)^2*(u(x, t)^2+v(x, t)^2)-2*alpha1*u(x, t)*(diff(v(x, t), t, t, t))-alpha2*u(x, t)*(u(x, t)^2+v(x, t)^2)*(diff(v(x, t), t))+2*v(x, t)*(diff(u(x, t), x))+2*beta1*v(x, t)*(diff(v(x, t), t, t))+beta2*v(x, t)^2*(u(x, t)^2+v(x, t)^2)+2*alpha1*v(x, t)*(diff(u(x, t), t, t, t))+alpha2*v(x, t)*(u(x, t)^2+v(x, t)^2)*(diff(u(x, t), t))):

proc (x, t) options operator, arrow; a*tanh(2*Pi-t-x) end proc

 

proc (x, t) options operator, arrow; b*tanh(2*Pi+t+x) end proc

(1)

Coeffs:= proc(e::algebraic, V::{list,set}(name))
local T, C:= coeffs(e, V, T);
    table([T]=~[C])
end proc
:
V:= [a,b,alpha1, alpha2, beta1, beta2]:
C:= Coeffs(A, V):
r1:= add(v*int(C[v], [x= -3..3, t= -10..10], numeric), v= [indices](C, nolist));

Error, (in Coeffs) invalid arguments to coeffs

 

-11.78614736+.6218523429*alpha1-7.805610537*alpha2-7.650147471*beta1+100.4082421*beta2

(2)

``

NULL

``

``


 

Download Carl_code.mwCarl_code.mw

 

@Carl Love 

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