Re: how to replace a list of variables
- To: mathgroup at smc.vnet.net
- Subject: [mg14046] Re: [mg14017] how to replace a list of variables
- From: BobHanlon at aol.com
- Date: Fri, 18 Sep 1998 03:50:29 -0400
- Sender: owner-wri-mathgroup at wolfram.com
Works on my machine.
Clear[x, y];
FindRoot[{x+y == 10, x == y}, {x, 3}, {y, 3}] {x,y}={x,y}/.%
{5., 5.}
Clear[x, y];
FindRoot[{E^(x+y) == 10, x == y+2}, {x, 3}, {y, 3}] {x,y}={x,y}/.%
{2.15129254649721, 0.1512925464972104}
If you had previously made an assignment to x or y and didn't clear the
assignment, you might get a bad result. For example,
FindRoot[{x+y == 10, x == y}, {x, 3}, {y, 3}] {x,y}={x,y}/.%
{5., 5.}
FindRoot[{E^(x+y) == 10, x == y+2}, {x, 3}, {y, 3}] {x,y}={x,y}/.%
{2.15129254649721, 2.15129254649721}
Bob Hanlon
In a message dated 9/16/98 4:56:19 PM, wus at econ.lsa.umich.edu wrote:
>Hi, I just got emails discussing how to assign a solution to a variable.
>However, the same approach doesn't work for the following similar
>question, in which the solution is a vector.
>
>FindRoot[{x+y==10,x==y},{x,3},{y,3}] {{x->5,y->5}}
>{x,y}={x,y}/.%