MathGroup Archive 1991

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

Search the Archive

Re: Plotting

  • To: mathgroup at yoda.ncsa.uiuc.edu
  • Subject: Re: Plotting
  • From: ags at seaman.cc.purdue.edu (Dave Seaman)
  • Date: Wed, 27 Feb 91 13:27:44 -0800

mkende at athena.mit.edu writes:

>I have a question concerning plotting.  I am using release 1.0 on a Next
>station.  My question is as follows.  I have some equation like this:
>
>1 -2x -y
>
>which I get from differentiation.  I then solve for x in terms of y:
>
>Solve[% == 0,x]
>
>to get
>
>{x->1-y}
>    ---
>     2

                             1 - y
When I do this, I get {{x -> -----}}.  The extra set of braces makes a
                               2
difference.

>
>I want to plot x as a function of y.  If I use the standard plot, i.e.
>
>Plot[%,{y,0,1}]
>
>I get an error.  Any other way I can think of, namely making a function of the
>right hand side of the answer using some variant of "/. %" , still gives the
>same error.

If you use Plot[x /. %,{y,0,1}], Plot complains that "x /. %" does not evaluate
to a real number.  That's because you get {(1-y)/2}, which is a list, rather 
than a real number.

>Is there any way of plotting (1-y)/2 from the solution without having to simply
>retype it into the Plot command?

You can use

	Plot[First[x /. %],{y,0,1}]

Dave Seaman


  • Prev by Date: Re: How to plot a Klein bottle
  • Next by Date: Mathematica 2.0 and the New Paradigm for Technical Computing
  • Previous by thread: List contour plots
  • Next by thread: Mathematica 2.0 and the New Paradigm for Technical Computing