Re: Simple Concept I can't figure out! Making rules?
- To: mathgroup at smc.vnet.net
- Subject: [mg38082] Re: Simple Concept I can't figure out! Making rules?
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Tue, 3 Dec 2002 04:28:55 -0500 (EST)
- Organization: Universitaet Leipzig
- References: <as5pgp$n96$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
- Sender: owner-wri-mathgroup at wolfram.com
Hi, sound complicated ;-) answer = First[x /. Solve[2x - 1 == 0, x] // N] First[] because you will use only the first of the solutions. Regards Jens Stan wrote: > > Even though it's frowned upon by the engineering college, i use > mathematica a lot of the stuff that would take pages of code in > another system. I have most basic functions and operations down, but I am > lacking one basic thing I need to do to be able to program more > problems successfully: > > here is my problem: > > Lets say you solve an equation using "Solve" > > Solve[2x - 1 == 0, x] // N > > {{x -> 0.5}} > > How would I then use the result of "Solve" (0.5) and assign it to a > new variable, like "answer" for further calculations? > > I think it has something to do with /. and -> rules of some sort, but > I can't get this simple concept to work! > > Thanks for the help. > > -Stan