Mathematica Small quantities in mathematica

AI Thread Summary
In Mathematica, to automatically remove terms of order ε² and higher, use the command Series[Expression,{ε,0,1}], followed by Normal to eliminate O(ε²) terms. For simplifying matrices while retaining multiplicative terms and discarding additive ones, precise specifications are necessary to guide the programming. The discussion highlights the challenge of approximating expressions like f(x) = √(x² + ε + ε²) to f(x) ≈ √(x² + ε) without relying solely on power series expansion. Alternative methods such as pattern substitutions and careful limit evaluations are suggested, but users are cautioned to verify results for accuracy.
JohnSimpson
Messages
89
Reaction score
0
"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?
 
Physics news on Phys.org


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.
 


Thanks! One more question. Let's say I had something like

<br /> \left(<br /> \begin{array}{cc}<br /> -2 \varepsilon &amp; 1-\varepsilon \\<br /> -1+\varepsilon &amp; -1+2 \varepsilon <br /> \end{array}<br /> \right)<br />

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

<br /> \left(<br /> \begin{array}{cc}<br /> -2 \varepsilon &amp; 1 \\<br /> -1 &amp; -1<br /> \end{array}<br /> \right)<br />
 


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.
 


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.

<br /> 0 &lt; \varepsilon &lt;&lt; 1<br />

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

<br /> f(x) = \sqrt{x^2 + \varepsilon + \varepsilon^2} \simeq \sqrt{x^2 + \varepsilon}<br />

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:


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:

Similar threads

Replies
2
Views
2K
Replies
4
Views
3K
Replies
5
Views
3K
Replies
2
Views
2K
Back
Top