2
$\begingroup$

Why can't Mathematica expand simple functions like $$\sqrt{1-x^d}$$ in series? When I give particular values of $d$, then it simplifies but not otherwise. For now, I want $d \in \mathbb{N}$, and want to see the 1st few, say $3$ terms. I even tried to simplify the argument by assuming $d>0$ i.e. I ran the code:

Series[FullSimplify[Sqrt[(1 - x^d)], 
  Assumptions -> {d \[Element] PositiveIntegers, d > 0}], {x, 0, 3}]

and nothing happened: Mathematica returned the input. How to make mathematica do this?

$\endgroup$
3
  • $\begingroup$ (1) I get the first argument only, not the complete input. That's probably what you meant, but I thought I would make sure. (2) Block[{d = Sqrt[3]}, Series[Sqrt[(1 - x^d)], {x, 0, 3}]] returns the square root, not a series. So it does not work for some values for d; therefore I wouldn't expect it to work for a general d. $\endgroup$
    – Michael E2
    Commented Jun 14 at 16:31
  • $\begingroup$ (1) Yes, I am getting $\sqrt{1-x^d}$ as output. (2) I am looking for natural integers only, for which putting any value of $d$ explicitly, does work. $\endgroup$
    – Sanjana
    Commented Jun 14 at 16:39
  • $\begingroup$ Series does not handle nonrational exponents. $\endgroup$ Commented Jun 14 at 22:55

2 Answers 2

9
$\begingroup$

Perhaps this?:

Asymptotic[Sqrt[(1 - u)], {u, 0, 2}] /. u -> x^d
(*  1 - x^d/2 - x^(2 d)/8  *)

If we examine the output of Series, we can see a limitation in the data structure used to represent series. This makes series with parameters that affect which powers appear impossible to represent. For instance,

Series[Sqrt[(1 - x^4)], {x, 0, 10}, 
  Assumptions -> {d \[Element] Reals, d > 0, x > 0}] // InputForm
(*  SeriesData[x, 0, {1, 0, 0, 0, -1/2, 0, 0, 0, -1/8}, 0, 11, 1]  *)

We see explicit coefficients (zero) for the missing powers. There are d-1 of them. For an indeterminate d, such an explicit list is impossible.

$\endgroup$
2
  • $\begingroup$ It is good to know the workaround, but I argue that this is something Asymptotic should do out of the box. I agree with you that it is not the job of Series. $\endgroup$
    – yarchik
    Commented Jun 15 at 10:09
  • $\begingroup$ @yarchik On the one hand, I agree but you should tell WRI; on the other, Asymptotic[Sqrt[(1 - x^d)], {x, 0, 10}] should have 1 + Floor[10/d] nonzero terms, which is indeterminate. Sum[Derivative[k][Sqrt[1 - #^d] &][0] x^k/k!, {k, 0, 10}] fails rather spectacularly. $\endgroup$
    – Michael E2
    Commented Jun 15 at 15:27
2
$\begingroup$

Since the expansion is at an analytic point of the function, the power series is a Taylor expansion: $$ S(x)=\sum_{n=0}^{\infty} \frac{\frac{d^n}{dx}(1-x^d)^{1/2}}{n!}x^n $$

However when $d$ is indeterminate, there arises indeterminate terms of the form $0^0$ which Mathematica cannot directly evaluate. Consider the first two derivatives of the expansion for indeterminate $d$:

$$ \frac{d^2}{dx}(1-x^d)^{1/2}=-\frac{d^2 x^{2 d-2}}{4 \left(1-x^d\right)^{3/2}}-\frac{(d-1) d x^{d-2}}{2 \sqrt{1-x^d}} $$ and note there is a term $x^{d-2}$ that would have to be evaluated at $x=0$ and $d=2$ producing $0^0$. We could avoid this by evaluating the limits separately with the following but inefficient code:

myExpansion[d_, n_] := 
  Module[{p, q, 
    s}, (Limit[
       Sum[(D[(1 - x^p)^(1/2), {x, v}])/(v!) s^v, {v, 0, n}, 
        Assumptions -> Element[PositiveIntegers, p]], p -> d] /. 
      x -> 0) /. s -> x
   ];
myExpansion[2, 6] 

which produces after several seconds:

$$ 1-\frac{x^2}{2}-\frac{x^4}{8}-\frac{x^6}{16} $$

$\endgroup$
8
  • $\begingroup$ Shouldn't the coefficients agree with Series[Sqrt[1 - x^2], {x, 0, 6}], or are you doing something different than I thought you were? $\endgroup$
    – Michael E2
    Commented Jun 14 at 22:26
  • 1
    $\begingroup$ @Michael E2: Ok, sorry, I copied it down wrong. Corrected. Don't know why the limits take so long to evaluate for more than a few terms. Maybe there's a faster way. $\endgroup$
    – josh
    Commented Jun 14 at 22:55
  • $\begingroup$ In that case, why not use Series[Sqrt[1 - x^2], {x, 0, 6}] or Asymptotic instead of myExpansion? $\endgroup$
    – Michael E2
    Commented Jun 15 at 15:27
  • $\begingroup$ Sanjana wanted an indeterminate expression $(1-x^d)^{1/2}$ to use which Series will not evaluate. I just thought it was interesting why Series couldn't do so and hypothesized it was because of the indeterminate form $0^0$ in the general expression with $d$ and a challenge to try and figure out how to resolve it with code. $\endgroup$
    – josh
    Commented Jun 15 at 15:44
  • $\begingroup$ Okay, thanks. I think I see what you were doing. Like Series, myExpansion works only for specific d and n. I thought perhaps myExpansion[d, 6] was supposed to work, and I was missing something. $\endgroup$
    – Michael E2
    Commented Jun 15 at 15:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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