Conics, Cubics, etc.

Helmut Knaust, Department of Mathematical Sciences, UTEP, El Paso TX 79968
hknaust@utep.edu
03/20/2011
Last Edits: 02/12/2024

Conic through 5 points

pol={x,y,x^2,x y, y^2};pts=RandomInteger[{-20,20},{5,2}];coeff=Array[a,5];
sols=Solve[Table[coeff.(pol/.{x->pts[[k,1]],y->pts[[k,2]]})==1,{k,1,5}]];
ContourPlot[(coeff/.sols).pol,{x,-35,35},{y,-35,35},Contours->{1},ContourStyle->{Green,Thick},ContourShading->False,PlotPoints->100,Epilog->{AbsolutePointSize[5],Red,Point[pts]},ImageSize->500]

Cubic through 9 points

pol={x,y,x^2,x y, y^2, x^3,x^2 y , x y^2,y^3};pts=RandomInteger[{-20,20},{9,2}];coeff=Array[a,9];
sols=Solve[Table[coeff.(pol/.{x->pts[[k,1]],y->pts[[k,2]]})==1,{k,1,9}]];
ContourPlot[(coeff/.sols).pol,{x,-30,30},{y,-30,30},Contours->{0,1,2},ContourStyle->{{Blue,Dotted},{Black,Thick},{Red,Dashed}},ContourShading->False,PlotPoints->100,Epilog->{AbsolutePointSize[6],Red,Point[pts]},ImageSize->500,Frame->None,Axes->True,AxesLabel->{x,y}]

Quartic through 14 points

pol={x,y,x^2,x y, y^2, x^3,x^2 y , x y^2,y^3,x^4,x^3 y, x^2 y^2, x y^3, y^4};
pts=RandomInteger[{-20,20},{14,2}];coeff=Array[a,14];
sols=Solve[Table[coeff.(pol/.{x->pts[[k,1]],y->pts[[k,2]]})==1,{k,1,14}]];
ContourPlot[(coeff/.sols).pol,{x,-25,25},{y,-25,25},Contours->{1},ContourStyle->{Green,Thick},ContourShading->False,PlotPoints->100,Epilog->{AbsolutePointSize[5],Red,Point[pts]},ImageSize->500]

Quintic through 20 points

pol={x,y,x^2,x y, y^2, x^3,x^2 y , x y^2,y^3,x^4,x^3 y, x^2 y^2, x y^3, y^4,x^5,x^4 y, x^3 y^2, x^2 y^3,x y^4,y^5};
pts=RandomReal[{-20,20},{20,2}];
coeff=Array[a,20];sols=Solve[Table[coeff.(pol/.{x->pts[[k,1]],y->pts[[k,2]]})==1,{k,1,20}]];
ContourPlot[(coeff/.sols).pol,{x,-30,30},{y,-30,30},Contours->{0,1,2},ContourStyle->{{Blue,Dotted},{Black,Thick},{Red,Dashed}},ContourShading->False,PlotPoints->250,Epilog->{AbsolutePointSize[6],Red,Point[pts]},ImageSize->500,Frame->None]

Sextic through 27 points

pol={x,y,x^2,x y, y^2, x^3,x^2 y , x y^2,y^3,x^4,x^3 y, x^2 y^2, x y^3, y^4,x^5,x^4 y, x^3 y^2, x^2 y^3,x y^4,y^5,x^6,x^5 y,x^4 y^2,x^3y^3,x^2 y^4,x  y^5,y^6};
pts=RandomReal[{-20,20},{27,2}];coeff=Array[a,27];sols=Solve[Table[coeff.(pol/.{x->pts[[k,1]],y->pts[[k,2]]})==1,{k,1,27}]];
ContourPlot[(coeff/.sols).pol,{x,-30,30},{y,-30,30},Contours->{0.9,1,1.1},ContourStyle->{{Blue,Dotted},{Black,Thick},{Red,Dashed}},ContourShading->False,PlotPoints->300,Epilog->{AbsolutePointSize[6],Red,Point[pts]},ImageSize->500,Frame->None]