Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Series Expansions in Mathematica
Replies: 1   Last Post: Feb 20, 2013 10:26 PM

 Bob Hanlon Posts: 906 Registered: 10/29/11
Re: Series Expansions in Mathematica
Posted: Feb 20, 2013 10:26 PM

Manipulate[
Module[
{expr, expansion, approx, t1, t2, repl},
repl = {t1 -> 0, t2 -> 0};
expr = (Exp[4 x] - c Exp[3 y] Exp[4 x] + c - 1) x^t1 y^t2;
Column[{
Row[{Style["expansion = ", Bold], (expansion =
Series[expr,
{x, 0, maxOrder},
{y, 0, maxOrder}] //
Normal // Expand) /.
repl}],
Row[{Style["approx = ", Bold], approx = (Cases[expansion,
a_. * x^n_ * y^m_ /;
((n + m) /. repl) <= maxOrder] //
Total) /.
repl}],
ContourPlot[approx == 0,
{x, -range, range}, {y, -range, range},
FrameLabel -> {"x", "y"},
ImageSize -> 300]},
Alignment -> Center]],
{{maxOrder, 5, "Max Order"}, Range[5]},
{{range, .1, "Plot Range"}, .05, .75, .05,
Appearance -> "Labeled"},
{{c, 0.5}, -10, 10, 0.1,
Appearance -> "Labeled"}]

Bob Hanlon

On Tue, Feb 19, 2013 at 6:53 PM, Samuel Mark Young <sy81@sussex.ac.uk> wrote:
> Hello,
> I am attempting to expand an equation, and then solve the 1st, 2nd, 3rd, 4th and 5th order expressions one at a time.
>
> The equation is:
>
> Exp[4 x] - c Exp[3 y] Exp[4 x] + c - 1 = 0
>
> With, x and y small variables to be expanded and c a constant. Once this is expanded, the variables x and y are in turn replaced with expansions written as:
>
> x = x[1] + x[2]/2 + x[3]/6 + x[4]/24 + x[5]/120 (to 5th order)
>
> By the time I have completed these expansions, I have a somewhat long expression. Does Mathematica have an intelligent way of deciding which terms would be 1st/2nd/etc order? For example, x[1] y[2] and x[1]^2 y[1] would both be third order.
>
> Many thanks,
> Sam Young
>
>