MathGroup Archive 2004

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

Search the Archive

Re: How to extract a solution from Mathematica's answer to "Solve"

  • To: mathgroup at smc.vnet.net
  • Subject: [mg49382] Re: How to extract a solution from Mathematica's answer to "Solve"
  • From: pnardon <pnardon at ulb.ac.be>
  • Date: Sat, 17 Jul 2004 06:38:46 -0400 (EDT)
  • References: <cd8amc$oj2$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Rainer wrote:
> I have a question concerning the Solve command. Assume I have solved
> an equation using Solve. Mathematica returns the solutions in the
> following form (example for 2 solutions):
> 
> {{x->-2}, {x->2}}
> 
> Now, assume I wish always to pick the first of these two solutions and
> store it in a variable (to be able to continue working with it in the
> Notebook). Is there a command to "extract" the second solution and to
> store it in a variable. Since the response is in a form of a matrix
> {{...},{...}}, I have tried things like MySolution = %[[1]], but it
> always fails.
> 
> I appreciate any helpful commands!
> Thanks
> Rainer
> 
try this:
you have

MySolution=Solve[....,x]

then

MyVar=x/.First[MySolution]

then you can use MyVar anywhere


  • Prev by Date: Re: Using a Result from NMinimize
  • Next by Date: newbie alert: FindRoot
  • Previous by thread: How to extract a solution from Mathematica's answer to "Solve"
  • Next by thread: Question about Export command