Re: A simple problem
- To: mathgroup at smc.vnet.net
- Subject: [mg25826] Re: [mg25786] A simple problem
- From: BobHanlon at aol.com
- Date: Sat, 28 Oct 2000 01:41:18 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 10/25/2000 4:45:30 AM, nospam at nosite.com writes: >I have a very simple notation problem I cannot solve (because of my limited >knowledge of Mathematica). > >Example -- an equation from physics: > >f := a * t^2 / 2 - p == 0 > >Now I want to create the different forms of this equation, such as: > >Solve[f,t] > >which produces: > >sqrt(2) * sqrt(p) / sqrt(a) > >Okay, the correct general solution. What I really wanted was the limited >solution ( sqrt(2p/a) ). I know I need to say "assume all the variables >are >>= 0", but I can't figure out how to express this. > >I've tried applying a number of different constraints without success. f := a * t^2 / 2 - p == 0 var = Cases[f, _Symbol, Infinity]; subst = Thread[var -> 1]; cond = And @@ Thread[var >= 0]; For version 3: Select[Flatten[Solve[f, t]], (#[[2]] /. subst) >= 0 &] {t -> (Sqrt[2]*Sqrt[p])/Sqrt[a]} or, for version 4: Select[Flatten[Solve[f, t]], Simplify[#[[2]] >= 0, cond] &] {t -> (Sqrt[2]*Sqrt[p])/Sqrt[a]} Then, in either case, Simplify[%, cond] {t -> Sqrt[2]*Sqrt[p/a]} Bob Hanlon