[Date Index]
[Thread Index]
[Author Index]
Re: NEWBIE: How do I use the results of a Solve?
*To*: mathgroup at smc.vnet.net
*Subject*: [mg96016] Re: [mg95963] NEWBIE: How do I use the results of a Solve?
*From*: "David Park" <djmpark at comcast.net>
*Date*: Sun, 1 Feb 2009 04:41:50 -0500 (EST)
*References*: <10148392.1233382822112.JavaMail.root@m02>
Tim,
Here are a couple of step by step examples. Copy and paste each of the
examples into a single cell in a Mathematica notebook and then evaluate. The
Print statements give an annotation of the actions. The %% symbol refers to
the piece of output from the second previous statement, that is it skips
back over the Print output.
The first example solves and equation for x and then substitutes the result
into an expression:
Print["Solve an equation"]
Solve[x-12==0]
Print["Take the first part of the first part. But you could get by with
taking only the first part."]
xsol=Part[%%,1,1]
Print["This is the expression that you want to substitute in."]
y== 5x
Print["Perform the substitution"]
%%/.xsol
The second solution solves an equation with parameters for x and then uses
the result to define a new function of the parameters.
Print["Solve an equation with a parameters a and b for x"]
Solve[a x-12+b==0,x]
Print["Take the first part of the first part. But you could get by with
taking only the first part."]
xsol=Part[%%,1,1]
Print["Define a function of x and substitute a and b"]
f[a_,b_]=5 x/.xsol
Print["Test the f function"]
f[a1,b1]
f[1,2]
David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/
From: Tim Heger [mailto:timheger at yahoo.com]
I can't figure out how to use the results of Solve I just created as a new
variable.
Here's a simple example of what I am trying to do:
Solve[some equation, x]
Results in {x->12}
I then want to use the x in y = x * 5 for example....
Obviously when I try to use this it fails because Mathematica sees the
equation as y = {x->12} * 5 and not y = 12 *5 ...
How do I change the results from the Solve from a rule to an actual value I
can then use?
Thanks,
Tim
Prev by Date:
**Re: FourierTransform**
Next by Date:
**Re: MCMC in Mathematica**
Previous by thread:
**Re: NEWBIE: How do I use the results of a Solve?**
Next by thread:
**Re: O in Mathematica**
| |