Matplotlib - Pyplot PLT Numpy NP Scipy Sympy: # Imprimir Con Notación Matemática

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

%matplotlib inline

import matplotlib.pyplot as plt


import numpy as np
from scipy import integrate
from sympy import *
# imprimir con notación matemática.
init_printing(use_latex='mathjax')
# Definiendo las incógnitas
t = symbols('t')
x = Function('x')
C1 = symbols('C1')
C2 = symbols('C2')

Eq(x(t).diff(t,t)+8*x(t).
,→diff(t)+128*x(t))

d d2
128x (t) + 8 x (t) + 2 x (t) = 0
dt dt

dsolve(x(t).diff(t,t)+8*x(t).
,→diff(t)+128*x(t))

  √   √ 
x (t) = C1 sin 4 7t + C2 cos 4 7t e−4t

diff((C1*sin(4*sqrt(7)*t)+

C2*cos(4*sqrt(7)*t))*exp(-4*t),t)
  √   √ 
−4 C1 sin 4 7t + C2 cos 4 7t e−4t +
 √  √  √  √ 
4 7C1 cos 4 7t − 4 7C2 sin 4 7t e−4t

linsolve([C2-1,
,→-4*C2+4*sqrt(7)*C1-0], (C1, C2))

( √ !)
7
, 1
7

Ecuación final:

((sqrt(7)/7)sin(4sqrt(7)t)+1cos(4sqrt(7)t))exp(-4t)

from numpy import


,→arange,sin,cos,exp,pi

x=arange(0.0,2*pi,0.01)
y=(0.377964473*sin((4*7**(1/
,→2))*x)+cos((4*7**(1/

,→2))*x))*exp(-4*x)

plt.plot(x,y)
plt.grid(True)
plt.ylabel('Desplazamiento')
plt.xlabel('tiempo')
plt.show()

You might also like