Re: Solve and Plot

• To: mathgroup at smc.vnet.net
• Subject: [mg6559] Re: [mg6512] Solve and Plot
• From: seanross at worldnet.att.net
• Date: Tue, 1 Apr 1997 19:00:56 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```Michel Gosse wrote:
>
> 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 *
> * 97, rue Joachim du Bellay  | Webpage : coming soon...      *
> * 86000 POITIERS             | Phone   : 33 549460970        *
> * FRANCE                     | Fax     : 33 549460970        *
> **************************************************************

General word to the wise:  when you want to come up with an elegant, one
line way to do something, don't start the problem off trying it.  It
your case, see what kind of object the Solve function returns, then try
putting an argument with it and see what kind of stuff is needed to get
a numerical answer, then put it into a plot function.  My two initial
guesses would be:

Plot[y/.Evaluate[Solve[3x+2y-4==0,y]]][x],{x,-5,5}]

or

Plot[Solve[3x+2y-4==0,y]]/.x->a,{a,-5,5}]

But I have tried neither of these out.  The main point is that there are
usually some hoops to jump through in converting the results of one
command into a useful, evaluatable function-like object.  Don't be
afraid to try out various combinations of transformation rules.

By the by,  why do you have to use only a one-line bit of code?

```

• Prev by Date: How can I handle Operator Algebra ?
• Next by Date: Re: Symbols, names, objects
• Previous by thread: Re: Solve and Plot
• Next by thread: Re: Re: Solve and Plot