0
$\begingroup$

Suppose I have such function in terms of variable $r$.

func[r_] := r^2 (1 - r^(1 - k) r0)^(2/k - 1) ((r^k - r r0)^2/((r^k - r r1) (r^k - r r2)))^(1/(1 - n));

Then I want to get series expansion in $r$ up to some order. I use

Series[func[r], {r, 0, 2}]

but result is not appropriate.

Moreover, I would like to get expansion in terms of $1/r$, so I define my variable $r$ in terms of another variable $y$ as

r:=1/y;

Then again, when I use Series result is not appropriate.

Is there any way to get series expansion for complicated functions (with powers) in Mathematica?

EDIT: I've tried to use

Assuming[{k \[Element] Integers && k >= 1, n \[Element] Integers && n >= 1}, {Series[func[r], {r, 0, 1}]}]

but still it doesn't work - result looks as follows

{(1 - r^(1 - k) r0)^ 2/(-1 + k)) ((r^k - r r0)^2/((r^k - r r1) (r^k - r r2)))^(1/(1 - n))
SeriesData[r, 0, {}, 2, 2, 1]}

By the way, how to get expansion in the inverse variable $1/r$?

EDIT: (based on Jules Lamers' answer) I copied this code and it still didn't work for me.

In[22]:= func2[r_] := r^2 (1 - r^-kk r0)^((1 - kk)/(1 + kk)) ((r^kk - r0)^2/((r^kk - r1) (r^kk - r2)))^-nn ;
assum2 = kk \[Element] Integers && 1/nn \[Element] Integers && kk >= 0 && nn > 0;

In[24]:= Limit[func2[r], r -> 0, Assumptions -> assum2]


Out[24]= Limit[r^2 (1 - r^-kk r0)^((1 - kk)/(1 + kk)) ((r^kk - r0)^2/((r^kk - r1) (r^kk - r2)))^-nn, r -> 0, 
Assumptions -> kk \[Element] Integers && 1/nn \[Element] Integers && kk >= 0 && nn > 0]
$\endgroup$

closed as unclear what you're asking by Feyre, corey979, m_goldberg, MarcoB, C. E. Dec 5 '16 at 23:40

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    $\begingroup$ What's not appropriate about the result? $\endgroup$ – Feyre Dec 1 '16 at 16:06
  • $\begingroup$ @Feyre see edited question $\endgroup$ – newt Dec 1 '16 at 18:34
2
$\begingroup$

Try evaluating your func and its derivatives at $r=0$ to find (some of) the coefficients in the series you're asking for: for the second derivative func''[0] you will see why Series does not do what you want.

As stated, then, it is not surprising that the result is, in your words, "not appropriate". Depending on what you have in mind the situation may perhaps be slightly improved by specifying assumptions about your parameters $k$ and $n$ - are they integers, are they supposed to be above or below certain values?


Edit. Let's set

assum = k \[Element] Integers && n \[Element] Integers && k >= 1 && n >= 1;

Note that even the zeroth-order coefficient in the series expansion can't be computed by Mma:

FullSimplify[func[0], Assumptions -> assum]
(* Out: 0 (1 - 0^(1 - k) r0)^(-1 + 2/k) ((0^(-1 + k) - r0)^2/((0^(-1 + k) - r1) (0^(-1 + k) - r2)))^(1/(1 - n)) *)

Trying to compute the value by taking a limit $t\to0$ doesn't help. I expect that this reflects the fact that Series does not evaluate to give an answer.

Note: if I take e.g. $r0=r1=r2=1$ and try $k>2$ for various choices of $n$ I don't find many cases in which the plot actually draws something in a neigbourhood of $r=0$, which suggests that you might need further assumptions.

If you are sure that the result should not depend on any further underlying assumptions it remains to massage your function into an equivalent form that is easier to handle for Mma. Maybe the following helps you a bit further in this direction. We can make the exponents simpler by setting $n=1+1/nn$ and $k=1+kk$ to get

func2[r_] := r^2 (1 - r^-kk r0)^((1 - kk)/(1 + kk)) ((r^kk - r0)^2/((r^kk - r1) (r^kk - r2)))^-nn
assum2 = kk \[Element] Integers && 1/nn \[Element] Integers && kk >= 0 && nn > 0;

Indeed:

func[r] == func2[r] && assum == assum2 /. {n -> 1/nn+1, k -> kk+1} // Simplify
(* Out: True *)

Now at the very least the first two coefficients in the series can be computed by hand:

 Limit[func2[r], r -> 0, Assumptions -> assum2]
 Limit[func2'[r], r -> 0, Assumptions -> assum2]

(The result is zero in both cases, though the computation takes close to a minute on my computer for each line.) If necessary you could now also try computing the Taylor series through its definition instead.

As for $y$: once you get the above working, you should just be able to replace r -> 1/y and expand in $y$ at your favourite point.

$\endgroup$
  • $\begingroup$ Oh, thank you. Maybe I should have defined that $k$ and $n$ are integers (e.g. using Assuming) I am asking this question because for me it is quite easy to expand this by hand, by Mathematica doesn't want to do this. $\endgroup$ – newt Dec 1 '16 at 18:25
  • $\begingroup$ EDIT: I've tried to use Assuming for k and n, and Series[func[r], {r, 0, 1}] - still doesn't work. By the way, how to get expansion in terms of inverse variable $1/r$? $\endgroup$ – newt Dec 1 '16 at 18:32
  • $\begingroup$ Thank you very much for the answer. I think it clarifies things for me. $\endgroup$ – newt Dec 2 '16 at 19:52
  • $\begingroup$ Very interesting thing: I copied your code and it didn't work for me. $\endgroup$ – newt Dec 3 '16 at 8:34

Not the answer you're looking for? Browse other questions tagged or ask your own question.