complex number : real part and imaginary part
Show older comments
syms x mu
syms t %c
alpha=1
U=zeros(1,1,'sym');
A=zeros(1,1,'sym');
B=zeros(1,1,'sym');
C=zeros(1,1,'sym');
D=zeros(1,1,'sym');
series1(x,t)=sym(zeros(1,1));
%%%%%%%%%%%%%%%%%%%%% initial condition
%mu=1
%U(1)=mu*exp(1i*x)
U(1)=mu*(cos(x)+1i*sin(x))
u=conj(U(1))
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for i=1
A(1)=0;
B(1)=0;
C(1)=0;
D(1)=0;
for j=1:i
for k=1:j
A(1)=A(1)+U(k)*U(j-k+1)*U(i-j+1);
B(1)=B(1)+U(k)*diff(U(j-k+1),x,1)*conj(U(i-j+1));
C(1)=C(1)+U(k)*U(j-k+1)*diff(U(i-j+1),x,1);
for l=1:k
for m=1:l
D(1)=D(1)+U(m)*U(l-m+1)*U(k-l+1)*conj(U(j-k+1))*conj(U(i-j+1));
end
end
end
end
U(i+1)=gamma(((i-1)*alpha)+1)/gamma((alpha*(i+1-1))+1)*(1i*diff(U(k),x,2)+2i*B(1)*2i*C(1)+i*D(1));
end
for k=1:2
series1(x,t)=simplify(series1(x,t)+U(k)*(power(t,(k-1)*alpha)));
%series2(x,t)=simplify(series2(x,t)+V(k)*(power(t,(k-1)*alpha)));
end
expand(series1);
m=real(expand(series1))
the last line does display real and imaginary part of the series
6 Comments
Torsten
on 3 Dec 2024
What is your question ?
yogeshwari patel
on 3 Dec 2024
Torsten
on 3 Dec 2024
Which of your symbolic constants x, mu and t are complex, which are real ?
Walter Roberson
on 3 Dec 2024
imag(mu*t*cos(x))
None of mu, t, or x have been declared as being real-valued, so MATLAB cannot predict the imaginary component of mu*t*cos(x)
yogeshwari patel
on 3 Dec 2024
By default, all symbolic variables are assumed to be of type complex.
Accepted Answer
More Answers (0)
Categories
Find more on Image Arithmetic in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!