3

I want to check my calculations via mathematica.

In the book I am reading there's this expansion: $$\frac{(1+\frac{1}{j})^x}{1+x/j}=1+\frac{x(x-1)}{2j^2}+\mathcal{O}(1/j^3)$$

though I get instead of the term $\frac{x(x-1)}{2j^2}$ in the rhs the term: $-\frac{x(x+1)}{2j^2}$.

So I want to check by mathematica if my calculations are correct, how do you suggest me to implement it in mathematica?

Thanks!

Alan
  • 315
  • 1
  • 7

2 Answers2

8

One way to do it is to use the Series functionality: Series[f[z], {z, c, n}] expands f[z] in z around c to order n. Here we want to expand in 1/j, so we'll make a new variable jinv ($j$-inverse) to represent 1/j, and write our function in terms of that. We then want to expand around jinv = 0 to order 2.

So, we get

Series[(1 + jinv)^x/(1 + x jinv), {jinv, 0, 2}]

which returns

1  +  1/2 (-1+x) x jinv^2  +  O[jinv]^3

So, unfortunately(?), it looks like the book is right.

This is how I think of expanding around a “composite variable” like $1/j$, but as @user64494 points out, you can also expand around $j$ directly in this case, by expanding around $j=\infty$!

Series[(1 + 1/j)^x/(1 + x/j), {j, Infinity, 2}]

which gives the same answer under interpreting jinv as 1/j.

To see why, you could possibly use Wolfram Alpha's step-by-step solution from within Mathematica!

WolframAlpha["D[(1 + w)^x/(1 + x w), {w, 2}]", IncludePods -> "Input", 
 AppearanceElements -> {"Pods"}, PodStates -> {"Input__Show steps"}]

(Here w = jinv, and we'd be substituting w = 0 at the end to get 1/2 (-1+x) x.)

thorimur
  • 9,010
  • 18
  • 32
  • Ok, I think I see where I've gone wrong. – Alan Mar 19 '21 at 10:01
  • wait a minute, if you plug in $w=0$ you get zero. I just plugged the script your wrote (the one last of code), and we get:$\frac{w (x-1) x (w+1)^{x-1}}{(w x+1)^2}$, which when we plug $w=0$ vanishes, am I wrong here? – Alan Mar 19 '21 at 10:14
  • Ah, sorry, should have been the second derivative! – thorimur Mar 19 '21 at 10:16
  • 1
    The coefficient of $1/j$ is, in fact, 0, so that's consistent with the book. Fixing the answer now... – thorimur Mar 19 '21 at 10:17
  • 1
    thorimur, it might be helpful if you update your answer to show the full breadth of functionality that the Series framework offers. I.e. to show that direct expansion over 1/j as j -> 0 is possible. See the comment of @user64494 on the question itself. – CA Trevillian Mar 19 '21 at 11:34
  • Good point! I’ve just done so. – thorimur Mar 19 '21 at 18:20
  • @thorimur: Don't truble it. – user64494 Mar 19 '21 at 19:21
4
Series[(1 + 1/j)^x/(1 + x/j), {j, Infinity, 2}] 

$$1+\frac{(x-1) x}{2 j^2}+O\left(\left(\frac{1}{j}\right)^3\right) . $$

user64494
  • 26,149
  • 4
  • 27
  • 56