Re: Solve and Plot
- To: mathgroup at smc.vnet.net
- Subject: [mg6536] Re: [mg6512] Solve and Plot
- From: penny at suu.edu (Des Penny)
- Date: Mon, 31 Mar 1997 23:01:36 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
>Hello
>I would like to solve an equation and then plot the solution. The command :
>Plot[Solve[3x+2y-4==0,y]],{x,-5,5}]
>How can i do my plot in a one line command ?
>Regards.
>**************************************************************
>* Michel Gosse | Email : michel.gosse at hol.fr *
Hi:
Plot has a HoldAll attribute and so will not evaluate any of its arguments.
In this case you must force it to evaluate its first argument. The
following code will therefore do what you want:
Plot[Evaluate[ y /. Solve[3x+2y-4==0,y][[1]] ], {x,-5,5}];
Cheers,
Des Penny
-------------------------------
Des Penny
Physical Science Dept.
Southern Utah University
Cedar City, UT 84720
VOICE: (Office): (801) 586-7708
(Home) : (801) 586-2286
FAX: (801) 865-8051
e-mail: penny at suu.edu
-------------------------------