Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2013

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Series Expansions in Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg129877] Re: Series Expansions in Mathematica
  • From: Samuel Mark Young <sy81 at sussex.ac.uk>
  • Date: Wed, 20 Feb 2013 22:27:49 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <5F5696D639DA7D4C842D85A250023D871E8F5CC8@DB3PRD0710MB393.eurprd07.prod.outlook.com>

Thanks for the advice everyone - pulling out the coefficients seems like a sensible way to proceed, but to clarify what I'm trying to do:

This is one step in a much larger project - which I won't go into the details of. Essentially, I'm trying to work out the probability density function of x.

The equation relates to a specific model - in general, there exists no equation to solve, so I have assumed that x can be written as an expansion x+a x^2+=85 and used various values for the coefficients in further calculations. What I wanted to do here (where an exact solution is available) was compare how well an approximation in terms of a series expansion reproduces the results.

So: the aim is to write x[2], x[3], etc in terms of y[1]. I already have expressions for y[2], y[3], etc in terms of y[1] (set by the model I am using. The equation must be true for all values, so I can equate the first order terms to find an expression for x[1] (and then the second order terms to find an expression for x[2], and so on).

Sam

On 20 Feb 2013, at 08:46, Alexei Boulbitch <Alexei.Boulbitch at iee.lu>
 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
>
>
> Hi, Sam,
>
> Yes, you may go for troubles of solving this using series. Though you did not write what are you looking for as the function of what, I assume that you are looking for x=x(y), or reversed: y=y(x).
>
> To explicitly answer your question:
>
> a) This is the expansion:
>
> expr2 = Series[
>    Exp[4 x] - c* Exp[3 y] Exp[4 x] + c - 1, {x, 0, 5}, {y, 0, 5}] //
>   Normal // Simplify
>
> 1/600 (-45 c y (40 + 60 y + 60 y^2 + 45 y^3 + 27 y^4) -
>   60 x (-40 +
>      c (40 + 120 y + 180 y^2 + 180 y^3 + 135 y^4 + 81 y^5)) -
>   120 x^2 (-40 +
>      c (40 + 120 y + 180 y^2 + 180 y^3 + 135 y^4 + 81 y^5)) -
>   160 x^3 (-40 +
>      c (40 + 120 y + 180 y^2 + 180 y^3 + 135 y^4 + 81 y^5)) -
>   160 x^4 (-40 +
>      c (40 + 120 y + 180 y^2 + 180 y^3 + 135 y^4 + 81 y^5)) -
>   128 x^5 (-40 +
>      c (40 + 120 y + 180 y^2 + 180 y^3 + 135 y^4 + 81 y^5)))
>
> b) Now, like this you get coefficients:
>
> Coefficient[expr2, #] & /@ {x, x^2, x^3, x^4, x^5} /. y -> 0
>
> {1/10 (40 - 40 c),
> 1/5 (40 - 40 c), -(4/15) (-40 + 40 c), -(4/15) (-40 + 40 c), -(16/
>   75) (-40 + 40 c)}
>
> Coefficient[expr2, #] & /@ {xy, x^2 y^2, x^3 y^3, x^4 y^4,
>   y^5 x^5} /. {y -> 0, x -> 0}
>
> {0, -36 c, -48 c, -36 c, -((432 c)/25)}
>
> I did not extract them all. It is your job to accurately do this. I only show the way.
>
> However, your equation Mathematica can solve almost as it is, let alone that each of us is able to solve without can solve explicitly without any computer.
>
> This slightly transforms your expression:
>
>
> expr = Exp[4 x] - c* Exp[3 y] Exp[4 x] + c - 1 /. c -> Exp[b]
>
> -1 + E^b + E^(4 x) - E^(b + 4 x + 3 y)
>
> And this gives a solution.
>
> Solve[expr == 0, x]
>
> Solve::ifun: Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information. >>
>
> {{x -> Log[-((-1 + E^b)^(1/4)/(-1 + E^(b + 3 y))^(1/4))]}, {x ->
>   Log[-((I (-1 + E^b)^(1/4))/(-1 + E^(b + 3 y))^(1/4))]}, {x ->
>   Log[(I (-1 + E^b)^(1/4))/(-1 + E^(b + 3 y))^(1/4)]}, {x ->
>   Log[(-1 + E^b)^(1/4)/(-1 + E^(b + 3 y))^(1/4)]}}
>
>
> Or another way around:
>
> Solve[expr == 0, y]
>
> {{y -> ConditionalExpression[
>    1/3 (-b - 4 x + 2 I \[Pi] C[1] + Log[-1 + E^b + E^(4 x)]),
>    C[1] \[Element] Integers]}}
>
>
> Have fun, Alexei
>
>
> Alexei BOULBITCH, Dr., habil.
> IEE S.A.
> ZAE Weiergewan,
> 11, rue Edmond Reuter,
> L-5326 Contern, LUXEMBOURG
>
> Office phone :  +352-2454-2566
> Office fax:       +352-2454-3566
> mobile phone:  +49 151 52 40 66 44
>
> e-mail: alexei.boulbitch at iee.lu
>
>
>




  • Prev by Date: Optimizing For loop statement
  • Next by Date: Re: Ingolf Dahl's "SetFaceAndFont" palette broken in Mathematica
  • Previous by thread: Re: Series Expansions in Mathematica
  • Next by thread: Optimizing For loop statement