Re: Utilizing the Result From Solve[]
- To: mathgroup at smc.vnet.net
- Subject: [mg64133] Re: Utilizing the Result From Solve[]
- From: Helen Read <hpr at together.net>
- Date: Thu, 2 Feb 2006 00:06:16 -0500 (EST)
- References: <drq0gm$mr6$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Shyam Guthikonda wrote: > If I am solving a simple equation, such as: Solve[z+2 = = 3,z], this > returns {{z->1}}. How can I easily get the result, 1? Solve[] returns > the solution in rule form. > > The current method I use to just get the result looks very ugly. Is > there an easier way to do this? > > Here is my current method: > > ReplaceAll[z, First[ First[ Solve[ z + 2 = = 3, z ]]]]; > z = %; > > Now I can use z as a normal variable. z = z /. Solve[z + 2 == 3, z][[1]] Though personally, I would name the specific result something like z1 instead of z, like this. z1= z /. Solve[z + 2 == 3, z][[1]] This way you can go on to solve *other* equations involving the variable z (giving the solutions different names) without having to Clear[z]. -- Helen Read University of Vermont