Ask Your Question

Revision history [back]

taylor series of expression involving modulus of a complex expression

Hi folks, consider the following

tt=abs(-cos(w)^2 + 2Icos(w)sin(w) + sin(w)^2 + 2.8cos(w) - 2.8Isin(w) - 1.8)

tt.taylor(w,0.1,1) this doesn't work

ttt=-cos(w)^2 + 2Icos(w)sin(w) + sin(w)^2 + 2.8cos(w) - 2.8Isin(w) - 1.8 lttt=sqrt(ttt.real()2+ttt.imag()2) lttt.taylor(w,0.1,3). #this works!

So as you can see I have two mathematically equivalent expressions, tt and lttt, but sage is not able to directly find the Taylor series of the first. Is there a way to convince sage to do this correctly?

taylor series of expression involving modulus of a complex expression

Hi folks, consider Consider the following

tt=abs(-cos(w)^2

tt = abs(-cos(w)^2 + 2Icos(w)sin(w) 2*I*cos(w)*sin(w) + sin(w)^2 + 2.8cos(w) 2.8*cos(w) - 2.8Isin(w) 2.8*I*sin(w) - 1.8) 

tt.taylor(w,0.1,1) 1.8) # tt.taylor(w, 0.1, 1) # this doesn't work

ttt=-cos(w)^2 work ttt = -cos(w)^2 + 2Icos(w)sin(w) 2*I*cos(w)*sin(w) + sin(w)^2 + 2.8cos(w) 2.8*cos(w) - 2.8Isin(w) 2.8*I*sin(w) - 1.8 lttt=sqrt(ttt.real()2+ttt.imag()2) lttt.taylor(w,0.1,3). #this works!

lttt = sqrt(ttt.real()**2 + ttt.imag()**2) lttt.taylor(w, 0.1, 3) # this works!

So as you can see I have two mathematically equivalent expressions, tt tt and lttt, lttt, but sage Sage is not able to directly find the Taylor series of the first. first.

Is there a way to convince sage Sage to do this correctly? correctly?

taylor series of expression involving modulus of a complex expression

Consider the following

tt = abs(-cos(w)^2 + 2*I*cos(w)*sin(w) + sin(w)^2 + 2.8*cos(w) - 2.8*I*sin(w) - 1.8)
# tt.taylor(w, 0.1, 1)   # this doesn't work
ttt = -cos(w)^2 + 2*I*cos(w)*sin(w) + sin(w)^2 + 2.8*cos(w) - 2.8*I*sin(w) - 1.8
lttt = sqrt(ttt.real()**2 + ttt.imag()**2)
lttt.taylor(w, 0.1, 3)  # this works!

So as you can see I have two mathematically equivalent expressions, tt and lttt, but Sage is not able to directly find the Taylor series of the first.

Is there a way to convince Sage to do this correctly?

taylor series of expression involving modulus of a complex expression

Consider the following

tt sage: w = abs(-cos(w)^2 + 2*I*cos(w)*sin(w) + sin(w)^2 + 2.8*cos(w) - 2.8*I*sin(w) - 1.8)
tt.taylor(w, 0.1, 1)   # this doesn't work
ttt SR.var('w')
sage: a = -cos(w)^2 + 2*I*cos(w)*sin(w) + sin(w)^2 + 2.8*cos(w) - 2.8*I*sin(w) - 1.8
lttt 
sage: b = sqrt(ttt.real()**2 abs(a)
sage: b.taylor(w, 0.1, 1)  # not the answer I expected!
-(0.8150178993589604 + ttt.imag()**2)
lttt.taylor(w, 0.178042614591617*I)*w
+ 0.16258427059001673 + 0.0178042614591617*I

sage: c = sqrt(b.real()**2 + b.imag()**2)
sage: c.taylor(w, 0.1, 3)  # this works!
works as expected!
1.002855497443298*(w - 0.1)^3
+ 0.3184495453305423*(w - 0.1)^2
+ 0.8322931797904074*w
- 0.002146837324920048

So as you can see I have two mathematically equivalent expressions, ttb and ltttc, but Sage is not able to directly find the Taylor series of the first.

Is there a way to convince Sage to do this correctly?