[R] plotting a bivariate quadratic curve

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Sat Nov 12 18:11:56 CET 2011


On Sat, Nov 12, 2011 at 10:50 AM, Yackov Lubarsky <ylubarsk at gmail.com> wrote:
> Hi,
>
> I would like to plot a x,y curve described by the equation :
>
> Ax^2 + Bx + Cy^2 + Dy + E == 0
>
> (A,B,C,D,E are constants)
>
> This sounds like quite the common task but haven't been able to figure
> out how to do this. Could you please help ? I am new to R so probably
> missing something basic.

 What you may be missing was all figured out by the ancient Greeks and
they didnt even have R in their alphabet!

 You've got this:

http://mathworld.wolfram.com/QuadraticCurve.html

 but with b=0. I'm not sure how many of the awkward cases (line pairs,
imaginary everything) disappear with b=0, but you can compute the
Delta, I, J, and K determinants to figure it out. Then set theta to
seq(0,2*pi,len=100) and compute r from the polar equation form. Plot
r*cos(theta), r*sin(theta)...

Confession: its been a long time since I did maths like this (forgive
me father, for I have not sin'd).

Barry



More information about the R-help mailing list