For Programmers: Free Programming Magazines  


Home > Archive > Mathematica > March 2006 > Re: Bug with Series- help wanted









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Bug with Series- help wanted
David W. Cantrell

2006-03-31, 8:05 am

"GidiL" <gidienator@gmail.com> wrote:
> Hello all!
>
> I would really appreciate some help.
>
> Mathematica has a built-in function called Series:
> Series[x,x_0,n],


I suspect you meant to say something like Series[f, {x, x_0, n}].

> which allows to expand functions into power series where x is the
> variable, x_0 is the point about which we expand, and n is the desired
> order of expansion.
>
> It also allows x_0 to be infinity, which is very useful when one needs
> multiple expansion (as in gravitational waves and electromagnetic
> radiation).
>
> Although is allows to expand series in terms of 1/x and writes O(1/x)
> (and its powers) in the output, it does not allow this to be entered in
> the input. To convince yourselves, try it out. Enter in the input,
> e.g., 1+ 1/r+ (O(1/r))^2, and it will tell you that 1/r is not a
> variable.


Cutting and pasting the above input, my Mathematica didn't tell me that.
Rather, it gave

In[1]:= 1+ 1/r+ (O(1/r))^2

Out[1]= 1 + O^2/r^2 + 1/r

But that's really beside the point. See below for what you need.

> If, on the other hand, you entered:
> In=Series[1/(r+1), {r, Infinity,3}]//Simplify
> you will get
> Out=1/r-(1/r)^2+(1/r)^3+(O(1/r))^4
>
> which shows that the output is possible, but the input is impossible.


The output above is not what it naively appears to be. To see that, and to
see how you'd need to input such a thing, just convert it to InputForm.

In[2]:= Series[1/(r + 1), {r, Infinity, 3}]//InputForm

Out[2]//InputForm= SeriesData[r, Infinity, {1, -1, 1}, 1, 4, 1]

You might then want to look at the documentation for SeriesData.


To enter the expression you mentioned earlier, you'd just use

SeriesData[r, Infinity, {1, 1}, 0, 2, 1]

David

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com