complex number : real part and imaginary part
49 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
yogeshwari patel
el 3 de Dic. de 2024 a las 9:08
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
Respuesta aceptada
Walter Roberson
el 3 de Dic. de 2024 a las 11:00
syms x mu real
syms t real %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));
disp(char(m))
0 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!