
# File: trigonometric_graph_01.py
# Programmer: Anne Dawson
# Date: Sunday 22nd August 2010, 10:06 PT
# Python Version: 2.6
# OS: Windows 7

#import math
import pylab  # matplotlib


def f(x):
    return pylab.exp(-x) * pylab.cos(2*pylab.pi*x)

x1 = pylab.arange(0.0, 5.0, 0.1)
x2 = pylab.arange(0.0, 5.0, 0.02)

pylab.figure(2)
pylab.subplot(211)
pylab.text(1, 0.7, 'y = e^-x  . cos(2 pi x)')
#pylab.text(1, 0.7, r'$y = e^- \ ^x \ . \ cos(2 \  \pi \ x)$')
pylab.plot(x1, f(x1), 'bo', x2, f(x2), 'k') # color 'k' is black

pylab.subplot(212)
pylab.text(1, 0.6, 'y = cos(2 pi x)')
pylab.plot(x2, pylab.cos(2*pylab.pi*x2), 'r--')
# save the plot as a PNG image file (optional)
pylab.savefig('trigonometric_graph_01.png')
pylab.show()


