MathGroup Archive 2011

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

Search the Archive

Re: Solve can solve it with some help

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115384] Re: Solve can solve it with some help
  • From: Peter Pein <petsie at dordos.net>
  • Date: Mon, 10 Jan 2011 02:34:03 -0500 (EST)
  • References: <igbnk8$hj9$1@smc.vnet.net>

On 09.01.2011 08:20, Eduardo Cavazos wrote:
> Hello,
>
> Solve doesn't come up with anything for these two equations:
>
> {
>    0 == 1/2*m*vf^2 + 0 - m*g*(R - R*Cos[\[Theta]]),
>
>    m*vf^2/R == m*g*Cos[\[Theta]]
>    };
> Solve[%, \[Theta]]
>
> If you manually solve one of them for vf, Solve can take care of the
> rest:
>
> 0 == 1/2*m*vf^2 + 0 - m*g*(R - R*Cos[\[Theta]]);
> % /. Solve[m*vf^2/R == m*g*Cos[\[Theta]], vf][[2]];
> Solve[%, \[Theta]]
>
> {{\[Theta] ->  -ArcCos[2/3]}, {\[Theta] ->  ArcCos[2/3]}}
>
> Of course, Reduce can handle the original set. However, Solve is nice
> due to the brevity of output. (Side question: is there a way to extract
> an equation from the results of Reduce based on variable name? Sometimes
> the results from Reduce can be so verbose, it'd be nice to say "extract
> equation for theta".)
>
> My main question: is there a way to get Solve to solve the original set
> of two equations without taking the manual approach?
>
> Ed
>
>
Hi Ed,

to extract a list of rules from a result returned by Reduce, I sometimes 
use:

ReduceToRules[red_, var_] :=
  Cases[LogicalExpand[red] /. And | Or -> List,
    {___, HoldPattern[Equal[var, val_] | Equal[val_, var]], ___} :>
     {Rule[var, val]}, 1] // Union

which returns in your example

{{\[Theta] -> -ArcCos[2/3] + 2 \[Pi] C[1]},
  {\[Theta] ->  ArcCos[2/3] + 2 \[Pi] C[1]}}

Peter


  • Prev by Date: Re: How do I do very big integer computing by Mathematica?
  • Next by Date: Re: Summed Area Table / Integral Image
  • Previous by thread: Solve can solve it with some help
  • Next by thread: Re: Solve can solve it with some help