Using Curve objects
This test program is in the main function of curve.py
. Uncomment
out portions of the function as you implement methods in the Curve
class. The full function graphs the function f(x) = x^3 - 15x
.
def main():
#curve = Curve()
#print(curve)
#x=-5
#while x <= 5:
# curve.add_point(x, x**3 - 15*x)
# x += 0.05
#print(curve)
#curve.set_color("green")
#print(curve)
#win = GraphWin("Testing Curve class", 1000, 1000)
#xmin = curve.get_min_x()
#xmax = curve.get_max_x()
#ymin = curve.get_min_y()
#ymax = curve.get_max_y()
#print("%.2f, %.2f, %.2f, %.2f" % (xmin,ymin,xmax,ymax))
#win.setCoords(xmin,ymin,xmax,1.2*ymax)
#curve.draw(win)
#win.getMouse()
#baseline = curve.get_baseline()
#baseline.draw(win)
#win.getMouse()
if __name__ == "__main__":
main()