Monday, January 12, 2009

Graphing a second-degree equation

This is for drawing two-variable, second-degree equations on a graph in their simplest form: y=a*(x^2)+bx+c

Where :a is what is multiplied by x squared, :b is multiplied by x, and :c is added to the other two. :X is the x-cordinate. Wait a few seconds after you start the program, as it has to run for a while before the first condition is satisfied. This is to keep the turtle from drawing all over the screen, as it flies up and then appears at the bottom again and again.

to graph2 :a :b :c
make "x -450
while [:a*:x*:x+:b*:x+:c>450] [make "x :x+.01]  penup make "x :x+01 setx :x sety :a*xcor*xcor+:b*xcor+:c pendown while [ycor<450]>450] [stop] make "x :x+01 setx :x sety :a*xcor*xcor+:b*xcor+:c]
end

No comments: