In [1]:
import numpy as np
import matplotlib.pyplot as plt
from IPython.display import display,Math
In [2]:
print('f(x) is even if f(-x) = f(x)')
print('f(x) is odd if f(-x) = -f(x)')
f(x) is even if f(-x) = f(x)
f(x) is odd if f(-x) = -f(x)
In [3]:
x = np.linspace(-5,5,20)

fEven = x**2
fEvenNeg = (-x)**2

plt.plot(x,fEven)
plt.plot(x,fEvenNeg,'ro')

plt.show()
In [4]:
fOdd = x**3
fOddNeg=(-x)**3
fNegOdd = -fOdd

plt.plot(x,fOdd)
plt.plot(x,fOddNeg,'ro')
plt.plot(x,fNegOdd,'g')

plt.show()
In [5]:
theta = np.linspace(-2*np.pi,2*np.pi,39)
print(-2*np.pi)

cosfun = np.cos(theta)
cosfunN = np.cos(-theta)

plt.plot(theta,cosfun)
plt.plot(theta,cosfunN,'ro')
plt.title('$cosine(\\theta)$')
plt.show()


sinfun = np.sin(theta)
sinfunN = np.sin(-theta)

plt.plot(theta,sinfun)
plt.plot(theta,sinfunN,'ro')
plt.title('$sine(\\theta)$')
plt.show()

sinfun = np.sin(theta)
sinfunN = np.sin(-theta)

plt.plot(theta,-sinfun)
plt.plot(theta,sinfunN,'ro')
plt.title('$sine(\\theta)$')
plt.show()
-6.283185307179586