Re: Manipulating Equations
- To: mathgroup at smc.vnet.net
- Subject: [mg25142] Re: [mg25064] Manipulating Equations
- From: BobHanlon at aol.com
- Date: Sun, 10 Sep 2000 03:15:00 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 9/7/2000 10:48:48 PM, chusseau at univ-montp2.fr writes: >I have to simultaneously solve equations corresponding to a physical >problem. Therefore most of my variables have a meaning only if they are >real >and positive. How can I say to Mathematica that it has to reject solutions >not corresponding to these cases, and furthermore how to declare these >variables so that their particular nature is used by Simplify or >FullSimplify. > var = {x, y, z}; eqn = {(x + y)*z^2 == 1, x^2 == 3, y^2 == 3}; For real, positive variables the conditions are cond = And @@ Join[Im[#] == 0 & /@ var, # > 0 & /@ var]; soln = Solve[eqn, var] {{x -> -Sqrt[3], y -> -Sqrt[3], z -> -(I/(Sqrt[2]*3^(1/4)))}, {x -> -Sqrt[3], y -> -Sqrt[3], z -> I/(Sqrt[2]*3^(1/4))}, {x -> Sqrt[3], y -> Sqrt[3], z -> -(1/(Sqrt[2]*3^(1/4)))}, {x -> Sqrt[3], y -> Sqrt[3], z -> 1/(Sqrt[2]*3^(1/4))}} Select[soln, cond /. # &] {{x -> Sqrt[3], y -> Sqrt[3], z -> 1/(Sqrt[2]*3^(1/4))}} Whenever you want to apply the conditions use Simplify[expr, cond] FullSimplify[expr, cond] or define functions mySimplify[expr_] := Simplify[expr, cond]; myFullSimplify[expr_] := FullSimplify[expr, cond]; Bob Hanlon