Re: Simplification de formule/ Simplification of formula
- To: mathgroup at smc.vnet.net
- Subject: [mg124477] Re: Simplification de formule/ Simplification of formula
- From: Bob Hanlon <hanlonr357 at gmail.com>
- Date: Sat, 21 Jan 2012 05:14:11 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <jf696v$gdp$1@smc.vnet.net>
Reverse is not limited to reversing lists: r = {a -> b}; s = {a -> b, c -> d}; Reverse /@ r {b -> a} Reverse /@ s {b -> a, d -> c} Bob Hanlon On Fri, Jan 20, 2012 at 1:52 AM, Dr. Wolfgang Hintze <weh at snafu.de> wrote: > Here's a possible solution to the problem of inverting replacement > rules. > > > In[42]:= > r = {a -> b}; s = {a -> b, c -> d}; > In[40]:= > (Rule @@ Sequence[Reverse[List @@ #1]] & ) /@ r > Out[40]= > {b -> a} > In[41]:= > (Rule @@ Sequence[Reverse[List @@ #1]] & ) /@ s > Out[41]= > {b -> a, d -> c} > > For a "naked" rule (not in a list) you should use > > In[43]:= > t = u -> v; > (Rule @@ Sequence[Reverse[List @@ #1]] & )[t] > Out[44]= > v -> u > > Regards, > Wolfgang > > "Dr. Wolfgang Hintze" <weh at snafu.de> schrieb im Newsbeitrag > news:jf8qd2$3ld$1 at smc.vnet.net... >>> I want to simplify this formula : >> >> This is obviously a good idea and a good excercise if it comes to >> obtaining an overview over a confusing looking expression. >> >> You cannot expect fully automatic simplification, since it was not >> clearly stated which should be the desired form. >> So it will be a dialog between you and Mathematica. >> >> I suggest to first to make some replacements to get better >> readability >> (you can undo them in the end). >> Then recognising the structure by eye it will almost become obvious >> which commands to choose. >> >> Ok, let's do it! >> >> 1) Let your expression be >> >> x = -((DK*Pv2*Cos[a2 - alpha3]*Cos[aV2]*Sin[a2 - aV2])/(DK*Cos[a2 - >> alpha3] - KF*Sin[a2 - alpha3])) + >> (KF*Pv2*Cos[aV2]*Sin[a2 - alpha3]*Sin[a2 - aV2])/(DK*Cos[a2 - >> alpha3] - >> KF*Sin[a2 - alpha3]) - >> (DG3*P3*Sin[alpha3]*Sin[a2 - aV2])/(DK*Cos[a2 - alpha3] - KF*Sin[a2 - >> alpha3]) - (DK*FV2*Pv2*Cos[a2 - alpha3]*Cos[a2 - aV2]*Sin[aV2])/ >> (L2*(DK*Cos[a2 - alpha3] - KF*Sin[a2 - alpha3])) + >> (FV2*KF*Pv2*Cos[a2 - >> aV2]*Sin[a2 - alpha3]*Sin[aV2])/ >> (L2*(DK*Cos[a2 - alpha3] - KF*Sin[a2 - alpha3])) - (KF*Pv2*Cos[a2 - >> alpha3]*Sin[a2 - aV2]*Sin[aV2])/(DK*Cos[a2 - alpha3] - KF*Sin[a2 - >> alpha3]) + >> (FV2*KF*Pv2*Cos[a2 - alpha3]*Sin[a2 - aV2]*Sin[aV2])/(L2*(DK*Cos[a2 - >> alpha3] - KF*Sin[a2 - alpha3])) - >> (DK*Pv2*Sin[a2 - alpha3]*Sin[a2 - aV2]*Sin[aV2])/(DK*Cos[a2 - >> alpha3] - >> KF*Sin[a2 - alpha3]) + (DK*FV2*Pv2*Sin[a2 - alpha3]*Sin[a2 - >> aV2]*Sin[aV2])/ >> (L2*(DK*Cos[a2 - alpha3] - KF*Sin[a2 - alpha3])) >> >> 2) Replacements >> >> x1 = x /. {a2 -> a, alpha3 -> b, aV2 -> c, DK -> A, Pv2 -> B, KF -> >> U, >> DG3 -> V, P3 -> W, FV2 -> X, L2 -> Y} >> >> -((A*B*Cos[a - b]*Cos[c]*Sin[a - c])/(A*Cos[a - b] - U*Sin[a - b])) + >> (B*U*Cos[c]*Sin[a - b]*Sin[a - c])/(A*Cos[a - b] - U*Sin[a - b]) - >> (V*W*Sin[b]*Sin[a - c])/(A*Cos[a - b] - U*Sin[a - b]) - >> (A*B*X*Cos[a - >> b]*Cos[a - c]*Sin[c])/(Y*(A*Cos[a - b] - U*Sin[a - b])) + >> (B*U*X*Cos[a - c]*Sin[a - b]*Sin[c])/(Y*(A*Cos[a - b] - U*Sin[a - >> b])) - (B*U*Cos[a - b]*Sin[a - c]*Sin[c])/(A*Cos[a - b] - U*Sin[a - >> b]) >> + >> (B*U*X*Cos[a - b]*Sin[a - c]*Sin[c])/(Y*(A*Cos[a - b] - U*Sin[a - >> b])) - (A*B*Sin[a - b]*Sin[a - c]*Sin[c])/(A*Cos[a - b] - U*Sin[a - >> b]) >> + >> (A*B*X*Sin[a - b]*Sin[a - c]*Sin[c])/(Y*(A*Cos[a - b] - U*Sin[a - >> b])) >> >> By the way, this expression looks much nicer in Mathematica than in >> this mail here. >> >> 3) Seeing the common denominator we tell Mathematica to extract it >> x2 = Collect[x1, A*Cos[a - b] - U*Sin[a - b]] >> >> (1/(A*Cos[a - b] - U*Sin[a - b]))*((-A)*B*Cos[a - b]*Cos[c]*Sin[a - >> c] >> + B*U*Cos[c]*Sin[a - b]*Sin[a - c] - V*W*Sin[b]*Sin[a - c] - >> (A*B*X*Cos[a - b]*Cos[a - c]*Sin[c])/Y + (B*U*X*Cos[a - c]*Sin[a - >> b]*Sin[c])/Y - B*U*Cos[a - b]*Sin[a - c]*Sin[c] + >> (B*U*X*Cos[a - b]*Sin[a - c]*Sin[c])/Y - A*B*Sin[a - b]*Sin[a - >> c]*Sin[c] + (A*B*X*Sin[a - b]*Sin[a - c]*Sin[c])/Y) >> >> Again this expression looks much nicer in Mathematica than in this >> mail >> here. >> >> 4) Trying to extrax 1/Y using collect didn't improve things so we try >> a >> Simplify in the end >> >> x3 = Simplify[x2] >> >> -((1/(2*Y*(A*Cos[a - b] - U*Sin[a - b])))*(B*U*X*Cos[2*a - b] - >> B*U*Y*Cos[b] - B*U*X*Cos[2*a - b - 2*c] + B*U*Y*Cos[2*a - b - 2*c] + >> V*W*Y*Cos[a - b - c] - >> V*W*Y*Cos[a + b - c] + A*B*X*Sin[2*a - b] + A*B*Y*Sin[b] - >> A*B*X*Sin[2*a - b - 2*c] + A*B*Y*Sin[2*a - b - 2*c])) >> >> This seems to be a rather good result: >> >> - one common denominator extracted >> - all terms in the big bracket have the same structure A*B*C >> Trig[...] >> - angles collected under the Trigfunctions >> >> PS: here is a little additional exercise: how would you invert the >> replacements 2) efficiently? >> >> Hope this helps >> Best regards, >> Wolfgang >> >> >> "Nicolas Simon" <nicodumonastal at gmail.com> schrieb im Newsbeitrag >> news:jf696v$gdp$1 at smc.vnet.net... >>> >>> Hi ! >>> >>> I want to simplify this formula : >>> >>> -((DK Pv2 Cos[a2 - alpha3] Cos[aV2] Sin[a2 - aV2])/( >>> DK Cos[a2 - alpha3] - KF Sin[a2 - alpha3])) + ( >>> KF Pv2 Cos[aV2] Sin[a2 - alpha3] Sin[a2 - aV2])/( >>> DK Cos[a2 - alpha3] - KF Sin[a2 - alpha3]) - ( >>> DG3 P3 Sin[alpha3] Sin[a2 - aV2])/( >>> DK Cos[a2 - alpha3] - KF Sin[a2 - alpha3]) - ( >>> DK FV2 Pv2 Cos[a2 - alpha3] Cos[a2 - aV2] Sin[aV2])/( >>> L2 (DK Cos[a2 - alpha3] - KF Sin[a2 - alpha3])) + ( >>> FV2 KF Pv2 Cos[a2 - aV2] Sin[a2 - alpha3] Sin[aV2])/( >>> L2 (DK Cos[a2 - alpha3] - KF Sin[a2 - alpha3])) - ( >>> KF Pv2 Cos[a2 - alpha3] Sin[a2 - aV2] Sin[aV2])/( >>> DK Cos[a2 - alpha3] - KF Sin[a2 - alpha3]) + ( >>> FV2 KF Pv2 Cos[a2 - alpha3] Sin[a2 - aV2] Sin[aV2])/( >>> L2 (DK Cos[a2 - alpha3] - KF Sin[a2 - alpha3])) - ( >>> DK Pv2 Sin[a2 - alpha3] Sin[a2 - aV2] Sin[aV2])/( >>> DK Cos[a2 - alpha3] - KF Sin[a2 - alpha3]) + ( >>> DK FV2 Pv2 Sin[a2 - alpha3] Sin[a2 - aV2] Sin[aV2])/( >>> L2 (DK Cos[a2 - alpha3] - KF Sin[a2 - alpha3])). >>> >>> By manually regrouping the terms, the denominator disappears for a >>> large number of fraction but I'm not able to reproduce this result >>> with Simplify or others Mathematica tools to handle formula. Any >>> suggestion of how I could do that with Mathematica ? >>> Thank you for your help ! >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> Bonjour, >>> >>> Je souhaite simplifier cette formule : >>> >>> -((DK Pv2 Cos[a2 - alpha3] Cos[aV2] Sin[a2 - aV2])/( >>> DK Cos[a2 - alpha3] - KF Sin[a2 - alpha3])) + ( >>> KF Pv2 Cos[aV2] Sin[a2 - alpha3] Sin[a2 - aV2])/( >>> DK Cos[a2 - alpha3] - KF Sin[a2 - alpha3]) - ( >>> DG3 P3 Sin[alpha3] Sin[a2 - aV2])/( >>> DK Cos[a2 - alpha3] - KF Sin[a2 - alpha3]) - ( >>> DK FV2 Pv2 Cos[a2 - alpha3] Cos[a2 - aV2] Sin[aV2])/( >>> L2 (DK Cos[a2 - alpha3] - KF Sin[a2 - alpha3])) + ( >>> FV2 KF Pv2 Cos[a2 - aV2] Sin[a2 - alpha3] Sin[aV2])/( >>> L2 (DK Cos[a2 - alpha3] - KF Sin[a2 - alpha3])) - ( >>> KF Pv2 Cos[a2 - alpha3] Sin[a2 - aV2] Sin[aV2])/( >>> DK Cos[a2 - alpha3] - KF Sin[a2 - alpha3]) + ( >>> FV2 KF Pv2 Cos[a2 - alpha3] Sin[a2 - aV2] Sin[aV2])/( >>> L2 (DK Cos[a2 - alpha3] - KF Sin[a2 - alpha3])) - ( >>> DK Pv2 Sin[a2 - alpha3] Sin[a2 - aV2] Sin[aV2])/( >>> DK Cos[a2 - alpha3] - KF Sin[a2 - alpha3]) + ( >>> DK FV2 Pv2 Sin[a2 - alpha3] Sin[a2 - aV2] Sin[aV2])/( >>> L2 (DK Cos[a2 - alpha3] - KF Sin[a2 - alpha3])). >>> >>> En regroupant les bons termes le d=E9nominateur se simplifie pour un >>> grand nombres de fractions mais je n'arrive pas a ce r=E9sultat avec >>> les >>> outils de simplification (FullSimplify ou Simplify) ou les outils de >>> manipulations de formule. Est ce que vous auriez une id=E9e de >>> comment >>> faire comme pr=E9ciser certains "assumption" dans Simplify ? >>> Merci de votre aide. >>>