adel-00

135 Reputation

9 Badges

13 years, 317 days

MaplePrimes Activity


These are answers submitted by adel-00

the first ex:

plot3d([(x^2+y^2)^(1/2),1],x=-5..5,y=-10..10);

It is easier to run it in matlab as:

x=....

y=....

Bar(x,y)

If we run The same programe for 

theta:=Pi/3: and Phi:=Pi:

It takes long long time with no result.

Thanks

the above programme works for theta:=0:phi:=0:

setting other values for theta and Phi for example

theta:=Pi/3:phi:=Pi:

takes very long time then I stope it 

Many many thanks.

It's take 26 min. but the result is perfect.

One more thing, regarding theta:=0:phi:=0: other than zero the programme currapted.

Best Regards

restart:
>
------------------------- Defining the nature of the variables used ----------------------
assume(d,real):Digits:=25:n:=1:tau:=Pi:
theta:=0:phi:=0:
lambda:=n;Omega:=1:Gamma:=0.01:
1

J1

term1:=simplify(exp((Gamma+I*d)*tau)-1)/(2*(Gamma+I*d)):
Ak1:=d->(exp((Gamma+I*(d+0.5*Omega-2*lambda*k/Gamma))*tau)-1)/(Gamma+I*(d+0.5*Omega-2*lambda*k/Gamma))+(exp((Gamma+I*(d-0.5*Omega+2*lambda*k/Gamma))*tau)-1)/(Gamma+I*(d-0.5*Omega+2*lambda*k/Gamma)):
Ak2:=d->(exp((Gamma+I*(d-0.5*Omega-2*lambda*k/Gamma))*tau)-1)/(Gamma+I*(d-0.5*Omega-2*lambda*k/Gamma))+(exp((Gamma+I*(d+0.5*Omega+2*lambda*k/Gamma))*tau)-1)/(Gamma+I*(d+0.5*Omega+2*lambda*k/Gamma)):
#term2:=(evalf(-0.25*sum(BesselJ(k,Omega*Gamma/(4*n))*Ak1(d)+BesselJ(k,-(Omega*Gamma)/(4*n))*Ak2(d),k=0..50))):
term2:=(evalf(-0.25*add(BesselJ(k,Omega*Gamma/(4*n))*Ak1(d)+BesselJ(k,-(Omega*Gamma)/(4*n))*Ak2(d),k=0..50))):
J1:=(term1+term2):
J1mod:=(Re(J1))^2+(Im(J1))^2:
###### J2#########################
Ak1:=d->(exp((Gamma+I*(d+0.5*Omega-2*lambda*k/Gamma))*tau)-1)/(Gamma+I*(d+0.5*Omega-2*lambda*k/Gamma))-(exp((Gamma+I*(d-0.5*Omega+2*lambda*k/Gamma))*tau)-1)/(Gamma+I*(d-0.5*Omega+2*lambda*k/Gamma)):
Ak2:=d->(exp((Gamma+I*(d-0.5*Omega-2*lambda*k/Gamma))*tau)-1)/(Gamma+I*(d-0.5*Omega-2*lambda*k/Gamma))-(exp((Gamma+I*(d+0.5*Omega+2*lambda*k/Gamma))*tau)-1)/(Gamma+I*(d+0.5*Omega+2*lambda*k/Gamma)):

J2:=(evalf(-0.25*add(BesselJ(k,Omega*Gamma/(4*n))*Ak1(d)+BesselJ(k,-Omega*Gamma/(4*n))*Ak2(d),k=0..100))):
######################

J2mod:=(Re(J2))^2+(Im(J2))^2:
J3 same as J1differ in sign
term1:=(exp((Gamma+I*d)*tau)-1)/(2*(Gamma+I*d)):
Ak1:=d->(exp((Gamma+I*(d+0.5*Omega-2*lambda*k/Gamma))*tau)-1)/(Gamma+I*(d+0.5*Omega-2*lambda*k/Gamma))+(exp((Gamma+I*(d-0.5*Omega+2*lambda*k/Gamma))*tau)-1)/(Gamma+I*(d-0.5*Omega+2*lambda*k/Gamma)):
Ak2:=d->(exp((Gamma+I*(d-0.5*Omega-2*lambda*k/Gamma))*tau)-1)/(Gamma+I*(d-0.5*Omega-2*lambda*k/Gamma))+(exp((Gamma+I*(d+0.5*Omega+2*lambda*k/Gamma))*tau)-1)/(Gamma+I*(d+0.5*Omega+2*lambda*k/Gamma)):
term2:=(evalf(0.25*add(BesselJ(k,Omega*Gamma/(4*n))*Ak1(d)+BesselJ(k,-Omega*Gamma/(4*n))*Ak2(d),k=0..100))):
J3:=term1+term2:
J3mod:=(Re(J3))^2+(Im(J3))^2:
J4 same as J2 but -0.25-->2


J4:=-2*J2:
######################

J4mod:=(Re(J4))^2+(Im(J4))^2:

calculate the spectrum

 

Spec:= unapply(exp(-2*Gamma*tau)*(J1mod*cos(theta/2)^2+J2mod+J3mod*sin(theta/2)^2-0.5*Re(J3*J4*sin(theta)*exp(I*phi))+0.5*Re(J1*J4*sin(theta)*exp(-I*phi))),d):
#Spec:=d->(exp(-2*Gamma*tau)*(J1mod*cos(theta/2)^2+J2mod+J3mod*sin(theta/2)^2-0.5*Re(J3*J4*sin(theta)*exp(I*phi))+0.5*Re(J1*J4*sin(theta)*exp(-I*phi)))):

with(plots):

tit:=sprintf("l=%g,W=%g,G=%g",lambda,Omega,Gamma):
#Smax1:=maximize(Spec(d),d=-10..10):
P1:=plot(Spec,-10..10,axes=boxed,title=tit,color=black,font=[2,3,18],thickness=2,tickmarks=[3,3],titlefont=[SYMBOL,14],font=[1,1,18],linestyle=1):
Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct
Normalize:= proc(P::specfunc(anything, PLOT))
local A,Smax1;
A:= op([1,1], P);
Smax1:= max(A[..,2]);
if A::list then A:= Matrix(A) end if;
A[..,2]:= A[..,2]/Smax1;
subsop([1,1]= A, P)
end proc:

P1:= Normalize(P1):


for k from 2 to 5 do
tau:= k*Pi;
P||k:= plot(Spec,-10..10,axes=boxed,title=tit,color=black,font=[2,3,18],thickness=2,tickmarks=[3,3],titlefont=[SYMBOL,14],font=[1,1,18],linestyle=1);
P||k:= plottools:-translate(Normalize(P||k), 0, k-1)
od:

display([P||(1..5)]);

Im realy sorry, the above programme that I run gives me repeated plot of P1..

Can't anderstand but I believe you are right and the figure you produce is ok..

but tell me do I have to run once atime or what?

try this:

with(plots):plot(3*exp(-x)*x-exp(-x)-1.5*exp(-x)*(x^2)+exp(-x)*(x^2)*log(x),x=0..9,y=-1..0.6);

thanks kamel this is it still i need ur help on:

1) how can i get rid of the spaces between column.

2) I have two function in one graph for exaple

f3 := (2*n) -> (2*n)!*(lambda)^(n)/(((n)!^2)*2^(2*n)*(lambda+1)^(n+0.5)); (even number)

and

f4:=(2*n+1) -> 0; (odd number)

how do I plot f3 and f4 as column graph in one graph ( at n=1 ,3,5,7.. the column be zero )and n=2,4,... the the coumn has a value)

i.e the column for the odd nember be zero and the even numbers of (n) be the function f3

please 

Page 1 of 1