
# File: poly_functs_03.py
# Programmer: Anne Dawson

# File: poly_functs_03.py
# Programmer: Anne Dawson
# Date: Tuesday 19th October 2010, 8:42 PT
# Python Version: 2.6
# OS: Windows 7
# Textbook: Precalculus - Functions and Graphs, Swokowski & Cole, 11e
# Page: 211


import pylab  # matplotlib


# create the x list data
# arange() is just like range() but allows float numbers
x_list = pylab.arange(-10, 10, 0.1) # range is -4 to +4 in steps 0.1
# x_list = pylab.arange(-4, 4) # range is -4 to +4 in steps1 (default)

# calculate the y list data
y_list = []
for x in x_list:
    y = 16 * x**6 + 5 * x**5 - 16*x + 7
    y_list.append(y)




pylab.title('f(x) =   y = 16x^6 + 5x^5 - 16x + 7',fontsize=13, color='black')
pylab.xlabel("x",fontsize=18, color='black')
pylab.ylabel("y",fontsize=18, color='black')
pylab.grid(True)
pylab.axhline(0, color='black', lw=2) # axis horizontal line at y = 0, line width 2
pylab.axvline(0, color='black', lw=2) # axis vertical line at x = 0, line width 2
pylab.plot(x_list, y_list, 'b') # plot with a blue line

pylab.xlim(-5,5)  # this line must be placed AFTER the plot line
pylab.ylim(-2,1000) # this line must be placed AFTER the plot line


# save the plot as a PNG image file (optional)
pylab.savefig('poly_functs_03.png')
pylab.show()
