How it works ...

The solution is an array with shape (101, 2). The first column is theta(t), and the second is omega(t). The following code plots both components.

We can see it in the following code:

import matplotlib.pyplot as plt
plt.plot(t, sol[:, 0], 'b', label='theta(t)')
plt.plot(t, sol[:, 1], 'g', label='omega(t)')
plt.legend(loc='best')
plt.xlabel('t')
plt.grid()
plt.show()

The final result is this:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset