Terms in series expansion

19 views
Skip to first unread message

Gaurav Sathe

unread,
Mar 14, 2012, 10:04:52 AM3/14/12
to sy...@googlegroups.com
I'm a little confused with the .series method. 

In [8]: sin(x).series(x,0,10)
Out[8]:
        3        5         7             9             
      x        x         x             x              
x - ── + ─── - ──── + ────── + O(x**10)
      6      120     5040       362880           

In [9]: cos(x).series(x,0,10)
Out[9]: 
        2       4       6           8            
      x       x       x           x             
1 - ── + ── - ─── + ───── + O(x**10)
      2      24    720      40320           

From this it seems that .series(x,point,n) calculates the series expansion of f(x) till the nth exponent of x...

But,
In [17]: exp(x**2).series(x,0,10)
Out[17]: 
                4       6       8        10      12         14          16             18             
        2    x       x       x        x        x           x            x              x               
1 + x  + ── + ── + ── + ─── + ─── + ──── + ───── + ────── + O(x**20)
              2       6     24      120     720      5040       40320      362880           

This doesnt seem to match up... Does the parameter 'n' mean 'the no of terms in the series expansion' or ' the last exponent of x in the expansion'  ?
 



Sai Nikhil

unread,
Mar 14, 2012, 10:14:42 AM3/14/12
to sy...@googlegroups.com
parameter 'n' was written to imply last exponent of 'x' in the expansion, I guess

but, in second case, exp(x**2) = exp(v), where v = x**2 and so, exp(v) is calculated till, v**9 and substituting, v=x**2, we are getting the above result.

this is obviously supposed to be an issue, and if Mr.Aaron permits, I'll try to submit a suitable patch for this ...


-thanks ,


1

Rhythm Gupta

unread,
Mar 14, 2012, 10:41:14 AM3/14/12
to sy...@googlegroups.com
Hi, I think it this way,
If you will use
f(m).series(x,0,n) , where m is a function of x.
then it will return the series till the nth power of m.(#not x)

On Wed, Mar 14, 2012 at 7:34 PM, Gaurav Sathe <gaurav....@gmail.com> wrote:
I'm a little confused with the .series method. 

In [8]: sin(x).series(x,0,10)
Out[8]:
        3        5         7             9             
      x        x         x             x              
x - ── + ─── - ──── + ────── + O(x**10)
      6      120     5040       362880           

 
In [9]: cos(x).series(x,0,10)
Out[9]: 
        2       4       6           8            
      x       x       x           x             
1 - ── + ── - ─── + ───── + O(x**10)
      2      24    720      40320           

From this it seems that .series(x,point,n) calculates the series expansion of f(x) till the nth exponent of x...

In both of the above cases, x==m.Hence it appears that it calculates the series expansion of f(x) till the nth exponent of x.

 
But,
In [17]: exp(x**2).series(x,0,10)
Out[17]: 
                4       6       8        10      12         14          16             18             
        2    x       x       x        x        x           x            x              x               
1 + x  + ── + ── + ── + ─── + ─── + ──── + ───── + ────── + O(x**20)
              2       6     24      120     720      5040       40320      362880           

This doesnt seem to match up... Does the parameter 'n' mean 'the no of terms in the series expansion' or ' the last exponent of x in the expansion'  ?
 


Thanks
Rhythm Gupta
 

--
You received this message because you are subscribed to the Google Groups "sympy" group.
To view this discussion on the web visit https://groups.google.com/d/msg/sympy/-/iPZ8Z-N8jH0J.
To post to this group, send email to sy...@googlegroups.com.
To unsubscribe from this group, send email to sympy+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sympy?hl=en.

krastano...@gmail.com

unread,
Mar 14, 2012, 10:45:28 AM3/14/12
to sy...@googlegroups.com
Is this in the current master branch or an old version?

I get this:
In [1]: exp(x**2).series(x,0,10)
Out[1]:

4 6 8
2 x x x ⎛ 10⎞
1 + x + ── + ── + ── + O⎝x ⎠
2 6 24

And it seems correct.

Gaurav Sathe

unread,
Mar 14, 2012, 11:27:45 AM3/14/12
to sy...@googlegroups.com
Thnx... I was thinking of the same logic which u have said... but then how do we explain the below series expansion:

>>> (sin(x)/x**10).series(x,0,10)
   1                   1        1            1                1          
──────── + ── - ──── + ────── - ─────── + O(1)
362880⋅x            9         7               5               3       
                       x      6⋅x         120⋅x        5040⋅x        


Do we say that it is like dividing each term of the sin(x) series by x**10 ?

-Gaurav

 

--
You received this message because you are subscribed to the Google Groups "sympy" group.
To post to this group, send email to sy...@googlegroups.com.
To unsubscribe from this group, send email to sympy+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sympy?hl=en.



--
Gaurav Sathe
-Student at BITS Pilani - Goa Campus


Rhythm Gupta

unread,
Mar 14, 2012, 11:32:15 AM3/14/12
to sy...@googlegroups.com
I think Yes.

krastano...@gmail.com

unread,
Mar 14, 2012, 11:41:49 AM3/14/12
to sy...@googlegroups.com
Again, this is not what I get in the current master branch:

In [1]: (sin(x)/x**10).series(x,0,10)
Out[1]:

3 5
1 1 1 1 1 x x x
── - ──── + ────── - ─────── + ──────── - ──────── + ────────── - ────────────
9 7 5 3 362880⋅x 39916800 6227020800 130767436800


x 6⋅x 120⋅x 5040⋅x

7 9
x x ⎛ 10⎞
─ + ─────────────── - ────────────────── + O⎝x ⎠
0 355687428096000 121645100408832000


It works as expected. Can you check which version of sympy you are
actually using? Is it the master branch or a released version?

Reply all
Reply to author
Forward
0 new messages