MathGroup Archive 1998

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

Search the Archive

Re: how to replace a list of variables


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}/.%


  • Prev by Date: Re: Black-Scholes and exotic options
  • Next by Date: Re: EPS format problems
  • Previous by thread: RE: how to replace a list of variables
  • Next by thread: Re: how to replace a list of variables