# How do I expand only the argument of a function?

I want to expand the argument of Exp[ Sqrt[1+x]/x ] in powers of x around x = 0.

Series[  Exp[ Sqrt[1+x]/x ] ,{x,0,3}]


does not work as there is an essential singularity.

The next best thing is to do

Exp[ Series[ Sqrt[1+x]/x ,{x,0,3}]  ]


But I want to do this outside the Exp function as there may be many such terms all added up...

• You suggest this example is not entirely representative, so I don't know whether this will work in all your cases: Exp[Sqrt[1 + x]/x] /. Exp[u_] :> Exp[Series[u, {x, 0, 3}]] May 20, 2017 at 13:12
• Mr. Michael E2 , this will not do as I want to do this outside the argument of Exp function not inside but the effect has to be same as expanding the argument inside the argument of Exp. May 21, 2017 at 13:32
• Then I do not understand what output you want. Please update the question with the formula you want as the output for the expansion of Exp[ Sqrt[1+x]/x ]. May 21, 2017 at 14:08
• Imagine I want to expand the exponents of each of these terms (below) up to order x^3 . (x^2 + Cos[x]) Exp[Sqrt[1 + x]/x] + May 22, 2017 at 16:23
• What would be the output you would expect? In particular what are the terms up to order x^3 of Exp[Sqrt[1 + x]/x] that you would expect to see? May 22, 2017 at 17:00

We can use the identity $$e^{x+y} = e^x e^y$$ to split the argment of Exp into a finite part and an infinite part. Here is some code to extract the finite and infinite parts of a series:

infinitePart[s:HoldPattern @ SeriesData[x_, x0_, __, inc_]] := Normal[
s + SeriesData[x, x0, {}, 0, 0, inc]
]
finitePart[s_SeriesData] := s - infinitePart[s]


Now, making use of the identity:

ReplaceAll[
Series[Exp[Sqrt[1+x]/x], {x, 0, 3}],
Exp[s_SeriesData] :> Exp[infinitePart[s]] Exp[finitePart[s]
] //TeXForm


$$e^{\frac{1}{x}} \left(\sqrt{e}-\frac{\sqrt{e} x}{8}+\frac{9 \sqrt{e} x^2}{128}-\frac{145 \sqrt{e} x^3}{3072}+O\left(x^4\right)\right)$$

we obtain the form I think you're looking for.