Дано:
![enter image description here](https://i.stack.imgur.com/eDsEo.png)
и
У нас есть формула:
![enter image description here](https://i.stack.imgur.com/sBsFx.png)
Я создаю 3D-модель, но не могу указать условие вроде , когда x = 0 u (0, t) = 0
import math
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
def u(x,t,n):
for i in range(1,n):
alpha=((6*(-1)**i-30)/(i**2*np.pi**2))
e=np.exp((-(np.pi**2)*(i**2)*t))
sin=np.sin((i*np.pi*x)/3)
u=alpha*e*sin
return u
N=20
L = 4 # length
att = 20 # iteration
x = np.linspace(0, L ,N) #x-array
t = np.linspace(0, L, N) #t-array
X, Y = np.meshgrid(x, t)
Z = u(X, Y, att)
fig = plt.figure(figsize = (10,10))
ax = fig.add_subplot(111, projection='3d')
ax.plot_wireframe(X, Y, Z, rstride=10, cstride=1000)
plt.show()
Моя 3D-модель:
![enter image description here](https://i.stack.imgur.com/EOYAw.png)