Skip to content

Instantly share code, notes, and snippets.

@mattions
Last active December 15, 2015 22:09
Show Gist options
  • Save mattions/5330631 to your computer and use it in GitHub Desktop.
Save mattions/5330631 to your computer and use it in GitHub Desktop.
a bunch of sin and cos
import numpy as np
import pylab as pl
from numpy import sin, cos
x = np.linspace(-10, 10, 500)
pl.plot(x, sin(x), label="sin")
pl.plot(x, cos(x), label="cos")
pl.plot(x, sin(x) + cos(x), label="sin + cos")
pl.plot(x, pow(sin(x), 2), label = "sin^2")
# Bonus plot!
pl.figure()
pl.plot(x, sin(exp(x)), label="sin(e^x)")
pl.plot(x[250:], sin(np.log(x[250:])), label="sin(ln(x)")
pl.legend().draggable()
pl.ylim (-1.05, 1.05)
pl.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment