# Truncate High order terms

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 !

-
Normal@Series[Sin[1/f], {f, Infinity, 4}] (if that doesn't do show what result you expect) – george2079 Apr 25 '14 at 14:42
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 – Daniel Lichtblau Apr 25 '14 at 15:31
@DanielLichtblau Actually, since O[...] turns things into SeriesData anyway, you can even simply say Sin[1/f]+O[f,Infinity]^4. – Jens Apr 25 '14 at 19:36
@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. – Daniel Lichtblau Apr 25 '14 at 20:07
@DanielLichtblau Yes - of course I already guessed that's why you wrote it that way (after posting the comment)... – Jens Apr 25 '14 at 20:29

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.

-
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[...]. – Daniel Lichtblau Apr 25 '14 at 20:09
@DanielLichtblau Makes sense - sometimes people do get spoiled by the more idiomatic TraditionalForm and try to enter things in that more ambiguous way, too. – Jens Apr 25 '14 at 20:37