ploting "contour plot" and "2D plot"



Hi Samy,

On 04/30/2013 08:48 PM, Gallego Samy wrote:
>
> Thank you for helping me the last time with plotting the roots of 
> polynomials. I come with another question... I would like to plot a 
> "contour plot" and a "2D plot" on the same figure.
>
> For example:
> ---------------
> contour_plot(y^2+x^2, [x,-5,5], [y,-5,5]);
> plot2d(x+2,[x,-5,5], [y,-5,5]);
> ----------------
>
With plot2d you would have to express each contour as a parametric equation:

plot2d([x+2, 
[parametric,4*cos(t),4*sin(t),[t,0,2*%pi]]],[x,-5,5],[y,-5,5],[legend,false],[nticks,100]);

You can also use ploteq:

ploteq(x^2+y^2,[x,-5,5],[y,-5,5],[trajectory_at,0,4],[xfun,"x+2"]);

or use draw2d (see its documentation).

> This is to illustrate an optimization problem using Lagrange multipliers
>
> Like this plot:
> http://commons.wikimedia.org/wiki/File:LagrangeMultipliers2D.svg
>
> Is it possible to do the same illustration in 3D? Like this one:
> http://commons.wikimedia.org/wiki/File:LagrangeMultipliers3D.png
>
sorry, I do not know how to do that kind of 3D ilustration with Maxima.

Regards,
Jaime