       Re: Utilizing the Result From Solve[]

• To: mathgroup at smc.vnet.net
• Subject: [mg64143] Re: [mg64099] Utilizing the Result From Solve[]
• From: "Erickson Paul-CPTP18" <Paul.Erickson at Motorola.com>
• Date: Thu, 2 Feb 2006 00:07:03 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```Hopefully there is a more general solution for this, but I've used in
that past

z = Solve[z + 2 == 3, z][[1, 1, 2]] (* which is a little hard to
understand ... *)

Or

z = z /. Solve[z + 2 == 3, z][] (* which is a little better, but ...
*)

The z /. ... Converts the rule into a list and therefore that form can
be used for converting any rule to a list of one element. The []
(Part) pulls out the number. I've always been interested in getting to
the number embedded in a larger equation, so assigning it as the value
to the same variable as above will be a little confusing especially on
subsequent evaluation within the same kernel unless you do an explicit
clear. I'd suggest a separate variable name, if so needed like:

a = z /. Solve[z + 2 == 3, z][]

Paul

-----Original Message-----
From: Shyam Guthikonda [mailto:shyamguth at gmail.com]
To: mathgroup at smc.vnet.net
Subject: [mg64143] [mg64099] Utilizing the Result From Solve[]

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.

Thanks!
_Shyam

```

• Prev by Date: Re: does anybody know how to find the inverse Laplace transform of this wierd thing?
• Next by Date: Re: Singularities at end point in integrations...
• Previous by thread: Re: Utilizing the Result From Solve[]
• Next by thread: Re: Utilizing the Result From Solve[]