# Solving Partial Differential Equations using Numerical Methods

### This notebook shows the solutions to the following Partial Differential Equations using Numerical Methods (Forward Euler Method)


```python
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
```


```python
#to be seperated for wave equation and heat equation
class FiniteDiff:
    
    def __init__(self, I, xmin, xmax, tmin, tmax, c, dx, dt, Heat = False):
        
        self.dx = dx
        self.xmin = xmin
        self.xmax = xmax
        self.dt = dt
        self.tmin = tmin
        self.tmax = tmax
        self.c = c
        self.F = c*dt/dx
        self.Heat = Heat
        if Heat == True:
            self.F = (c**2)*(dt/(dx**2))
        self.I = I
        
        self.nx = int((self.xmax-self.xmin)/dx)
        self.nt = int((self.tmax-self.tmin)/dt)
        
        self.x = np.linspace(self.xmin, self.xmax, (self.nx+1))
        self.t = np.linspace(self.tmin, self.tmax, (self.nt+1))
        
        self.u = np.zeros((self.nt+1, self.nx+1))
        
    def do(self):
        
        for i in range(0, self.nx+1):
            self.u[0, i] = self.I(self.x[i])
        
        if self.Heat == True:
            for n in range(0, self.nt):
                for i in range(1, self.nx):
                    self.u[n+1, i] = self.u[n,i] + self.F*(self.u[n,i-1] - 2*self.u[n,i] + self.u[n,i+1])
                    self.u[n,0], self.u[n,self.nx] = 0, 0                        
        else:
            for n in range(0, self.nt):
                for i in range(1, self.nx):
                    self.u[n+1, i] = 2*(1-(self.F**2))*self.u[n,i] - self.u[n-1,i] + (self.F**2)*(self.u[n,i+1]+self.u[n,i-1])
                    self.u[n,0], self.u[n,self.nx] = 0, 0
        
        self.data = pd.DataFrame(self.u[:,1:-1])
        
        return self.data
    
    def plot(self, title):
        
        xmat, tmat = np.meshgrid(self.x,self.t)
        fig = plt.figure()
        ax = Axes3D(fig)
        surface = ax.plot_surface(tmat,xmat,self.u)
        plt.xlabel('t')
        plt.ylabel('x')
        plt.title(str(title))
        ax.view_init(40,60)
        plt.show()                                        
```

## Wave Equation of a Plucked String

Use the finite difference method to solve the wave equation for a plucked string:

\begin{equation}
\frac{\delta^2u}{\delta t^2} = 4\frac{\delta^2u}{\delta x^2} \ for \ 0\leq x \leq 1 \ and \ 0\leq t \leq 0.5 \\
u(0,t) = 0 \ for \ 0\leq t \leq 0.5 \\
u(1,t) = 0 \ for \ 0\leq t \leq 0.5 \\
u(x,0) = f(x) = x  \ \ \ for \ 0\leq x \leq \frac{3}{5} \\
u(x,0) = f(x) = 1.5 - 1.5x \ \ \ for \ \frac{3}{5}\leq x \leq 1 \\
\frac{\delta u}{\delta u} = g(x) = 0 \ for \ 0\leq x \leq 1 \\
where: \\
\Delta x = 0.1 \\ 
\Delta t = 0.05 \\
c\frac{\Delta t}{\Delta x} = 1
\end{equation}


```python
xmin, xmax, dx = 0, 1, 0.1
tmin, tmax, dt = 0, 0.5, 0.05
c = 2

I = lambda x: 1.5 - 1.5*x if x>=(3/5) else x

String = FiniteDiff(I, xmin, xmax, tmin, tmax, c, dx, dt, Heat = False)
String.do()
```




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
      <th>3</th>
      <th>4</th>
      <th>5</th>
      <th>6</th>
      <th>7</th>
      <th>8</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>1.000000e-01</td>
      <td>2.000000e-01</td>
      <td>3.000000e-01</td>
      <td>0.40</td>
      <td>5.000000e-01</td>
      <td>0.60</td>
      <td>4.500000e-01</td>
      <td>3.000000e-01</td>
      <td>1.500000e-01</td>
    </tr>
    <tr>
      <th>1</th>
      <td>2.000000e-01</td>
      <td>4.000000e-01</td>
      <td>6.000000e-01</td>
      <td>0.80</td>
      <td>1.000000e+00</td>
      <td>0.95</td>
      <td>9.000000e-01</td>
      <td>6.000000e-01</td>
      <td>3.000000e-01</td>
    </tr>
    <tr>
      <th>2</th>
      <td>3.000000e-01</td>
      <td>6.000000e-01</td>
      <td>9.000000e-01</td>
      <td>1.20</td>
      <td>1.250000e+00</td>
      <td>1.30</td>
      <td>1.100000e+00</td>
      <td>9.000000e-01</td>
      <td>4.500000e-01</td>
    </tr>
    <tr>
      <th>3</th>
      <td>4.000000e-01</td>
      <td>8.000000e-01</td>
      <td>1.200000e+00</td>
      <td>1.35</td>
      <td>1.500000e+00</td>
      <td>1.40</td>
      <td>1.300000e+00</td>
      <td>9.500000e-01</td>
      <td>6.000000e-01</td>
    </tr>
    <tr>
      <th>4</th>
      <td>5.000000e-01</td>
      <td>1.000000e+00</td>
      <td>1.250000e+00</td>
      <td>1.50</td>
      <td>1.500000e+00</td>
      <td>1.50</td>
      <td>1.250000e+00</td>
      <td>1.000000e+00</td>
      <td>5.000000e-01</td>
    </tr>
    <tr>
      <th>5</th>
      <td>6.000000e-01</td>
      <td>9.500000e-01</td>
      <td>1.300000e+00</td>
      <td>1.40</td>
      <td>1.500000e+00</td>
      <td>1.35</td>
      <td>1.200000e+00</td>
      <td>8.000000e-01</td>
      <td>4.000000e-01</td>
    </tr>
    <tr>
      <th>6</th>
      <td>4.500000e-01</td>
      <td>9.000000e-01</td>
      <td>1.100000e+00</td>
      <td>1.30</td>
      <td>1.250000e+00</td>
      <td>1.20</td>
      <td>9.000000e-01</td>
      <td>6.000000e-01</td>
      <td>3.000000e-01</td>
    </tr>
    <tr>
      <th>7</th>
      <td>3.000000e-01</td>
      <td>6.000000e-01</td>
      <td>9.000000e-01</td>
      <td>0.95</td>
      <td>1.000000e+00</td>
      <td>0.80</td>
      <td>6.000000e-01</td>
      <td>4.000000e-01</td>
      <td>2.000000e-01</td>
    </tr>
    <tr>
      <th>8</th>
      <td>1.500000e-01</td>
      <td>3.000000e-01</td>
      <td>4.500000e-01</td>
      <td>0.60</td>
      <td>5.000000e-01</td>
      <td>0.40</td>
      <td>3.000000e-01</td>
      <td>2.000000e-01</td>
      <td>1.000000e-01</td>
    </tr>
    <tr>
      <th>9</th>
      <td>-2.220446e-16</td>
      <td>-2.220446e-16</td>
      <td>-4.440892e-16</td>
      <td>0.00</td>
      <td>-2.220446e-16</td>
      <td>0.00</td>
      <td>2.220446e-16</td>
      <td>2.220446e-16</td>
      <td>-4.440892e-16</td>
    </tr>
    <tr>
      <th>10</th>
      <td>-1.500000e-01</td>
      <td>-3.000000e-01</td>
      <td>-4.500000e-01</td>
      <td>-0.60</td>
      <td>-5.000000e-01</td>
      <td>-0.40</td>
      <td>-3.000000e-01</td>
      <td>-2.000000e-01</td>
      <td>-1.000000e-01</td>
    </tr>
  </tbody>
</table>
</div>




```python
String.plot(title = '1D Wave Equation of a Plucked String')
```

## 1D Wave Equation

\begin{equation}
\frac{\delta^2u}{\delta t^2} = 300\frac{\delta^2u}{\delta x^2} \ for \ 0\leq x \leq 1 \ and \ 0\leq t \leq 0.5 \\
u(0,t) = 0 \ for \ 0\leq t \leq 0.5 \\
u(1,t) = 0 \ for \ 0\leq t \leq 0.5 \\
u(x,0) = f(x) = e^{-k(x-x_0)^2}  \ \ \ for \ 0\leq x \leq \frac{3}{5} \\
\frac{\delta u}{\delta u} = g(x) = 0 \ for \ 0\leq x \leq 1 \\
where: \\
\Delta x = 0.01 \\ 
\Delta t = \frac{\Delta x}{c} \\
k = 1000 \\
x_0 = 0.3
\end{equation}


```python
xmin, xmax, dx = 0, 1, 0.01
tmin, tmax, dt = 0, 0.5, (0.01/300)
c = 300
k = 1000
x0 = 0.3

I = lambda x: np.exp(-k*((x-x0)**2))

WavE = FiniteDiff(I, xmin, xmax, tmin, tmax, c, dx, dt, Heat = False)
WavE.do()
```




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
      <th>3</th>
      <th>4</th>
      <th>5</th>
      <th>6</th>
      <th>7</th>
      <th>8</th>
      <th>9</th>
      <th>...</th>
      <th>89</th>
      <th>90</th>
      <th>91</th>
      <th>92</th>
      <th>93</th>
      <th>94</th>
      <th>95</th>
      <th>96</th>
      <th>97</th>
      <th>98</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>2.991122e-37</td>
      <td>8.939487e-35</td>
      <td>2.187420e-32</td>
      <td>4.382208e-30</td>
      <td>7.187782e-28</td>
      <td>9.652456e-26</td>
      <td>1.061260e-23</td>
      <td>9.553161e-22</td>
      <td>7.040660e-20</td>
      <td>4.248354e-18</td>
      <td>...</td>
      <td>4.508027e-157</td>
      <td>2.506244e-162</td>
      <td>1.140778e-167</td>
      <td>4.251284e-173</td>
      <td>1.297120e-178</td>
      <td>3.240271e-184</td>
      <td>6.627102e-190</td>
      <td>1.109704e-195</td>
      <td>1.521359e-201</td>
      <td>1.707643e-207</td>
    </tr>
    <tr>
      <th>1</th>
      <td>8.939569e-35</td>
      <td>2.187450e-32</td>
      <td>4.382298e-30</td>
      <td>7.188000e-28</td>
      <td>9.652894e-26</td>
      <td>1.061332e-23</td>
      <td>9.554126e-22</td>
      <td>7.041721e-20</td>
      <td>4.249310e-18</td>
      <td>2.099495e-16</td>
      <td>...</td>
      <td>6.638819e-152</td>
      <td>4.508027e-157</td>
      <td>2.506244e-162</td>
      <td>1.140778e-167</td>
      <td>4.251284e-173</td>
      <td>1.297120e-178</td>
      <td>3.240271e-184</td>
      <td>6.627102e-190</td>
      <td>1.109704e-195</td>
      <td>1.521359e-201</td>
    </tr>
    <tr>
      <th>2</th>
      <td>2.187420e-32</td>
      <td>4.382298e-30</td>
      <td>7.188000e-28</td>
      <td>9.652894e-26</td>
      <td>1.061332e-23</td>
      <td>9.554126e-22</td>
      <td>7.041721e-20</td>
      <td>4.249310e-18</td>
      <td>2.099495e-16</td>
      <td>8.493293e-15</td>
      <td>...</td>
      <td>8.004538e-147</td>
      <td>6.638819e-152</td>
      <td>4.508027e-157</td>
      <td>2.506244e-162</td>
      <td>1.140778e-167</td>
      <td>4.251284e-173</td>
      <td>1.297120e-178</td>
      <td>3.240271e-184</td>
      <td>6.627102e-190</td>
      <td>1.109704e-195</td>
    </tr>
    <tr>
      <th>3</th>
      <td>4.382208e-30</td>
      <td>7.188000e-28</td>
      <td>9.652894e-26</td>
      <td>1.061332e-23</td>
      <td>9.554126e-22</td>
      <td>7.041721e-20</td>
      <td>4.249310e-18</td>
      <td>2.099495e-16</td>
      <td>8.493293e-15</td>
      <td>2.813285e-13</td>
      <td>...</td>
      <td>7.901742e-142</td>
      <td>8.004538e-147</td>
      <td>6.638819e-152</td>
      <td>4.508027e-157</td>
      <td>2.506244e-162</td>
      <td>1.140778e-167</td>
      <td>4.251284e-173</td>
      <td>1.297120e-178</td>
      <td>3.240271e-184</td>
      <td>6.627102e-190</td>
    </tr>
    <tr>
      <th>4</th>
      <td>7.187782e-28</td>
      <td>9.652894e-26</td>
      <td>1.061332e-23</td>
      <td>9.554126e-22</td>
      <td>7.041721e-20</td>
      <td>4.249310e-18</td>
      <td>2.099495e-16</td>
      <td>8.493293e-15</td>
      <td>2.813285e-13</td>
      <td>7.630358e-12</td>
      <td>...</td>
      <td>6.386317e-137</td>
      <td>7.901742e-142</td>
      <td>8.004538e-147</td>
      <td>6.638819e-152</td>
      <td>4.508027e-157</td>
      <td>2.506244e-162</td>
      <td>1.140778e-167</td>
      <td>4.251284e-173</td>
      <td>1.297120e-178</td>
      <td>3.240271e-184</td>
    </tr>
    <tr>
      <th>5</th>
      <td>9.652456e-26</td>
      <td>1.061332e-23</td>
      <td>9.554126e-22</td>
      <td>7.041721e-20</td>
      <td>4.249310e-18</td>
      <td>2.099495e-16</td>
      <td>8.493293e-15</td>
      <td>2.813285e-13</td>
      <td>7.630358e-12</td>
      <td>1.694711e-10</td>
      <td>...</td>
      <td>4.225900e-132</td>
      <td>6.386317e-137</td>
      <td>7.901742e-142</td>
      <td>8.004538e-147</td>
      <td>6.638819e-152</td>
      <td>4.508027e-157</td>
      <td>2.506244e-162</td>
      <td>1.140778e-167</td>
      <td>4.251284e-173</td>
      <td>1.297120e-178</td>
    </tr>
    <tr>
      <th>6</th>
      <td>1.061260e-23</td>
      <td>9.554126e-22</td>
      <td>7.041721e-20</td>
      <td>4.249310e-18</td>
      <td>2.099495e-16</td>
      <td>8.493293e-15</td>
      <td>2.813285e-13</td>
      <td>7.630358e-12</td>
      <td>1.694711e-10</td>
      <td>3.082510e-09</td>
      <td>...</td>
      <td>2.289439e-127</td>
      <td>4.225900e-132</td>
      <td>6.386317e-137</td>
      <td>7.901742e-142</td>
      <td>8.004538e-147</td>
      <td>6.638819e-152</td>
      <td>4.508027e-157</td>
      <td>2.506244e-162</td>
      <td>1.140778e-167</td>
      <td>4.251284e-173</td>
    </tr>
    <tr>
      <th>7</th>
      <td>9.553161e-22</td>
      <td>7.041721e-20</td>
      <td>4.249310e-18</td>
      <td>2.099495e-16</td>
      <td>8.493293e-15</td>
      <td>2.813285e-13</td>
      <td>7.630358e-12</td>
      <td>1.694711e-10</td>
      <td>3.082510e-09</td>
      <td>4.592286e-08</td>
      <td>...</td>
      <td>1.015500e-122</td>
      <td>2.289439e-127</td>
      <td>4.225900e-132</td>
      <td>6.386317e-137</td>
      <td>7.901742e-142</td>
      <td>8.004538e-147</td>
      <td>6.638819e-152</td>
      <td>4.508027e-157</td>
      <td>2.506244e-162</td>
      <td>1.140778e-167</td>
    </tr>
    <tr>
      <th>8</th>
      <td>7.040660e-20</td>
      <td>4.249310e-18</td>
      <td>2.099495e-16</td>
      <td>8.493293e-15</td>
      <td>2.813285e-13</td>
      <td>7.630358e-12</td>
      <td>1.694711e-10</td>
      <td>3.082510e-09</td>
      <td>4.592286e-08</td>
      <td>5.604729e-07</td>
      <td>...</td>
      <td>3.687840e-118</td>
      <td>1.015500e-122</td>
      <td>2.289439e-127</td>
      <td>4.225900e-132</td>
      <td>6.386317e-137</td>
      <td>7.901742e-142</td>
      <td>8.004538e-147</td>
      <td>6.638819e-152</td>
      <td>4.508027e-157</td>
      <td>2.506244e-162</td>
    </tr>
    <tr>
      <th>9</th>
      <td>4.248354e-18</td>
      <td>2.099495e-16</td>
      <td>8.493293e-15</td>
      <td>2.813285e-13</td>
      <td>7.630358e-12</td>
      <td>1.694711e-10</td>
      <td>3.082510e-09</td>
      <td>4.592286e-08</td>
      <td>5.604729e-07</td>
      <td>5.605436e-06</td>
      <td>...</td>
      <td>1.096491e-113</td>
      <td>3.687840e-118</td>
      <td>1.015500e-122</td>
      <td>2.289439e-127</td>
      <td>4.225900e-132</td>
      <td>6.386317e-137</td>
      <td>7.901742e-142</td>
      <td>8.004538e-147</td>
      <td>6.638819e-152</td>
      <td>4.508027e-157</td>
    </tr>
    <tr>
      <th>10</th>
      <td>2.098791e-16</td>
      <td>8.493292e-15</td>
      <td>2.813285e-13</td>
      <td>7.630358e-12</td>
      <td>1.694711e-10</td>
      <td>3.082510e-09</td>
      <td>4.592286e-08</td>
      <td>5.604729e-07</td>
      <td>5.605436e-06</td>
      <td>4.596040e-05</td>
      <td>...</td>
      <td>2.669190e-109</td>
      <td>1.096491e-113</td>
      <td>3.687840e-118</td>
      <td>1.015500e-122</td>
      <td>2.289439e-127</td>
      <td>4.225900e-132</td>
      <td>6.386317e-137</td>
      <td>7.901742e-142</td>
      <td>8.004538e-147</td>
      <td>6.638819e-152</td>
    </tr>
    <tr>
      <th>11</th>
      <td>8.489044e-15</td>
      <td>2.813284e-13</td>
      <td>7.630358e-12</td>
      <td>1.694711e-10</td>
      <td>3.082510e-09</td>
      <td>4.592286e-08</td>
      <td>5.604729e-07</td>
      <td>5.605436e-06</td>
      <td>4.596040e-05</td>
      <td>3.091446e-04</td>
      <td>...</td>
      <td>5.319795e-105</td>
      <td>2.669190e-109</td>
      <td>1.096491e-113</td>
      <td>3.687840e-118</td>
      <td>1.015500e-122</td>
      <td>2.289439e-127</td>
      <td>4.225900e-132</td>
      <td>6.386317e-137</td>
      <td>7.901742e-142</td>
      <td>8.004538e-147</td>
    </tr>
    <tr>
      <th>12</th>
      <td>2.811185e-13</td>
      <td>7.630354e-12</td>
      <td>1.694711e-10</td>
      <td>3.082510e-09</td>
      <td>4.592286e-08</td>
      <td>5.604729e-07</td>
      <td>5.605436e-06</td>
      <td>4.596040e-05</td>
      <td>3.091446e-04</td>
      <td>1.707518e-03</td>
      <td>...</td>
      <td>8.680633e-101</td>
      <td>5.319795e-105</td>
      <td>2.669190e-109</td>
      <td>1.096491e-113</td>
      <td>3.687840e-118</td>
      <td>1.015500e-122</td>
      <td>2.289439e-127</td>
      <td>4.225900e-132</td>
      <td>6.386317e-137</td>
      <td>7.901742e-142</td>
    </tr>
    <tr>
      <th>13</th>
      <td>7.621865e-12</td>
      <td>1.694709e-10</td>
      <td>3.082510e-09</td>
      <td>4.592286e-08</td>
      <td>5.604729e-07</td>
      <td>5.605436e-06</td>
      <td>4.596040e-05</td>
      <td>3.091446e-04</td>
      <td>1.707518e-03</td>
      <td>7.755728e-03</td>
      <td>...</td>
      <td>1.159709e-96</td>
      <td>8.680633e-101</td>
      <td>5.319795e-105</td>
      <td>2.669190e-109</td>
      <td>1.096491e-113</td>
      <td>3.687840e-118</td>
      <td>1.015500e-122</td>
      <td>2.289439e-127</td>
      <td>4.225900e-132</td>
      <td>6.386317e-137</td>
    </tr>
    <tr>
      <th>14</th>
      <td>1.691898e-10</td>
      <td>3.082502e-09</td>
      <td>4.592286e-08</td>
      <td>5.604729e-07</td>
      <td>5.605436e-06</td>
      <td>4.596040e-05</td>
      <td>3.091446e-04</td>
      <td>1.707518e-03</td>
      <td>7.755728e-03</td>
      <td>2.903124e-02</td>
      <td>...</td>
      <td>1.268492e-92</td>
      <td>1.159709e-96</td>
      <td>8.680633e-101</td>
      <td>5.319795e-105</td>
      <td>2.669190e-109</td>
      <td>1.096491e-113</td>
      <td>3.687840e-118</td>
      <td>1.015500e-122</td>
      <td>2.289439e-127</td>
      <td>4.225900e-132</td>
    </tr>
    <tr>
      <th>15</th>
      <td>3.074880e-09</td>
      <td>4.592258e-08</td>
      <td>5.604729e-07</td>
      <td>5.605436e-06</td>
      <td>4.596040e-05</td>
      <td>3.091446e-04</td>
      <td>1.707518e-03</td>
      <td>7.755728e-03</td>
      <td>2.903124e-02</td>
      <td>8.984073e-02</td>
      <td>...</td>
      <td>1.135971e-88</td>
      <td>1.268492e-92</td>
      <td>1.159709e-96</td>
      <td>8.680633e-101</td>
      <td>5.319795e-105</td>
      <td>2.669190e-109</td>
      <td>1.096491e-113</td>
      <td>3.687840e-118</td>
      <td>1.015500e-122</td>
      <td>2.289439e-127</td>
    </tr>
    <tr>
      <th>16</th>
      <td>4.575339e-08</td>
      <td>5.604652e-07</td>
      <td>5.605436e-06</td>
      <td>4.596040e-05</td>
      <td>3.091446e-04</td>
      <td>1.707518e-03</td>
      <td>7.755728e-03</td>
      <td>2.903124e-02</td>
      <td>8.984073e-02</td>
      <td>2.309278e-01</td>
      <td>...</td>
      <td>8.328913e-85</td>
      <td>1.135971e-88</td>
      <td>1.268492e-92</td>
      <td>1.159709e-96</td>
      <td>8.680633e-101</td>
      <td>5.319795e-105</td>
      <td>2.669190e-109</td>
      <td>1.096491e-113</td>
      <td>3.687840e-118</td>
      <td>1.015500e-122</td>
    </tr>
    <tr>
      <th>17</th>
      <td>5.573904e-07</td>
      <td>5.605267e-06</td>
      <td>4.596040e-05</td>
      <td>3.091446e-04</td>
      <td>1.707518e-03</td>
      <td>7.755728e-03</td>
      <td>2.903124e-02</td>
      <td>8.984073e-02</td>
      <td>2.309278e-01</td>
      <td>4.964104e-01</td>
      <td>...</td>
      <td>4.999773e-81</td>
      <td>8.328913e-85</td>
      <td>1.135971e-88</td>
      <td>1.268492e-92</td>
      <td>1.159709e-96</td>
      <td>8.680633e-101</td>
      <td>5.319795e-105</td>
      <td>2.669190e-109</td>
      <td>1.096491e-113</td>
      <td>3.687840e-118</td>
    </tr>
    <tr>
      <th>18</th>
      <td>5.559513e-06</td>
      <td>4.595732e-05</td>
      <td>3.091444e-04</td>
      <td>1.707518e-03</td>
      <td>7.755728e-03</td>
      <td>2.903124e-02</td>
      <td>8.984073e-02</td>
      <td>2.309278e-01</td>
      <td>4.964104e-01</td>
      <td>9.012478e-01</td>
      <td>...</td>
      <td>2.457273e-77</td>
      <td>4.999773e-81</td>
      <td>8.328913e-85</td>
      <td>1.135971e-88</td>
      <td>1.268492e-92</td>
      <td>1.159709e-96</td>
      <td>8.680633e-101</td>
      <td>5.319795e-105</td>
      <td>2.669190e-109</td>
      <td>1.096491e-113</td>
    </tr>
    <tr>
      <th>19</th>
      <td>4.539993e-05</td>
      <td>3.090987e-04</td>
      <td>1.707515e-03</td>
      <td>7.755727e-03</td>
      <td>2.903124e-02</td>
      <td>8.984073e-02</td>
      <td>2.309278e-01</td>
      <td>4.964104e-01</td>
      <td>9.012478e-01</td>
      <td>1.401248e+00</td>
      <td>...</td>
      <td>9.887753e-74</td>
      <td>2.457273e-77</td>
      <td>4.999773e-81</td>
      <td>8.328913e-85</td>
      <td>1.135971e-88</td>
      <td>1.268492e-92</td>
      <td>1.159709e-96</td>
      <td>8.680633e-101</td>
      <td>5.319795e-105</td>
      <td>2.669190e-109</td>
    </tr>
    <tr>
      <th>20</th>
      <td>3.035391e-04</td>
      <td>1.706957e-03</td>
      <td>7.755682e-03</td>
      <td>2.903124e-02</td>
      <td>8.984073e-02</td>
      <td>2.309278e-01</td>
      <td>4.964104e-01</td>
      <td>9.012478e-01</td>
      <td>1.401248e+00</td>
      <td>1.901248e+00</td>
      <td>...</td>
      <td>3.257489e-70</td>
      <td>9.887753e-74</td>
      <td>2.457273e-77</td>
      <td>4.999773e-81</td>
      <td>8.328913e-85</td>
      <td>1.135971e-88</td>
      <td>1.268492e-92</td>
      <td>1.159709e-96</td>
      <td>8.680633e-101</td>
      <td>5.319795e-105</td>
    </tr>
    <tr>
      <th>21</th>
      <td>1.661557e-03</td>
      <td>7.750122e-03</td>
      <td>2.903068e-02</td>
      <td>8.984068e-02</td>
      <td>2.309278e-01</td>
      <td>4.964104e-01</td>
      <td>9.012478e-01</td>
      <td>1.401248e+00</td>
      <td>1.901248e+00</td>
      <td>2.306085e+00</td>
      <td>...</td>
      <td>8.786367e-67</td>
      <td>3.257489e-70</td>
      <td>9.887753e-74</td>
      <td>2.457273e-77</td>
      <td>4.999773e-81</td>
      <td>8.328913e-85</td>
      <td>1.135971e-88</td>
      <td>1.268492e-92</td>
      <td>1.159709e-96</td>
      <td>8.680632e-101</td>
    </tr>
    <tr>
      <th>22</th>
      <td>7.446583e-03</td>
      <td>2.898528e-02</td>
      <td>8.983512e-02</td>
      <td>2.309272e-01</td>
      <td>4.964103e-01</td>
      <td>9.012478e-01</td>
      <td>1.401248e+00</td>
      <td>1.901248e+00</td>
      <td>2.306085e+00</td>
      <td>2.571568e+00</td>
      <td>...</td>
      <td>1.940336e-63</td>
      <td>8.786367e-67</td>
      <td>3.257489e-70</td>
      <td>9.887753e-74</td>
      <td>2.457273e-77</td>
      <td>4.999773e-81</td>
      <td>8.328913e-85</td>
      <td>1.135971e-88</td>
      <td>1.268492e-92</td>
      <td>1.159709e-96</td>
    </tr>
    <tr>
      <th>23</th>
      <td>2.732372e-02</td>
      <td>8.953158e-02</td>
      <td>2.308818e-01</td>
      <td>4.964048e-01</td>
      <td>9.012472e-01</td>
      <td>1.401248e+00</td>
      <td>1.901248e+00</td>
      <td>2.306085e+00</td>
      <td>2.571568e+00</td>
      <td>2.712655e+00</td>
      <td>...</td>
      <td>3.508210e-60</td>
      <td>1.940336e-63</td>
      <td>8.786367e-67</td>
      <td>3.257489e-70</td>
      <td>9.887753e-74</td>
      <td>2.457273e-77</td>
      <td>4.999773e-81</td>
      <td>8.328913e-85</td>
      <td>1.135971e-88</td>
      <td>1.268492e-92</td>
    </tr>
    <tr>
      <th>24</th>
      <td>8.208500e-02</td>
      <td>2.292202e-01</td>
      <td>4.961012e-01</td>
      <td>9.012018e-01</td>
      <td>1.401242e+00</td>
      <td>1.901247e+00</td>
      <td>2.306085e+00</td>
      <td>2.571568e+00</td>
      <td>2.712655e+00</td>
      <td>2.773464e+00</td>
      <td>...</td>
      <td>5.193203e-57</td>
      <td>3.508210e-60</td>
      <td>1.940336e-63</td>
      <td>8.786367e-67</td>
      <td>3.257489e-70</td>
      <td>9.887753e-74</td>
      <td>2.457273e-77</td>
      <td>4.999773e-81</td>
      <td>8.328913e-85</td>
      <td>1.135971e-88</td>
    </tr>
    <tr>
      <th>25</th>
      <td>2.018965e-01</td>
      <td>4.886547e-01</td>
      <td>8.995403e-01</td>
      <td>1.400939e+00</td>
      <td>1.901202e+00</td>
      <td>2.306080e+00</td>
      <td>2.571567e+00</td>
      <td>2.712655e+00</td>
      <td>2.773464e+00</td>
      <td>2.794740e+00</td>
      <td>...</td>
      <td>6.293992e-54</td>
      <td>5.193203e-57</td>
      <td>3.508210e-60</td>
      <td>1.940336e-63</td>
      <td>8.786367e-67</td>
      <td>3.257489e-70</td>
      <td>9.887753e-74</td>
      <td>2.457273e-77</td>
      <td>4.999773e-81</td>
      <td>8.328913e-85</td>
    </tr>
    <tr>
      <th>26</th>
      <td>4.065697e-01</td>
      <td>8.722166e-01</td>
      <td>1.393492e+00</td>
      <td>1.899540e+00</td>
      <td>2.305776e+00</td>
      <td>2.571522e+00</td>
      <td>2.712649e+00</td>
      <td>2.773464e+00</td>
      <td>2.794740e+00</td>
      <td>2.800788e+00</td>
      <td>...</td>
      <td>6.245371e-51</td>
      <td>6.293992e-54</td>
      <td>5.193203e-57</td>
      <td>3.508210e-60</td>
      <td>1.940336e-63</td>
      <td>8.786367e-67</td>
      <td>3.257489e-70</td>
      <td>9.887753e-74</td>
      <td>2.457273e-77</td>
      <td>4.999773e-81</td>
    </tr>
    <tr>
      <th>27</th>
      <td>6.703200e-01</td>
      <td>1.311407e+00</td>
      <td>1.872217e+00</td>
      <td>2.298329e+00</td>
      <td>2.569860e+00</td>
      <td>2.712346e+00</td>
      <td>2.773418e+00</td>
      <td>2.794734e+00</td>
      <td>2.800788e+00</td>
      <td>2.802186e+00</td>
      <td>...</td>
      <td>5.073778e-48</td>
      <td>6.245371e-51</td>
      <td>6.293992e-54</td>
      <td>5.193203e-57</td>
      <td>3.508210e-60</td>
      <td>1.940336e-63</td>
      <td>8.786367e-67</td>
      <td>3.257489e-70</td>
      <td>9.887753e-74</td>
      <td>2.457273e-77</td>
    </tr>
    <tr>
      <th>28</th>
      <td>9.048374e-01</td>
      <td>1.670320e+00</td>
      <td>2.216244e+00</td>
      <td>2.542537e+00</td>
      <td>2.704899e+00</td>
      <td>2.771757e+00</td>
      <td>2.794431e+00</td>
      <td>2.800742e+00</td>
      <td>2.802181e+00</td>
      <td>2.802449e+00</td>
      <td>...</td>
      <td>3.374783e-45</td>
      <td>5.073778e-48</td>
      <td>6.245371e-51</td>
      <td>6.293992e-54</td>
      <td>5.193203e-57</td>
      <td>3.508210e-60</td>
      <td>1.940336e-63</td>
      <td>8.786367e-67</td>
      <td>3.257489e-70</td>
      <td>9.887753e-74</td>
    </tr>
    <tr>
      <th>29</th>
      <td>1.000000e+00</td>
      <td>1.809675e+00</td>
      <td>2.340640e+00</td>
      <td>2.622814e+00</td>
      <td>2.744433e+00</td>
      <td>2.786984e+00</td>
      <td>2.799081e+00</td>
      <td>2.801877e+00</td>
      <td>2.802404e+00</td>
      <td>2.802484e+00</td>
      <td>...</td>
      <td>1.837814e-42</td>
      <td>3.374783e-45</td>
      <td>5.073778e-48</td>
      <td>6.245371e-51</td>
      <td>6.293992e-54</td>
      <td>5.193203e-57</td>
      <td>3.508210e-60</td>
      <td>1.940336e-63</td>
      <td>8.786367e-67</td>
      <td>3.257489e-70</td>
    </tr>
    <tr>
      <th>...</th>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
    </tr>
    <tr>
      <th>14971</th>
      <td>-6.703200e-01</td>
      <td>-1.311407e+00</td>
      <td>-1.872217e+00</td>
      <td>-2.298329e+00</td>
      <td>-2.569860e+00</td>
      <td>-2.712346e+00</td>
      <td>-2.773418e+00</td>
      <td>-2.794734e+00</td>
      <td>-2.800788e+00</td>
      <td>-2.802186e+00</td>
      <td>...</td>
      <td>9.858780e-14</td>
      <td>2.575717e-14</td>
      <td>8.348877e-14</td>
      <td>3.552714e-14</td>
      <td>5.861978e-14</td>
      <td>1.776357e-14</td>
      <td>2.930989e-14</td>
      <td>7.993606e-15</td>
      <td>1.154632e-14</td>
      <td>-1.332268e-14</td>
    </tr>
    <tr>
      <th>14972</th>
      <td>-4.065697e-01</td>
      <td>-8.722166e-01</td>
      <td>-1.393492e+00</td>
      <td>-1.899540e+00</td>
      <td>-2.305776e+00</td>
      <td>-2.571522e+00</td>
      <td>-2.712649e+00</td>
      <td>-2.773464e+00</td>
      <td>-2.794740e+00</td>
      <td>-2.800788e+00</td>
      <td>...</td>
      <td>2.575717e-14</td>
      <td>7.371881e-14</td>
      <td>3.641532e-14</td>
      <td>8.704149e-14</td>
      <td>2.486900e-14</td>
      <td>4.884981e-14</td>
      <td>8.881784e-15</td>
      <td>1.776357e-14</td>
      <td>-3.552714e-15</td>
      <td>-1.332268e-14</td>
    </tr>
    <tr>
      <th>14973</th>
      <td>-2.018965e-01</td>
      <td>-4.886547e-01</td>
      <td>-8.995403e-01</td>
      <td>-1.400939e+00</td>
      <td>-1.901202e+00</td>
      <td>-2.306080e+00</td>
      <td>-2.571567e+00</td>
      <td>-2.712655e+00</td>
      <td>-2.773464e+00</td>
      <td>-2.794740e+00</td>
      <td>...</td>
      <td>8.171241e-14</td>
      <td>3.641532e-14</td>
      <td>7.727152e-14</td>
      <td>2.575717e-14</td>
      <td>7.727152e-14</td>
      <td>1.598721e-14</td>
      <td>3.730349e-14</td>
      <td>-2.664535e-15</td>
      <td>-7.105427e-15</td>
      <td>9.769963e-15</td>
    </tr>
    <tr>
      <th>14974</th>
      <td>-8.208500e-02</td>
      <td>-2.292202e-01</td>
      <td>-4.961012e-01</td>
      <td>-9.012018e-01</td>
      <td>-1.401242e+00</td>
      <td>-1.901247e+00</td>
      <td>-2.306085e+00</td>
      <td>-2.571568e+00</td>
      <td>-2.712655e+00</td>
      <td>-2.773464e+00</td>
      <td>...</td>
      <td>2.930989e-14</td>
      <td>8.526513e-14</td>
      <td>2.575717e-14</td>
      <td>6.750156e-14</td>
      <td>1.687539e-14</td>
      <td>6.572520e-14</td>
      <td>4.440892e-15</td>
      <td>1.243450e-14</td>
      <td>1.065814e-14</td>
      <td>6.217249e-15</td>
    </tr>
    <tr>
      <th>14975</th>
      <td>-2.732372e-02</td>
      <td>-8.953158e-02</td>
      <td>-2.308818e-01</td>
      <td>-4.964048e-01</td>
      <td>-9.012472e-01</td>
      <td>-1.401248e+00</td>
      <td>-1.901248e+00</td>
      <td>-2.306085e+00</td>
      <td>-2.571568e+00</td>
      <td>-2.712655e+00</td>
      <td>...</td>
      <td>9.592327e-14</td>
      <td>1.865175e-14</td>
      <td>7.549517e-14</td>
      <td>1.687539e-14</td>
      <td>5.595524e-14</td>
      <td>5.329071e-15</td>
      <td>4.085621e-14</td>
      <td>1.776357e-14</td>
      <td>2.575717e-14</td>
      <td>8.881784e-16</td>
    </tr>
    <tr>
      <th>14976</th>
      <td>-7.446583e-03</td>
      <td>-2.898528e-02</td>
      <td>-8.983512e-02</td>
      <td>-2.309272e-01</td>
      <td>-4.964103e-01</td>
      <td>-9.012478e-01</td>
      <td>-1.401248e+00</td>
      <td>-1.901248e+00</td>
      <td>-2.306085e+00</td>
      <td>-2.571568e+00</td>
      <td>...</td>
      <td>4.263256e-14</td>
      <td>8.615331e-14</td>
      <td>9.769963e-15</td>
      <td>6.394885e-14</td>
      <td>5.329071e-15</td>
      <td>3.108624e-14</td>
      <td>1.865175e-14</td>
      <td>5.417888e-14</td>
      <td>7.993606e-15</td>
      <td>1.953993e-14</td>
    </tr>
    <tr>
      <th>14977</th>
      <td>-1.661557e-03</td>
      <td>-7.750122e-03</td>
      <td>-2.903068e-02</td>
      <td>-8.984068e-02</td>
      <td>-2.309278e-01</td>
      <td>-4.964104e-01</td>
      <td>-9.012478e-01</td>
      <td>-1.401248e+00</td>
      <td>-1.901248e+00</td>
      <td>-2.306085e+00</td>
      <td>...</td>
      <td>1.110223e-13</td>
      <td>3.375078e-14</td>
      <td>7.460699e-14</td>
      <td>-1.776357e-15</td>
      <td>3.907985e-14</td>
      <td>1.865175e-14</td>
      <td>4.440892e-14</td>
      <td>8.881784e-15</td>
      <td>4.796163e-14</td>
      <td>7.105427e-15</td>
    </tr>
    <tr>
      <th>14978</th>
      <td>-3.035391e-04</td>
      <td>-1.706957e-03</td>
      <td>-7.755682e-03</td>
      <td>-2.903124e-02</td>
      <td>-8.984073e-02</td>
      <td>-2.309278e-01</td>
      <td>-4.964104e-01</td>
      <td>-9.012478e-01</td>
      <td>-1.401248e+00</td>
      <td>-1.901248e+00</td>
      <td>...</td>
      <td>4.085621e-14</td>
      <td>9.947598e-14</td>
      <td>2.220446e-14</td>
      <td>4.973799e-14</td>
      <td>1.154632e-14</td>
      <td>5.240253e-14</td>
      <td>8.881784e-15</td>
      <td>3.819167e-14</td>
      <td>7.993606e-15</td>
      <td>2.842171e-14</td>
    </tr>
    <tr>
      <th>14979</th>
      <td>-4.539993e-05</td>
      <td>-3.090987e-04</td>
      <td>-1.707515e-03</td>
      <td>-7.755727e-03</td>
      <td>-2.903124e-02</td>
      <td>-8.984073e-02</td>
      <td>-2.309278e-01</td>
      <td>-4.964104e-01</td>
      <td>-9.012478e-01</td>
      <td>-1.401248e+00</td>
      <td>...</td>
      <td>9.237056e-14</td>
      <td>2.930989e-14</td>
      <td>7.460699e-14</td>
      <td>3.552714e-14</td>
      <td>6.306067e-14</td>
      <td>1.776357e-15</td>
      <td>4.618528e-14</td>
      <td>7.993606e-15</td>
      <td>1.865175e-14</td>
      <td>8.881784e-16</td>
    </tr>
    <tr>
      <th>14980</th>
      <td>-5.559513e-06</td>
      <td>-4.595732e-05</td>
      <td>-3.091444e-04</td>
      <td>-1.707518e-03</td>
      <td>-7.755728e-03</td>
      <td>-2.903124e-02</td>
      <td>-8.984073e-02</td>
      <td>-2.309278e-01</td>
      <td>-4.964104e-01</td>
      <td>-9.012478e-01</td>
      <td>...</td>
      <td>3.508305e-14</td>
      <td>6.750156e-14</td>
      <td>4.263256e-14</td>
      <td>8.792966e-14</td>
      <td>2.575717e-14</td>
      <td>5.684342e-14</td>
      <td>8.881784e-16</td>
      <td>2.664535e-14</td>
      <td>8.881784e-16</td>
      <td>-9.769963e-15</td>
    </tr>
    <tr>
      <th>14981</th>
      <td>-5.573903e-07</td>
      <td>-5.605267e-06</td>
      <td>-4.596039e-05</td>
      <td>-3.091446e-04</td>
      <td>-1.707518e-03</td>
      <td>-7.755728e-03</td>
      <td>-2.903124e-02</td>
      <td>-8.984073e-02</td>
      <td>-2.309278e-01</td>
      <td>-4.964104e-01</td>
      <td>...</td>
      <td>8.260059e-14</td>
      <td>4.840572e-14</td>
      <td>8.082424e-14</td>
      <td>3.286260e-14</td>
      <td>8.171241e-14</td>
      <td>2.486900e-14</td>
      <td>3.730349e-14</td>
      <td>-6.217249e-15</td>
      <td>-1.776357e-15</td>
      <td>0.000000e+00</td>
    </tr>
    <tr>
      <th>14982</th>
      <td>-4.575325e-08</td>
      <td>-5.604652e-07</td>
      <td>-5.605436e-06</td>
      <td>-4.596040e-05</td>
      <td>-3.091446e-04</td>
      <td>-1.707518e-03</td>
      <td>-7.755728e-03</td>
      <td>-2.903124e-02</td>
      <td>-8.984073e-02</td>
      <td>-2.309278e-01</td>
      <td>...</td>
      <td>4.396483e-14</td>
      <td>9.592327e-14</td>
      <td>3.863576e-14</td>
      <td>7.460699e-14</td>
      <td>3.197442e-14</td>
      <td>6.217249e-14</td>
      <td>1.776357e-14</td>
      <td>8.881784e-15</td>
      <td>-7.105427e-15</td>
      <td>7.993606e-15</td>
    </tr>
    <tr>
      <th>14983</th>
      <td>-3.074859e-09</td>
      <td>-4.592254e-08</td>
      <td>-5.604728e-07</td>
      <td>-5.605436e-06</td>
      <td>-4.596040e-05</td>
      <td>-3.091446e-04</td>
      <td>-1.707518e-03</td>
      <td>-7.755728e-03</td>
      <td>-2.903124e-02</td>
      <td>-8.984073e-02</td>
      <td>...</td>
      <td>1.039169e-13</td>
      <td>3.419487e-14</td>
      <td>8.970602e-14</td>
      <td>3.774758e-14</td>
      <td>5.506706e-14</td>
      <td>2.486900e-14</td>
      <td>3.375078e-14</td>
      <td>1.687539e-14</td>
      <td>1.865175e-14</td>
      <td>-7.105427e-15</td>
    </tr>
    <tr>
      <th>14984</th>
      <td>-1.692841e-10</td>
      <td>-3.082492e-09</td>
      <td>-4.592277e-08</td>
      <td>-5.604728e-07</td>
      <td>-5.605436e-06</td>
      <td>-4.596040e-05</td>
      <td>-3.091446e-04</td>
      <td>-1.707518e-03</td>
      <td>-7.755728e-03</td>
      <td>-2.903124e-02</td>
      <td>...</td>
      <td>4.973799e-14</td>
      <td>9.769963e-14</td>
      <td>3.330669e-14</td>
      <td>7.016610e-14</td>
      <td>3.064216e-14</td>
      <td>2.664535e-14</td>
      <td>2.398082e-14</td>
      <td>4.352074e-14</td>
      <td>1.687539e-14</td>
      <td>1.065814e-14</td>
    </tr>
    <tr>
      <th>14985</th>
      <td>-7.633005e-12</td>
      <td>-1.695213e-10</td>
      <td>-3.082483e-09</td>
      <td>-4.592288e-08</td>
      <td>-5.604728e-07</td>
      <td>-5.605436e-06</td>
      <td>-4.596040e-05</td>
      <td>-3.091446e-04</td>
      <td>-1.707518e-03</td>
      <td>-7.755728e-03</td>
      <td>...</td>
      <td>1.190159e-13</td>
      <td>4.884981e-14</td>
      <td>7.815970e-14</td>
      <td>2.620126e-14</td>
      <td>4.174439e-14</td>
      <td>2.975398e-14</td>
      <td>3.641532e-14</td>
      <td>2.398082e-14</td>
      <td>3.552714e-14</td>
      <td>2.398082e-14</td>
    </tr>
    <tr>
      <th>14986</th>
      <td>-2.371436e-13</td>
      <td>-7.623235e-12</td>
      <td>-1.696243e-10</td>
      <td>-3.082472e-09</td>
      <td>-4.592268e-08</td>
      <td>-5.604728e-07</td>
      <td>-5.605436e-06</td>
      <td>-4.596040e-05</td>
      <td>-3.091446e-04</td>
      <td>-1.707518e-03</td>
      <td>...</td>
      <td>3.153033e-14</td>
      <td>9.947598e-14</td>
      <td>4.174439e-14</td>
      <td>4.973799e-14</td>
      <td>2.531308e-14</td>
      <td>5.151435e-14</td>
      <td>2.975398e-14</td>
      <td>2.842171e-14</td>
      <td>3.108624e-14</td>
      <td>2.486900e-14</td>
    </tr>
    <tr>
      <th>14987</th>
      <td>9.769963e-15</td>
      <td>-3.401723e-13</td>
      <td>-7.612577e-12</td>
      <td>-1.694263e-10</td>
      <td>-3.082448e-09</td>
      <td>-4.592281e-08</td>
      <td>-5.604728e-07</td>
      <td>-5.605436e-06</td>
      <td>-4.596040e-05</td>
      <td>-3.091446e-04</td>
      <td>...</td>
      <td>8.704149e-14</td>
      <td>2.442491e-14</td>
      <td>7.105427e-14</td>
      <td>4.085621e-14</td>
      <td>5.950795e-14</td>
      <td>2.531308e-14</td>
      <td>4.352074e-14</td>
      <td>3.685940e-14</td>
      <td>1.776357e-14</td>
      <td>7.105427e-15</td>
    </tr>
    <tr>
      <th>14988</th>
      <td>-1.030287e-13</td>
      <td>2.042810e-14</td>
      <td>-1.421085e-13</td>
      <td>-7.588596e-12</td>
      <td>-1.695533e-10</td>
      <td>-3.082419e-09</td>
      <td>-4.592272e-08</td>
      <td>-5.604728e-07</td>
      <td>-5.605436e-06</td>
      <td>-4.596040e-05</td>
      <td>...</td>
      <td>4.218847e-14</td>
      <td>5.861978e-14</td>
      <td>2.353673e-14</td>
      <td>8.082424e-14</td>
      <td>4.085621e-14</td>
      <td>5.151435e-14</td>
      <td>3.241851e-14</td>
      <td>3.286260e-14</td>
      <td>1.287859e-14</td>
      <td>-7.105427e-15</td>
    </tr>
    <tr>
      <th>14989</th>
      <td>1.065814e-14</td>
      <td>9.503509e-14</td>
      <td>4.440892e-14</td>
      <td>-2.691181e-13</td>
      <td>-7.559287e-12</td>
      <td>-1.694644e-10</td>
      <td>-3.082406e-09</td>
      <td>-4.592275e-08</td>
      <td>-5.604728e-07</td>
      <td>-5.605436e-06</td>
      <td>...</td>
      <td>6.661338e-14</td>
      <td>4.130030e-14</td>
      <td>6.838974e-14</td>
      <td>2.353673e-14</td>
      <td>7.283063e-14</td>
      <td>4.796163e-14</td>
      <td>4.085621e-14</td>
      <td>8.437695e-15</td>
      <td>7.993606e-15</td>
      <td>5.773160e-15</td>
    </tr>
    <tr>
      <th>14990</th>
      <td>1.980638e-13</td>
      <td>3.463896e-14</td>
      <td>-3.197442e-14</td>
      <td>7.371881e-14</td>
      <td>-1.803002e-13</td>
      <td>-7.546852e-12</td>
      <td>-1.694982e-10</td>
      <td>-3.082421e-09</td>
      <td>-4.592262e-08</td>
      <td>-5.604728e-07</td>
      <td>...</td>
      <td>3.597123e-14</td>
      <td>7.638334e-14</td>
      <td>4.130030e-14</td>
      <td>6.039613e-14</td>
      <td>3.064216e-14</td>
      <td>6.217249e-14</td>
      <td>2.398082e-14</td>
      <td>1.598721e-14</td>
      <td>1.332268e-15</td>
      <td>1.509903e-14</td>
    </tr>
    <tr>
      <th>14991</th>
      <td>2.398082e-14</td>
      <td>7.105427e-14</td>
      <td>6.394885e-14</td>
      <td>5.684342e-14</td>
      <td>8.615331e-14</td>
      <td>-2.140510e-13</td>
      <td>-7.561063e-12</td>
      <td>-1.693623e-10</td>
      <td>-3.082425e-09</td>
      <td>-4.592266e-08</td>
      <td>...</td>
      <td>9.237056e-14</td>
      <td>3.597123e-14</td>
      <td>6.838974e-14</td>
      <td>4.840572e-14</td>
      <td>4.973799e-14</td>
      <td>6.661338e-15</td>
      <td>3.730349e-14</td>
      <td>1.687539e-14</td>
      <td>2.309264e-14</td>
      <td>-4.440892e-15</td>
    </tr>
    <tr>
      <th>14992</th>
      <td>-1.270095e-13</td>
      <td>5.329071e-14</td>
      <td>1.598721e-13</td>
      <td>7.638334e-14</td>
      <td>2.309264e-14</td>
      <td>7.194245e-14</td>
      <td>-7.815970e-14</td>
      <td>-7.565504e-12</td>
      <td>-1.694112e-10</td>
      <td>-3.082429e-09</td>
      <td>...</td>
      <td>5.018208e-14</td>
      <td>8.437695e-14</td>
      <td>4.307665e-14</td>
      <td>5.773160e-14</td>
      <td>2.442491e-14</td>
      <td>2.486900e-14</td>
      <td>-4.440892e-16</td>
      <td>4.440892e-14</td>
      <td>1.110223e-14</td>
      <td>7.993606e-15</td>
    </tr>
    <tr>
      <th>14993</th>
      <td>2.930989e-14</td>
      <td>-3.819167e-14</td>
      <td>6.572520e-14</td>
      <td>1.261213e-13</td>
      <td>6.217249e-14</td>
      <td>1.589839e-13</td>
      <td>6.750156e-14</td>
      <td>-1.270095e-13</td>
      <td>-7.569056e-12</td>
      <td>-1.692650e-10</td>
      <td>...</td>
      <td>1.114664e-13</td>
      <td>5.728751e-14</td>
      <td>7.371881e-14</td>
      <td>1.909584e-14</td>
      <td>3.286260e-14</td>
      <td>1.731948e-14</td>
      <td>3.197442e-14</td>
      <td>-6.217249e-15</td>
      <td>2.930989e-14</td>
      <td>1.554312e-14</td>
    </tr>
    <tr>
      <th>14994</th>
      <td>8.881784e-14</td>
      <td>4.174439e-14</td>
      <td>-7.194245e-14</td>
      <td>5.151435e-14</td>
      <td>2.620126e-13</td>
      <td>5.773160e-14</td>
      <td>1.101341e-13</td>
      <td>6.394885e-14</td>
      <td>1.909584e-14</td>
      <td>-7.542411e-12</td>
      <td>...</td>
      <td>6.705747e-14</td>
      <td>1.008083e-13</td>
      <td>3.330669e-14</td>
      <td>4.884981e-14</td>
      <td>1.199041e-14</td>
      <td>3.996803e-14</td>
      <td>1.154632e-14</td>
      <td>1.687539e-14</td>
      <td>-1.776357e-15</td>
      <td>2.131628e-14</td>
    </tr>
    <tr>
      <th>14995</th>
      <td>1.243450e-14</td>
      <td>5.506706e-14</td>
      <td>2.753353e-14</td>
      <td>6.394885e-14</td>
      <td>4.707346e-14</td>
      <td>2.131628e-13</td>
      <td>5.417888e-14</td>
      <td>2.562395e-13</td>
      <td>9.059420e-14</td>
      <td>-8.748557e-14</td>
      <td>...</td>
      <td>9.237056e-14</td>
      <td>4.307665e-14</td>
      <td>7.593925e-14</td>
      <td>2.620126e-14</td>
      <td>5.595524e-14</td>
      <td>6.217249e-15</td>
      <td>2.486900e-14</td>
      <td>1.598721e-14</td>
      <td>8.881784e-15</td>
      <td>-1.731948e-14</td>
    </tr>
    <tr>
      <th>14996</th>
      <td>-3.375078e-14</td>
      <td>-1.776357e-15</td>
      <td>1.909584e-13</td>
      <td>2.309264e-14</td>
      <td>1.509903e-14</td>
      <td>4.352074e-14</td>
      <td>3.592682e-13</td>
      <td>8.082424e-14</td>
      <td>1.496581e-13</td>
      <td>1.065814e-13</td>
      <td>...</td>
      <td>6.128431e-14</td>
      <td>6.750156e-14</td>
      <td>3.597123e-14</td>
      <td>8.304468e-14</td>
      <td>2.042810e-14</td>
      <td>4.085621e-14</td>
      <td>1.065814e-14</td>
      <td>1.687539e-14</td>
      <td>4.440892e-16</td>
      <td>-1.243450e-14</td>
    </tr>
    <tr>
      <th>14997</th>
      <td>-1.421085e-14</td>
      <td>1.021405e-13</td>
      <td>-6.217249e-15</td>
      <td>1.421085e-13</td>
      <td>1.953993e-14</td>
      <td>1.612044e-13</td>
      <td>7.016610e-14</td>
      <td>2.526868e-13</td>
      <td>9.681145e-14</td>
      <td>3.219647e-13</td>
      <td>...</td>
      <td>7.238654e-14</td>
      <td>5.417888e-14</td>
      <td>7.460699e-14</td>
      <td>3.019807e-14</td>
      <td>6.794565e-14</td>
      <td>2.486900e-14</td>
      <td>3.286260e-14</td>
      <td>-4.884981e-15</td>
      <td>-4.440892e-15</td>
      <td>1.776357e-14</td>
    </tr>
    <tr>
      <th>14998</th>
      <td>1.358913e-13</td>
      <td>-1.865175e-14</td>
      <td>5.329071e-14</td>
      <td>-9.769963e-15</td>
      <td>2.882139e-13</td>
      <td>4.618528e-14</td>
      <td>5.462297e-14</td>
      <td>8.615331e-14</td>
      <td>4.249934e-13</td>
      <td>1.145750e-13</td>
      <td>...</td>
      <td>4.130030e-14</td>
      <td>7.949197e-14</td>
      <td>4.840572e-14</td>
      <td>5.950795e-14</td>
      <td>3.463896e-14</td>
      <td>5.995204e-14</td>
      <td>9.325873e-15</td>
      <td>1.154632e-14</td>
      <td>1.243450e-14</td>
      <td>7.993606e-15</td>
    </tr>
    <tr>
      <th>14999</th>
      <td>-4.440892e-15</td>
      <td>8.704149e-14</td>
      <td>-2.220446e-14</td>
      <td>1.993961e-13</td>
      <td>1.687539e-14</td>
      <td>1.816325e-13</td>
      <td>6.217249e-14</td>
      <td>2.269296e-13</td>
      <td>1.039169e-13</td>
      <td>3.357314e-13</td>
      <td>...</td>
      <td>9.725554e-14</td>
      <td>3.552714e-14</td>
      <td>6.439294e-14</td>
      <td>5.284662e-14</td>
      <td>5.151435e-14</td>
      <td>1.909584e-14</td>
      <td>3.863576e-14</td>
      <td>2.664535e-14</td>
      <td>2.398082e-14</td>
      <td>-5.329071e-15</td>
    </tr>
    <tr>
      <th>15000</th>
      <td>-4.884981e-14</td>
      <td>-7.993606e-15</td>
      <td>2.331468e-13</td>
      <td>4.440892e-15</td>
      <td>9.281464e-14</td>
      <td>3.286260e-14</td>
      <td>3.539391e-13</td>
      <td>7.993606e-14</td>
      <td>1.376677e-13</td>
      <td>1.074696e-13</td>
      <td>...</td>
      <td>5.506706e-14</td>
      <td>8.215650e-14</td>
      <td>3.996803e-14</td>
      <td>5.639933e-14</td>
      <td>3.730349e-14</td>
      <td>3.019807e-14</td>
      <td>3.641532e-14</td>
      <td>5.107026e-14</td>
      <td>8.881784e-15</td>
      <td>1.598721e-14</td>
    </tr>
  </tbody>
</table>
<p>15001 rows × 99 columns</p>
</div>




```python
WavE.plot(title='1D Wave Equation')
```

## Heat Equation

\begin{equation}
\frac{\delta^2u}{\delta t^2} = \frac{\delta^2u}{\delta x^2} \ for \ 0\leq x \leq 1 \ and \ 0\leq t \leq 0.2 \\
u(0,t) = g_1(t) = 0 \ for \ 0\leq t \leq 0.2 \\
u(1,t) = g_2(t) = 0 \ for \ 0\leq t \leq 0.2 \\
u(x,0) = f(x) = 4x - 4x^2  \ \ \ for \ 0\leq x \leq 1 \\
where: \\
\Delta x = 0.2 \\ 
\Delta t = 0.02 \\
c^2\frac{\Delta t}{(\Delta x)^2} = 0.5
\end{equation}


```python
xmin, xmax, dx = 0, 1, 0.2
tmin, tmax, dt = 0, 0.2, 0.02
c = 1

I = lambda x: 4*x - 4*(x**2)

Heat = FiniteDiff(I, xmin, xmax, tmin, tmax, c, dx, dt, Heat = True)
Heat.do()
```




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
      <th>3</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>0.640000</td>
      <td>0.960000</td>
      <td>0.960000</td>
      <td>0.640000</td>
    </tr>
    <tr>
      <th>1</th>
      <td>0.480000</td>
      <td>0.800000</td>
      <td>0.800000</td>
      <td>0.480000</td>
    </tr>
    <tr>
      <th>2</th>
      <td>0.400000</td>
      <td>0.640000</td>
      <td>0.640000</td>
      <td>0.400000</td>
    </tr>
    <tr>
      <th>3</th>
      <td>0.320000</td>
      <td>0.520000</td>
      <td>0.520000</td>
      <td>0.320000</td>
    </tr>
    <tr>
      <th>4</th>
      <td>0.260000</td>
      <td>0.420000</td>
      <td>0.420000</td>
      <td>0.260000</td>
    </tr>
    <tr>
      <th>5</th>
      <td>0.210000</td>
      <td>0.340000</td>
      <td>0.340000</td>
      <td>0.210000</td>
    </tr>
    <tr>
      <th>6</th>
      <td>0.170000</td>
      <td>0.275000</td>
      <td>0.275000</td>
      <td>0.170000</td>
    </tr>
    <tr>
      <th>7</th>
      <td>0.137500</td>
      <td>0.222500</td>
      <td>0.222500</td>
      <td>0.137500</td>
    </tr>
    <tr>
      <th>8</th>
      <td>0.111250</td>
      <td>0.180000</td>
      <td>0.180000</td>
      <td>0.111250</td>
    </tr>
    <tr>
      <th>9</th>
      <td>0.090000</td>
      <td>0.145625</td>
      <td>0.145625</td>
      <td>0.090000</td>
    </tr>
    <tr>
      <th>10</th>
      <td>0.072813</td>
      <td>0.117812</td>
      <td>0.117813</td>
      <td>0.072812</td>
    </tr>
  </tbody>
</table>
</div>




```python
Heat.plot(title = '1D Heat Equation')
```

a750cc92d56d74269fa9128d7fd6dd4cca0c5f0d
ipynb
Jupyter Notebook
Numerical Method Codes/PDEs.ipynb
lindleezy/Numerical-Methods
1cb8f65d09f9ae7b00e6530a6960055dcc6c1174
MIT
Numerical Method Codes/PDEs.ipynb
lindleezy/Numerical-Methods
1cb8f65d09f9ae7b00e6530a6960055dcc6c1174
MIT
Numerical Method Codes/PDEs.ipynb
lindleezy/Numerical-Methods
1cb8f65d09f9ae7b00e6530a6960055dcc6c1174
MIT
Qwen/Qwen-72B
1. YES
2. YES