Created
May 29, 2018 19:58
-
-
Save Kohei-Toyoda/7715461e141d9f9a0a1d8e06f2501959 to your computer and use it in GitHub Desktop.
This file contains 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
import matplotlib.pyplot as plt | |
import math | |
time_max=8 | |
timestep=0.005 | |
count=240 | |
n_max=30 | |
result=[] | |
for t_ in range(time_max): | |
result = [] | |
t = t_ * timestep | |
for x in range(count): | |
y=0 | |
for n in range(1,n_max): | |
a = 8 * math.sin(math.pi * n / 2) / ((math.pi ** 2) * (n ** 2)) | |
y += a*math.sin(math.pi*n*1.0/count*x)*math.exp(-1*(n*math.pi)**2*t) | |
result.append(y) | |
plt.plot(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment