MathGroup Archive 2005

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

Search the Archive

Re: solve for a squared variable

  • To: mathgroup at smc.vnet.net
  • Subject: [mg60469] Re: solve for a squared variable
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Sat, 17 Sep 2005 02:31:50 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, U.K.
  • References: <200509150916.FAA15860@smc.vnet.net> <dgduk1$19t$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Ruth Lazkoz wrote:
> Hi everyone,
> 
> Why does 
> 
> Solve[x^2 + y == 1, x^2] 
> 
> give and error message? How can I solve for x^2?
> 
> Thanks,
> 
> Ruth 
> 
Hi Ruth,

Since the error message is

_General::ivar : x^2 is not a valid variable. More..._

so we must do a change of variable as in the following example:

In[1]:=
expr = x^2 + y == 1

Out[1]=
x^2 + y == 1

In[2]:=
Solve[expr /. x^2 -> X, X]

Out[2]=
{{X -> 1 - y}}

In[3]:=
x -> Sqrt[X /. %[[1]]]

Out[3]=
x -> Sqrt[1 - y]

In[4]:=
expr /. %

Out[4]=
True

Regards,
/J.M.


  • Prev by Date: Integration problem
  • Next by Date: Re: Mathematica: access serial port?
  • Previous by thread: Re: solve for a squared variable
  • Next by thread: Re: Why this function does not return a single value