PLAY WITH MATH
Play with maths....
Step 1
pip install numpy
Step 2
pip install metaplotlib
Step 3
Write code
CODE
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
a = 19.46
x = np.linspace(-np.sqrt(3.3), np.sqrt(3.3), 1000)
y = x**(2/3) + 0.9 * (3.3 - x**2)**(1/2.0) * np.sin(a * np.pi * x)
fig, ax = plt.subplots()
vk, = ax.plot(x, y)
vk2, = ax.plot(-x, y)
def update(frame):
vk.set_ydata(x(2/3) + 0.9 * (3.3 - x2)**(1/2) * np.sin(a * np.pi * (x + frame/100)))
vk2.set_ydata(x(2/3) + 0.9 * (3.3 - x2)**(1/2) * np.sin(a * np.pi * (-x + frame/100)))
return vk, vk2
ani = FuncAnimation(fig, update, frames=1000, interval=20, blit=True)
fig.suptitle(" PROGRAM WITH VK")
plt.show()
Comments
Post a Comment