[R] Plot 2-d Polynomial without solving it

Duncan Murdoch murdoch at stats.uwo.ca
Sat Jul 4 13:10:23 CEST 2009


Hao Jiang wrote:
> Hi,
> I want to plot a polynomial in the form like ax^2 + bxy + cy^2 + dx + ey + f
> =0 without solving it(since I may have 3 or 4 dimensional polynomial and
> it's really hard to solve). Is there any way  to plot this kind of
> polynomial?
>
> Thanks a lot! 
>   
There are lots of ways.  A contour plot is probably most informative, a 
persp plot is prettier.  In either case you need to evaluate the 
polynomial on a grid, and pass the matrix of values to the plotting 
function.

The outer() function is handy for doing the grid evaluation.

Duncan Murdoch




More information about the R-help mailing list