MathGroup Archive 1989

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

Search the Archive

Re: ContourPlot

  • To: mathgroup at yoda.ncsa.uiuc.edu
  • Subject: Re: ContourPlot
  • From: uunet!itk.unit.no!lie
  • Date: Thu, 16 Nov 89 17:35:19 GMT

[Here are more details on the question regarding contour plots
previously sent to the mailing list. -s christensen]

More details.

Assume that you want to pick the pair (x,y) that minimize the function
     f[x_,y_]={x-3,y-5}.{{5,2},{2,5}}.{x-3,y-5}
By simplifying this expression, you get:
     f[x_,y_]=230 - 50x + 5x^2 - 62y + 4x y + 5y^2
The minimum is obviously the pair (x=3,y=5). Now, suppose that the solution is
constrained to lie on the curve:
     y[x_]=6 - 0.5x
What is then the pair (x,y) that minimize f[x,y]? This can be solved 
graphically by plotting the contours of f[x,y] into the x-y plane for different
values of f. Then plot the constraint (y[x]) in the x-y plane of the same
display. This will produce a visualization of the solution.

I tried to:
1.   ContourPlot[f[x,y],{x,-1,5},{y,0,8}]
2.   Plot[z[x],{x,-1,5}]   (I denoted y[x] by z[x])
3.   Show[%(no. of ContourPlot output), %(no. of Plot output)]

The result:
a.   Warning:
     Show::nocombine: Graphics of type ContourGraphics cannot be combined.
b.   Out[nn]=Show[-ContourGraphics-,-Graphics-]

Question: How can I solve my problem, i.e., how can I plot a ContourPlot
          in the same display as an ordinary plot??

Thanks!
Bernt Lie,
e-mail: lie at itk.unit.no



  • Prev by Date: New books from Addison Wesley ?
  • Next by Date: Re: nonlinear regression curve fitting
  • Previous by thread: ContourPlot
  • Next by thread: New books from Addison Wesley ?