Re: How to get Mathematica to solve for "nonbasic variables"?
- To: mathgroup at smc.vnet.net
- Subject: [mg42374] Re: [mg42359] How to get Mathematica to solve for "nonbasic variables"?
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Thu, 3 Jul 2003 06:10:31 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
On Wednesday, July 2, 2003, at 07:36 pm, cdj wrote:
> Hi all,
>
> Intuitively, I'd like to get Mathematica to compute things of the
> following
> sort:
>
> In: Solve[5x==6y,x/y]
>
> Out: {x/y -> 5/6}
>
> Of course Mathematica won't do this - and several obvious variations
> on this
> theme don't seem to work either (e.g., introducing a new variable z =
> x/y, and attempting to solve the system for z).
>
> So what's the easiest way to solve (systems of) equations for
> nonatomic variables of this sort?
>
> Thanks for any suggestions,
>
> cdj
>
>
Actually introducing a new variable and solving for it is the easiest
method:
In[12]:=
Solve[{5*x == 6*y, z == x/y}, z]//First
Out[12]=
{z -> 6/5}
You can also use:
In[13]:=
PolynomialMod[x/y, {5*x - 6*y}]
Out[13]=
6/5
In[15]:=
Last[PolynomialReduce[x/y, {5*x - 6*y}]]
Out[15]=
6/5
In[20]:=
x/y /. AlgebraicRules[{5*x == 6*y}, x]
Out[20]=
6/5
and probably a few other variants of the same basic idea.
Andrzej Kozlowski
Yokohama, Japan
http://www.mimuw.edu.pl/~akoz/
http://platon.c.u-tokyo.ac.jp/andrzej/