Discussion:
How to get the real and imaginary parts of a power series?
(too old to reply)
Gordon Smith
2007-08-10 06:07:40 UTC
Permalink
Suppose s = Series[Cosh[(x + I y)u, {u,0,2}]. How can I get the real part 1 + 1/2(x^2 - y^2) u^2 + O(u^3) and the imaginary part x y u^2 + O(u^3) ? I thought ComplexExpand[Re[s]] should give me the real part of s, but it just gives me s unchanged. (Mathematica newbie here!)
Jean-Marc Gulliet
2007-08-10 10:37:55 UTC
Permalink
Post by Gordon Smith
Suppose s = Series[Cosh[(x + I y)u, {u,0,2}]. How can I get the real part 1 + 1/2(x^2 - y^2) u^2 + O(u^3) and the imaginary part x y u^2 + O(u^3) ? I thought ComplexExpand[Re[s]] should give me the real part of s, but it just gives me s unchanged. (Mathematica newbie here!)
You are almost there: apply *Normal* to your series (a series data
object, indeed) and then Re or Im followed by ComplexExpand.

In[1]:= s = Series[Cosh[(x + I y) u], {u, 0, 2}]

Out[1]=
2
(x + I y)
SeriesData[u, 0, {1, 0, ----------}, 0, 3, 1]
2

In[2]:= ComplexExpand[Re[***@s]]

Out[2]=
2 2 2 2
u x u y
1 + ----- - -----
2 2

In[3]:= ComplexExpand[Im[***@s]]

Out[3]=
2
u x y
--
Jean-Marc
Jaccard Florian
2007-08-10 10:41:02 UTC
Permalink
Hello Gordon,

I think the problem is because of O(u^3) which makes it difficult to do
further job with s.

This works fine, but there is no O(u^3) anymore written :

Clear[s]
s = Normal[Series[Cosh[(x + I*y)*u], {u, 0, 2}]]

ComplexExpand[s]


Regards

Florian Jaccard

-----Message d'origine-----
De=A0: Gordon Smith [mailto:***@hotmail.com]
Envoy=E9=A0: vendredi, 10. ao=FBt 2007 07:53
=C0=A0: ***@smc.vnet.net
Objet=A0: How to get the real and imaginary parts of a power series?

Suppose s = Series[Cosh[(x + I y)u, {u,0,2}]. How can I get the real
part 1 + 1/2(x^2 - y^2) u^2 + O(u^3) and the imaginary part x y u^2 +
O(u^3) ? I thought ComplexExpand[Re[s]] should give me the real part of
s, but it just gives me s unchanged. (Mathematica newbie here!)
Jens-Peer Kuska
2007-08-10 10:47:10 UTC
Permalink
Hi,

try

ComplexExpand[Re[s] // Normal]

Regards
Jens
Post by Gordon Smith
Suppose s = Series[Cosh[(x + I y)u, {u,0,2}]. How can I get the real part 1 + 1/2(x^2 - y^2) u^2 + O(u^3) and the imaginary part x y u^2 + O(u^3) ? I thought ComplexExpand[Re[s]] should give me the real part of s, but it just gives me s unchanged. (Mathematica newbie here!)
dimitris
2007-08-11 06:01:33 UTC
Permalink
Post by Gordon Smith
Suppose s = Series[Cosh[(x + I y)u, {u,0,2}]. How can I get the real part 1 + 1/2(x^2 - y^2) u^2 + O(u^3) and the imaginary part x y u^2 + O(u^3) ? I thought ComplexExpand[Re[s]] should give me the real part of s, but it just gives me s unchanged. (Mathematica newbie here!)
Since you are a newbie, the folowing will be very useful.

Say,

In[46]:=
o=Series[f[x],{x,0,3}];

Then note the interpetation of this expression

In[50]:=
o//FullForm

Out[50]//FullForm=
SeriesData[x,0,List[f[0],Derivative[1][
f][0],Times[Rational[1,2],Derivative[2][f][0]],Times[Rational[
1,6],Derivative[3][f][0]]],0,4,1]

Understanding this structure is essential to figure out the solution
below:

In[57]:=
s = Series[Cosh[(x + I*y)*u], {u, 0, 6}]

Out[57]=
SeriesData[u, 0, {1, 0, (x + I*y)^2/2, 0, (x + I*y)^4/24, 0, (x +
I*y)^6/720}, 0, 7, 1]

In[53]:=
(ComplexExpand[#1[Normal[s]]] + SeriesData[u, 0, {}, s[[5]], s[[5]],
1] & ) /@ {Re, Im}

Out[53]=
{SeriesData[u, 0, {1, 0, x^2/2 - y^2/2, 0, x^4/24 - (x^2*y^2)/4 +
y^4/24, 0, x^6/720 - (x^4*y^2)/48 + (x^2*y^4)/48 - y^6/720}, 0, 7, 1],
SeriesData[u, 0, {x*y, 0, (x^3*y)/6 - (x*y^3)/6, 0, (x^5*y)/120 -
(x^3*y^3)/36 + (x*y^5)/120}, 2, 7, 1]}

Cheers
Dimitris
Murray Eisenberg
2007-08-11 06:12:45 UTC
Permalink
To avoid my getting thoroughly confused, let me change your variable u,
presumably intended to be complex, to z = u + I v where u and v are real.

Then will this do? The key seems to be to use Normal to get rid of the
SeriesData wrapper first. And in any case you won't see the real part
unless you somehow specify the u+I v form of the complex z, as otherwise
ComplexExpand will assume that z is real.

s = Series[Cosh[(x + I y) z], {z, 0, 2}];
ComplexExpand[***@Normal[s /. z -> u + I v]]
1 + (u^2*x^2)/2 - (v^2*x^2)/2 - 2*u*v*x*y - (u^2*y^2)/2 + (v^2*y^2)/2
Post by Gordon Smith
Suppose s = Series[Cosh[(x + I y)u, {u,0,2}]. How can I get the real part 1 + 1/2(x^2 - y^2) u^2 + O(u^3) and the imaginary part x y u^2 + O(u^3) ? I thought ComplexExpand[Re[s]] should give me the real part of s, but it just gives me s unchanged. (Mathematica newbie here!)
--
Murray Eisenberg ***@math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2859 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305
Continue reading on narkive:
Loading...