Created
August 1, 2020 01:21
-
-
Save riceissa/1c268b3483c09382876fed40c1c86626 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import matplotlib.pyplot as plt | |
import numpy as np | |
def f(x, j, n): | |
if ((j-1)/(n+1) <= x) and (x <= (j - 1/2)/(n+1)): | |
return 2 * (n+1) * (x - (j-1)/(n+1)) | |
if ((j - 1/2)/(n+1) <= x) and (x <= j/(n+1)): | |
return -2 * (n+1) * (x - j/(n+1)) | |
return 0 | |
n = 10 | |
fig, axs = plt.subplots(n+1) | |
xs = np.arange(0.0, 1.0, 0.001) | |
for j in range(1, n+1+1): | |
axs[j-1].plot(xs, [f(x, j, n) for x in xs]) | |
axs[j-1].set_title('f_' + str(j)) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment