In [ ]:
import numpy as np
import matplotlib.pyplot as plt
from sympy.interactive import printing
from sympy import Eq, Derivative, Function, symbols, integrate, lambdify, dsolve
printing.init_printing()
In [ ]:
t, g, f, ix = symbols('t g f i_x', nonzero=True, constant=True)
u = Function('u')(t)
v = Function('v')(t)
time = np.arange(0, 10.)
subs = [(g, -9.8), (ix, 1e-1)]
In [ ]:
dudt = Eq(Derivative(u, t), -g*ix)
dudt
In [ ]:
ut = integrate(dudt, t)
ut
In [ ]:
X = integrate(dudt, t, t)
X
In [ ]:
func = ut.subs(subs)
func = lambdify(t, func.rhs, "numpy")
vel = func(time)
func = X.subs([(g, -9.8), (ix, 1e-1)])
func = lambdify(t, func.rhs, "numpy")
des = func(time)
fig, (ax0, ax1) = plt.subplots(nrows=2, figsize=(8, 4), sharex=True)
ax0.grid(True)
ax0.plot(time, vel)
ax0.set_ylabel(r'Velocidade [m s$^{-1}$]')
ax1.grid(True)
ax1.plot(time, des)
ax1.set_xlabel('Tempo [s]')
ax1.set_ylabel(r'Deslocamento [m]')
Como seria uma gráfico $x, y$ da trajetória da partícula?