Monday, January 12, 2009

graphing a first degree equation

This is for drawing graphs of the most simplified form of any two-variable equation, y=ax+b.

Where :a is what you multiply by X, :b is what you add to that, and :x is where the turtle is on the x-axis:

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

No comments: