/* [wxMaxima batch file version 1] [ DO NOT EDIT BY HAND! ]*/ /* [ Created with wxMaxima version 14.12.1 ] */ /* [wxMaxima: title start ] The conic section passing through five given points [wxMaxima: title end ] */ /* [wxMaxima: comment start ] Creating five random integer points: [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ x1:random(100)-50; y1:random(100)-50; x2:random(100)-50; y2:random(100)-50; x3:random(100)-50; y3:random(100)-50; x4:random(100)-50; y4:random(100)-50; x5:random(100)-50; y5:random(100)-50; /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ pts:[[x1,y1],[x2,y2],[x3,y3],[x4,y4],[x5,y5]]; /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] Here is the equation for the conic section. Why can we set the constant coefficient equal to 1? - Can we? [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ eq: a*x^2+b*x*y+c*y^2+d*x+e*y+1; /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] Creating the system of 5 equations: [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ sys:[at(eq=0,[x=x1,y=y1]), at(eq=0,[x=x2,y=y2]), at(eq=0,[x=x3,y=y3]), at(eq=0,[x=x4,y=y4]), at(eq=0,[x=x5,y=y5])]; /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] .. and solving the system: [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ sol:solve(sys); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] Substituting these values into the equation for the conic: [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ eqf:at(eq,first(sol)); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] Here are our five points again: [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ pts; /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] Graphing the conic section using an implicit plot: [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ load(implicit_plot); implicit_plot(eqf=0,[x,-60,60],[y,-60,60]); /* [wxMaxima: input end ] */ /* Maxima can't load/batch files which end with a comment! */ "Created with wxMaxima"$