I am drawing dozens of functions as subplots, by storing pure functions as list. I find many different functions are considered the same. Here is a simplified example, where two cosine functions are drawn.
#!/usr/bin/env python3
import math # cos
from matplotlib import pyplot as plt # Plotting.
scale =[0.01*x for x in list(range(200))]
list_fun =[lambda t: math.cos(2*math.pi*i*t) for i in [1,2]]
data_1 =list(map(list_fun[0], scale))
data_2 =list(map(list_fun[1], scale))
fig =plt.figure( figsize=(11,5) )
ax =fig.add_subplot(1, 2, 1) # left
ax.plot( scale, data_1, label="cos 2$\pi$t" )
ax.legend()
ax =fig.add_subplot(1, 2, 2) # right
ax.plot( scale, data_2, label="cos 4$\pi$t" )
ax.legend()
plt.show()
The plot shows both $\cos (4\pi t)$
functions, but one should be $\cos (2\pi t)$
. I guess the list formed by several pure functions are invalid in python, is it so? If so, is there an alternative syntax? I am new to Python so there may have been some glaring errors.