# Small quantities in mathematica

1. ### JohnSimpson

91
"Small" quantities in mathematica

Hi, I'm doing a calculation in which I have a small parameter $$\epsilon$$ floating around, and I want to automatically remove terms of order $$\epsilon^2$$ and higher. Is this possible to do?

2. ### phyzguy

Re: "Small" quantities in mathematica

Sure! Just use:

Series[Expression,{epsilon,0,1}]. this will expand Expression in a power series about epsilon=0, and only keep terms up to order 1. If you use Normal[Series[Expression,{epsilon,0,1}]], that will get rid of the annoying O(epsilon^2) terms floating around.

3. ### JohnSimpson

91
Re: "Small" quantities in mathematica

Thanks!! One more question. Lets say I had something like

$$\left( \begin{array}{cc} -2 \varepsilon & 1-\varepsilon \\ -1+\varepsilon & -1+2 \varepsilon \end{array} \right)$$

How could I retain the multiplicative terms but ditch the additive terms, so that this simplifies to

$$\left( \begin{array}{cc} -2 \varepsilon & 1 \\ -1 & -1 \end{array} \right)$$

4. ### phyzguy

Re: "Small" quantities in mathematica

What you're asking doesn't make sense to me. In the upper left you kept the multiplicative term (2 epsilon) and not the additive term (0), while in the upper right you kept the additive term (1) and not the multiplicative term (- epsilon). What do you want to do exactly? If you can specify precisely what you want to do, we can program the computer to do it.

5. ### JohnSimpson

91
Re: "Small" quantities in mathematica

Right, sorry. What I want to do is say that epsilon is small compared to some other number, in this case 1, but to keep epsilon finite.

$$0 < \varepsilon << 1$$

Therefore, -1 + 2epsilon is ROUGHLY -1. So the first matrix above simplifies under this approximation to the second one.

EDIT: Hmmm, actually, I don't think the power series expansion is quite what I'm looking for. I'd like to have

$$f(x) = \sqrt{x^2 + \varepsilon + \varepsilon^2} \simeq \sqrt{x^2 + \varepsilon}$$

since terms of eps^2 are very small compared to terms of power eps, but x is comparable to epsilon for small enough x. Unless I'm very confused a power series expansion in epsilon will not give me this. Any thoughts would be appreciated.

Last edited: Jun 8, 2011
6. ### Bill Simpson

Re: "Small" quantities in mathematica

Perhaps you can adapt something like this

In[1]:= {{-2ξ,1-ξ},{-1+ξ,-1+2ξ}}/.{x_+_*ξ->x,x_+ξ->x}

Out[1]= {{-2 ξ,1},{-1,-1}}

Or perhaps

In[2]:= Sqrt[x + ξ + ξ^2] /. ξ^2 -> 0

Out[2]= Sqrt[x + ξ]

Limit[expression,ξ->0] won't do what you want and I can't think of a single simple pattern substitution that will do all and only the things you want in all the kinds of expressions that someone could come up with.

With any pattern matching in particular and any Mathematica result in general you should carefully check the results to make sure there are no errors

Last edited: Jun 11, 2011