Re: Manipulating Equations
- To: mathgroup at smc.vnet.net
- Subject: [mg25153] Re: [mg25064] Manipulating Equations
- From: Laurent CHUSSEAU <chusseau at univ-montp2.fr>
- Date: Tue, 12 Sep 2000 02:58:43 -0400 (EDT)
- Organization: LIRMM
- References: <8pff1n$d7v@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
dans l'article 8pff1n$d7v at smc.vnet.net, BobHanlon at aol.com à
BobHanlon at aol.com a écrit le 10/09/2000 9:59 :
>
> 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
>
Thank you Bob, and thank you Allan Hayes too.
I want to point out that both your solutions are valid only with Mathematica
4.0. I miss noting that I am using Mathematica 3.0 that does not include
features as Simplify (or FullSimplify) with conditions, and/or
InequalitySolve.
With Mathematica 3.0, the only possibility I found is to manually choose the
right solution among those proposed by Reduce. It rests however that the
closest form is not obtained since I can't impose that my variables are real
and positive. I still have to do work by hand ... some risky and tedious
business with long equations !
I will upgrade soon to Mathematica 4 ...