Skip to content

Instantly share code, notes, and snippets.

@Leva-kleva
Created April 7, 2019 22:04
Show Gist options
  • Save Leva-kleva/cfd8125ce0322791657ec23bf80b6303 to your computer and use it in GitHub Desktop.
Save Leva-kleva/cfd8125ce0322791657ec23bf80b6303 to your computer and use it in GitHub Desktop.
from math import pi
import numpy as np
import matplotlib.pyplot as plt
n = int(input())
##generation
x = np.arange(0, 2*pi+0.1, 0.1)
array = [np.cos(i*x).tolist() for i in range(1, n+1, 1) ]
x = x.tolist()
## question one
graph = plt.figure()
ax = graph.add_subplot(111)
for i in range(n) :
ax.plot(x, array[i], label = "k = " + str(i+1))
plt.legend()
## question two
for i in range(n) :
graph = plt.figure()
ax = graph.add_subplot(111)
ax.plot(x, array[i], label = "k = " + str(i+1))
plt.legend()
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment