2
$\begingroup$

Problem:

I need to find the leading order term in an expansion whose leading order behavior is a priori unknown. I can of course go with Series and try different orders, say Series[f[x],{x,x0,n}] for different $n$, however I would like to find a more elegant way. Also each calculation takes very long (almost an hour) so this is not an efficient way (that it takes so long is because my function is convoluted and involves special functions, mostly hypergeometric functions).

There is already a very elegant answer to this question here: Series with a specified number of terms . Basically, it replaces the variable $x$ with its series data version, say $x+O[x]^2$, and then truncates the extra terms by multiplying another SeriesData object. For example,

(x^2 Sin[a x]^2 /. x -> Series[x, {x, 0, 1}]) (1 + O[x])

gives the correct leading order term $a x^4$.

My problem with this approach is that replacing $x$ with its SeriesData version gives incorrect results for symbolic powers. For example, let us consider the function $\left(-x^2\right)^a \sin (x)$. We see that

FullSimplify[((-x^2)^a Sin[x] /. x -> Series[x, {x, 0, 1}]) (1 + O[x]) /. a ->1/2, x > 0]

gives incorrect result -x^2+O[x]^3 whereas the correct result is I x^2+O[x]^3 as can be obtained via

FullSimplify[Series[(-x^2)^a Sin[x], {x, 0, 1}] /. a -> 1/2, x > 0]

This problem can be avoided, at least in this particular example, if one does not use the SeriesData replacement but only chops off higher order terms with the command:

FullSimplify[((-x^2)^a Sin[x]) (1 + O[x]) /. a -> 1/2, x > 0]

Also, the problem does not arise if the symbolic coefficient is given from the beginning since

(-x^2)^(-1/2) /. x -> Series[x, {x, 0, 1}]

yields $$ \begin{cases} \left(\frac{1}{\sqrt{-x^2}}\right)^*+O\left(x^1\right) & -\Im\left(x^2\right)<0 \\ \frac{1}{\sqrt{-x^2}}+O\left(x^1\right) & \text{True} \end{cases}$$ accounting probable complex nature of $x$ whereas the same command fails for symbolic power as

(-x^2)^a /. x -> Series[x, {x, 0, 1}]

directly yields $$(-x)^{2 a} \left(1+O\left(x^1\right)\right) $$

Questions

  • Is it a bug that Mathematica evaluates $(-x^2)^a$ to $(-x)^{2a}$ when $x$ is replaced with a SeriesData form $x+O[x]^2$ ?
  • If it is not a bug, then why do this feature not commute with replacing a symbolic power? (I am under the impression that $a\to 1/2$ should commute with $x\to x+O[x]^2$)
  • I tried wrapping with Assuming, giving the information $x>0$ etc in \$Assumptions and using \$Pre=Refine etc but none of them helped. Does anyone have any idea that I can use to ensure that replacing $x$ with SeriesData works correctly?
  • My main requirement is actually finding the leading order term. Would only multiplying with $(1+O[x])$ at the end works as well? (It works for this small example but my function is a long expression including tens of hypergeometric functions so I am uncertain how much this method would work)
  • Does anyone know any alternative way for finding leading order term in a series expansion with symbolic exponents?
  • I am using version 11.2 Is the situation same in other versions? (I plan to upgrade once 11.3 is released this month)
$\endgroup$
8
  • $\begingroup$ Please do not use the bugs tag until other users have confirmed your observations. $\endgroup$ Commented Mar 9, 2018 at 7:58
  • $\begingroup$ My apologies, thanks for pointing that out. $\endgroup$ Commented Mar 9, 2018 at 8:28
  • 1
    $\begingroup$ Series does not do well with symbolic powers. It's not a bug per se, its a limitation since this falls outside the scope of what it will handle. $\endgroup$ Commented Mar 9, 2018 at 15:53
  • $\begingroup$ I actually do not have problem with Series: It indeed does not calculate what I want however it does not give me incorrect results either. SeriesData on the other hand does give me incorrect result, that is why I think it is a bug. As an example, Series[(-x (x - a))^b, {x, Infinity, 0}] does not evaluate but replacing $x$ with $x+O[1/x]^0$ gives incorrect answer, whereas it should be Mathematically equivalent. Please see Carl Woll's answer here: mathematica.stackexchange.com/questions/80107/… $\endgroup$ Commented Mar 9, 2018 at 18:06
  • 1
    $\begingroup$ SeriesData is using upcode in the Series world. You will see the same issue with InputForm[Series[-x^2,{x,0,2}]^a] Out[7]//InputForm= (-x)^(2*a)*SeriesData[x, 0, {1}, 0, 1, 1]. It's basically doing what it is supposed to do, but operating outside the realm of algebraic functions. Getting it to behave inside that realm, e.g. with rational powers, has been dicey already. $\endgroup$ Commented Mar 9, 2018 at 22:32

1 Answer 1

3
$\begingroup$
  1. I would say that it is a bug that (-x^2)^a gets changed to (-x)^(2a). The domain of variables is clearly stated as complex, where such transformations are not valid. However, this is an error not quite on the same order as thinking that Sqrt[(E-Pi)^2] is negative.
  2. It is a bug, but I would not expect features to commute, especially when dealing with relative power series.
  3. There is no reason to suspect that evaluation of SeriesData objects even looks at assumptions. For example, Assuming[a>5,Series[x,{x,0,3}]+Series[x,{x,0,5}]^a]] does not quite give what you would expect.
  4. Since the question is a bit more tricky for symbolic exponents, I would not expect anything simple to work. For example, what do you expect from x^a+x^b, or even x^a+x^a^2?
  5. If you have symbolic exponents I would suggest substituting rational values for them, collecting the leading term using reliable methods that you already mentioned, and then recovering the leading exponent from FindSequenceFunction.
$\endgroup$
1
  • $\begingroup$ Thanks for the help. For point 2, I mean that mathematically these two operation should commute so I think there should be an explanation why they don't here unless it is a bug. For point 3, I noted these in case I am not aware of a particular refinement. For point 4 I expect to get x^a+x^b: I don't want Mathematica to drop symbolic terms relative to each other. However, it can and should drop if I have a term x^(a+1) or x^(b+1) which multiplying with (1+O[x]) does. For point 5, even though it is indeed a good check, it is not feasible (or practical) to do that in general. $\endgroup$ Commented Mar 9, 2018 at 8:56

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.