Re: Extracting free parameters from a Solve result
- To: mathgroup at smc.vnet.net
- Subject: [mg94072] Re: Extracting free parameters from a Solve result
- From: carlos at colorado.edu
- Date: Thu, 4 Dec 2008 07:14:28 -0500 (EST)
- References: <ggr247$e4l$1@smc.vnet.net>
On Nov 29, 2:30 am, Bob Hanlon <hanl... at cox.net> wrote:
> rules = {{W11 -> W44, W12 -> -W34, W13 -> W34,
> W14 -> -W23 - W33 + W44, W22 -> W33, W24 -> -W34}};
>
> pars = Variables[Last /@ rules[[1]]]
>
> {W23,W33,W34,W44}
>
> Bob Hanlon
>
> ---- car... at colorado.edu wrote:
>
> =============
> In solving a Sylvester matrix equation,Solveis given
> 18 equations in 10 variables: v= {W11,W12,W13,W14,W22,
> W23,W24,W33,W34,W44} It returns
>
> {{W11->W44, W12->-W34, W13->W34,
> W14->-W23-W33+W44, W22->W33, W24->-W34}}
>
> How do I extract the 4 variables: W44,W34,W23,W33 left
> over on the right of the ->, and place them in an ordered list:
>
> pars={W23,W33,W34,W44}
>
> I guess the simplest way would be to Drop the dependent
> variables from the v list but the details escape me. Thanks.
>
> --
>
> Bob Hanlon
Another simple solution, suggested by danl at wolfram.com
via email, is
pars=Sort[Variables[v/.sol]]
where sol is the output of Solve. ( I wasnt aware that
Variables existed.) Thanks to all who replied.