MathGroup Archive 2009

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

Search the Archive

Re: problems with parameter lumping using ReplaceAll

  • To: mathgroup at smc.vnet.net
  • Subject: [mg105886] Re: [mg105871] problems with parameter lumping using ReplaceAll
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Wed, 23 Dec 2009 02:42:04 -0500 (EST)
  • References: <200912220906.EAA16805@smc.vnet.net>
  • Reply-to: drmajorbob at yahoo.com

Your attempt:

sol //. 2 V1 - 2 V2 -> 2 w /. 2 V3 - 2 V4 -> 2 x //
   Simplify // LeafCount

927

Mine is only a little simpler:

rules = First@Solve[{2 V1 - 2 V2 == 2 w, 2 V3 - 2 V4 == 2 x}, {V1, V3}]

{V1 -> V2 + w, V3 -> V4 + x}

sol /. rules // Simplify // LeafCount

883

Bobby

On Tue, 22 Dec 2009 03:06:52 -0600, sean <sean_incali at yahoo.com> wrote:

> Hello Group,
>
> I have a pretty nasty expression that I'm trying the lump the
> parameters for.
>
> I'm having problems making mathematica perform the following
> replacement.
> Like I said it's pretty nasty and hope it pastes ok.
>
> sol = {{C[0]->p/(-4 a+4 b)+(Sqrt[l^2-m] vd)/(-4 a+4 b)-Sqrt[u-v-2 Sqrt
> [l^2-m] q vd-2 Sqrt[l^2-m] r vd]/(-4 a+4 b),M[0]->-(i/(2 V1-2 V2))-j/
> (2 V1-2 V2)+Sqrt[s^2-4 t]/(2 V1-2 V2)+V1/(2 V1-2 V2)-V2/(2 V1-2 V2),X
> [0]->l/(2 V3-2 V4)+Sqrt[l^2-m]/(2 V3-2 V4)},{C[0]->p/(-4 a+4 b)+(Sqrt
> [l^2-m] vd)/(-4 a+4 b)-Sqrt[u-v-2 Sqrt[l^2-m] q vd-2 Sqrt[l^2-m] r vd]/
> (-4 a+4 b),M[0]->i/(-2 V1+2 V2)+j/(-2 V1+2 V2)+Sqrt[s^2-4 t]/(-2 V1+2
> V2)-V1/(-2 V1+2 V2)+V2/(-2 V1+2 V2),X[0]->l/(2 V3-2 V4)+Sq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+2 V4)+g/(-2 V3+2 V4)+Sqrt[l^2-m]/
> (-2 V3+2 V4)-V3/(-2 V3+2 V4)+V4/(-2 V3+2 V4)},{C[0]->p/(-4 a+4 b)-(Sqrt
> [l^2-m] vd)/(-4 a+4 b)+Sqrt[u-v+2 Sqrt[l^2-m] q vd+2 Sqrt[l^2-m] r vd]/
> (-4 a+4 b),M[0]->-(i/(2 V1-2 V2))-j/(2 V1-2 V2)+Sqrt[s^2-4 t]/(2 V1-2
> V2)+V1/(2 V1-2 V2)-V2/(2 V1-2 V2),X[0]->f/(-2 V3+2 V4)+g/(-2 V3+2
> V4)+Sqrt[l^2-m]/(-2 V3+2 V4)-V3/(-2 V3+2 V4)+V4/(-2 V3+2 V4)},{C[0]->p/
> (-4 a+4 b)-(Sqrt[l^2-m] vd)/(-4 a+4 b)+Sqrt[u-v+2 Sqrt[l^2-m] q vd+2
> Sqrt[l^2-m] r vd]/(-4 a+4 b),M[0]->i/(-2 V1+2 V2)+j/(-2 V1+2 V2)+Sqrt
> [s^2-4 t]/(-2 V1+2 V2)-V1/(-2 V1+2 V2)+V2/(-2 V1+2 V2),X[0]->f/(-2
> V3+2 V4)+g/(-2 V3+2 V4)+Sqrt[l^2-m]/(-2 V3+2 V4)-V3/(-2 V3+2 V4)+V4/
> (-2 V3+2 V4)}}
>
> sol//. 2 V1-2 V2-> 2w/. 2 V3-2 V4 -> 2x//Simplify
>
> If you try it, 2 V1- 2 V2  is only replaced in every other denominator
> in the solutions. (There are 8 equilibrium points in the sol up there)
>
> It also fails to recognize that -V1 + V2 is -w.
>
> Similarly, 2 V3-2 V4 -> 2x  fails to replace in some of the
> expressions.
>
> It seems like it has to do with - sign in front of the expression that
> mathematica is trying to make the replacements into. If the expression
> contains the - sign, it doesn't replace the expression.
>
> Question is how do I make the replacements regardless the sign?
>
>
> Thanks much in advance.
>
> Sean
>


-- 
DrMajorBob at yahoo.com


  • Prev by Date: Re: problems with parameter lumping using ReplaceAll
  • Next by Date: Re: problems with parameter lumping using ReplaceAll
  • Previous by thread: problems with parameter lumping using ReplaceAll
  • Next by thread: Re: problems with parameter lumping using ReplaceAll