On 4/3/2014 8:34 AM, semiha wrote:
> "Nasser M. Abbasi" wrote in message <lhjmlg$m3p$1@speranza.aioe.org>...
>> On 4/3/2014 7:13 AM, semiha wrote:
>>> hi;
>>> after i run a script, i get exp((t*i)/2 + x*i)  exp((t*i)/2 + x*i)/exp(Im(t)
>>> + 2*Im(x)) in command window. But i know that the result is zero and i
>>> defined x and t are symbolic (x and t are real) Is there easy way to deal with ?
>>> Thanks for help
>>>
>>
>> what is "Im" in the above?
>>
>> EDU>> help Im
>>
>> Im not found.
>>
>
> I can't understand exactly what Im is? Most probably imaginary part of x
>and imaginary part of t ? (but my both x and t are real)
> my code :
>
> clear all
> clc
>
> syms x t
>
> a=1;
> b=2;
> e=1;
> f=1;
> c=real(sqrt((efi*b)^2+4*(a)^2))
> d=imag(sqrt((efi*b)^2+4*(a)^2))
>
> g=(2*a*b)/((b)^2+(c)^2)
> n=(2*a*c)/((b)^2+(c)^2)
> m=d/b
>
>
> l=d*x(b*c+(e+f)*d)*(t/2);
> k=c*x((e+f)*cb*d)*(t/2);
>
> psi=(a+(b*(g*cosh(l)+cos(k))/cosh(l)+g*cos(k))+(i*b*(n*sinh(l)+m*sin(k))/cosh(l)+g*cos(k)))*exp(i*(e*x+(a^2(e^2/2))*t));
>
>
> h= (1/2)* diff(psi,x,2)
> s= i*diff(psi,t)
> y= abs(psi).^2 * psi
>
> son=h+s+y
>
That is strange. I run your code on Matlab 2013a and I do not see Im, I see imag:
son =
exp((t*i)/2 + x*i)  exp( imag(t)  2*imag(x))*exp((t*i)/2 + x*i)
Must be different version of Matlab
Try Steve suggestion, use:
x = sym('x','real');
t = sym('t','real');
now I get
son=0
