MathGroup Archive 2000

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

Search the Archive

Re: A simple problem


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


  • Prev by Date: Re: A simple problem
  • Next by Date: Re: Vertical Tangents
  • Previous by thread: Re: A simple problem
  • Next by thread: Re: A simple problem