2
$\begingroup$

Suppose I want to compute this : Series[Sin[1/f], {f, Infinity, 10}] but finally I prefer Sin[1/f] up to the fourth order in 1/f. How can I do this ?

My first idea was to use the O[] function but it didn't work because 1/f is not a valid variable.

My second idea was to use firstly /. f -> 1/eps and then O[eps]^4 but it didn't work as well...

Note also that, for many reasons, Series[Sin[1/f], {f, Infinity, 4}] is not a solution to me !

$\endgroup$
5
  • $\begingroup$ Normal@Series[Sin[1/f], {f, Infinity, 4}] (if that doesn't do show what result you expect) $\endgroup$
    – george2079
    Apr 25, 2014 at 14:42
  • 4
    $\begingroup$ I learned a new Series trick today. To my surprise, this can be done as Series[Sin[1/f], {f, Infinity, 10}] + O[f, Infinity]^4 $\endgroup$ Apr 25, 2014 at 15:31
  • 1
    $\begingroup$ @DanielLichtblau Actually, since O[...] turns things into SeriesData anyway, you can even simply say Sin[1/f]+O[f,Infinity]^4. $\endgroup$
    – Jens
    Apr 25, 2014 at 19:36
  • $\begingroup$ @Jens Yeah, that gives the right series, though it seems that the post calls for a way to handle the truncation once a higher order series has already been computed. $\endgroup$ Apr 25, 2014 at 20:07
  • $\begingroup$ @DanielLichtblau Yes - of course I already guessed that's why you wrote it that way (after posting the comment)... $\endgroup$
    – Jens
    Apr 25, 2014 at 20:29

1 Answer 1

3
$\begingroup$

As Daniel's comment shows, your idea using O[...] was probably on the right track (if I understood your goal correctly). The error message goes away if you do it this way (you probably typed something like O[1/f]):

Sin[1/f] + O[f, Infinity]^4

$$\frac{1}{f}-\frac{1}{6 f^3}+O\left(\left(\frac{1}{f}\right)^4\right)$$

Sin[1/f] + O[f, Infinity]^10

$$\frac{1}{f}-\frac{1}{6 f^3}+\frac{1}{120 f^5}-\frac{1}{5040 f^7}+\frac{1}{362880 f^9}+O\left(\left(\frac{1}{f}\right)^{10}\right)$$

Interestingly, Mathematica formats the big oh in terms of $1/f$ whereas you can't input it that way in the usual input line. However, you can in fact input the $O(1/f)$ variant if you copy the O part of the output from above, $O\left(\left(\frac{1}{f}\right)^{4}\right)$ and paste it into your input next to the function you want to expand.

$\endgroup$
2
  • $\begingroup$ Similarly one cannot input O[x-c] but instead must use O[x,c]. Actually I like this because it means one need not wonder if O[x-c] and O[-c+x] will be seen as equivalent, or what evaluation might do to the innards of that O[...]. $\endgroup$ Apr 25, 2014 at 20:09
  • $\begingroup$ @DanielLichtblau Makes sense - sometimes people do get spoiled by the more idiomatic TraditionalForm and try to enter things in that more ambiguous way, too. $\endgroup$
    – Jens
    Apr 25, 2014 at 20:37

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.