Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: Solve question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg57470] Re: [mg57457] Solve question
  • From: "David Park" <djmp at earthlink.net>
  • Date: Sun, 29 May 2005 01:03:28 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

L.W.,

Here is an example.

eqn = a x + b == c;
xsol = Solve[eqn, x]
{{x -> (-b + c)/a}}

Notice that Mathematica returned a List within a List. That is because there
may be more than one solution, and for multiple equations there may be more
than one variable in each solution. Generally we will want to extract a
specific solution by taking a specific part of xsol.

Let's create an x function that depends on the a,b,c parameters. We do that
by using Replace denoted by "/.". We want only the solution in the inner
bracket so we use the following:

x[a_, b_, c_] = x /. Part[xsol, 1]
(-b + c)/a

which we can now use.

x[p, q, 3]
(3 - q)/p

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/


From: Sterritt, Lanny [mailto:lanny.sterritt at lmco.com]
To: mathgroup at smc.vnet.net


When the Solve command is used to obtain the value of a variable in an
equation, something like  {x -> value}  is returned.  How does one get
Mathematica  to automatically apply this value to following  expressions in
a notebook?

L.W.Sterritt





  • Prev by Date: Re: Complex Oddity
  • Next by Date: Re: Complex Oddity
  • Previous by thread: Re: Solve question
  • Next by thread: Re: Solve question