```python
import sympy as sym

t, C = sym.symbols('t,C')
I_c = sym.Function('I_c')(t)
V_c = sym.Function('V_c')(t)
w = sym.Symbol('\omega')

eq=sym.Eq(I_c,C * sym.diff(V_c,t))
#I_c = C * sym.diff(V_c,t)

display(sym.simplify(eq.subs(V_c,sym.sin(w*t))))

```


$\displaystyle \operatorname{I_{c}}{\left(t \right)} = C \omega \cos{\left(\omega t \right)}$



```python
from sympy.solvers import ode
#El voltaje a traves de un condensador de 40µF es de 25[V] en t=0. Si la corriente
# a traves del condensador es una funcion de tiempo dada por i(t)=6*exp(-6*t) mA para t>0
# encontrar v(t)

t, C = sym.symbols('t,C')
C = (40e-6)
Ic = sym.Function('Ic')(t)
Vc = sym.Function('Vc')(t)

Ic = sym.simplify(sym.exp(-6*t)*1e-3)

eq=sym.Eq(Ic,C*Vc.diff(t))
display(eq)

f = ode.dsolve(eq, hint='separable',ics={Vc.subs(t,0):25})
f
```


$\displaystyle 0.001 e^{- 6 t} = 4.0 \cdot 10^{-5} \frac{d}{d t} \operatorname{Vc}{\left(t \right)}$





$\displaystyle \operatorname{Vc}{\left(t \right)} = 29.1666666666667 - 4.16666666666667 e^{- 6 t}$




```python
Vc=f.rhs
Wc=sym.Function('Wc')(t)
Wc=0.5*C*Vc**2
display(sym.simplify(Wc))
```


$\displaystyle 0.0170138888888889 \left(e^{6 t} - 0.142857142857143\right)^{2} e^{- 12 t}$



```python
#Ejemplo 7-6-1
# Encuentre la corriente de un inductor L = 0.1H cuando el voltaje a
#traves del inducor es V=10*t*exp(-5t)

t = sym.symbols('t')
L = (0.1)
Il = sym.Function('Il')(t)
Vl = sym.Function('Vl')(t)
Vl = sym.simplify(10*t*sym.exp(-5*t))
eq=sym.Eq(Vl,L*Il.diff(t))
display(eq)


f = ode.dsolve(eq, hint='separable',ics={Il.subs(t,0):0})
f
```


$\displaystyle 10 t e^{- 5 t} = 0.1 \frac{d}{d t} \operatorname{Il}{\left(t \right)}$





$\displaystyle \operatorname{Il}{\left(t \right)} = - 20.0 t e^{- 5 t} + 4.0 - 4.0 e^{- 5 t}$




```python
Il=sym.simplify(f.rhs)
display(sym.simplify(Il))
```


$\displaystyle \left(- 20.0 t + 4.0 e^{5 t} - 4.0\right) e^{- 5 t}$



```python
sym.plot(Il,(t,0,2))
sym.plot(Vl,(t,0,2))
```


```python
## Circ de Opamp y ec dif lineal
t, K, a = sym.symbols('t, K, a')
x = sym.Function('x')(t)
y = sym.Function('y')(t)

eq = sym.Eq(2*sym.diff(y,t,3)+5*sym.diff(y,t,2)+4*sym.diff(y,t)+3*y,6*x)
display(eq)

f = ode.dsolve(eq.subs(x,K*sym.exp(-a*t)), y)
f
```


$\displaystyle 3 y{\left(t \right)} + 4 \frac{d}{d t} y{\left(t \right)} + 5 \frac{d^{2}}{d t^{2}} y{\left(t \right)} + 2 \frac{d^{3}}{d t^{3}} y{\left(t \right)} = 6 x{\left(t \right)}$





$\displaystyle y{\left(t \right)} = C_{1} e^{\frac{t \left(-10 + \frac{1}{\sqrt[3]{6 \sqrt{318} + 107}} + \sqrt[3]{6 \sqrt{318} + 107}\right)}{12}} \sin{\left(\frac{\sqrt{3} t \left(- \sqrt[3]{6 \sqrt{318} + 107} + \frac{1}{\sqrt[3]{6 \sqrt{318} + 107}}\right)}{12} \right)} + C_{2} e^{\frac{t \left(-10 + \frac{1}{\sqrt[3]{6 \sqrt{318} + 107}} + \sqrt[3]{6 \sqrt{318} + 107}\right)}{12}} \cos{\left(\frac{\sqrt{3} t \left(- \sqrt[3]{6 \sqrt{318} + 107} + \frac{1}{\sqrt[3]{6 \sqrt{318} + 107}}\right)}{12} \right)} + C_{3} e^{\frac{t \left(- \sqrt[3]{6 \sqrt{318} + 107} - 5 - \frac{1}{\sqrt[3]{6 \sqrt{318} + 107}}\right)}{6}} - \frac{6 K e^{- a t}}{2 a^{3} - 5 a^{2} + 4 a - 3}$




```python
#RC Circuito
Vco, R, C, t = sym.symbols('Vco, R, C, t', real=True, positive=True)
Ic = sym.Function('Ic')(t)
Vc = sym.Function('Vc')(t)

eq=sym.Eq(Vco,R*C*sym.diff(Vc,t)+Vc)
display(eq)
f = ode.dsolve(eq, Vc,ics={Vc.subs(t,0):0})
f
```


$\displaystyle Vco = C R \frac{d}{d t} \operatorname{Vc}{\left(t \right)} + \operatorname{Vc}{\left(t \right)}$





$\displaystyle \operatorname{Vc}{\left(t \right)} = Vco - Vco e^{- \frac{t}{C R}}$




```python
#Si resolviera usando LAPLACE
t, s = sym.symbols('t, s')
def L(f):
    return sym.laplace_transform(f, t, s, noconds=True)
def invL(F):
    return sym.inverse_laplace_transform(F, s, t)

VC=Vco/(s*(C*R*s+1))
display(VC)
display(sym.simplify(invL(VC.apart(s))))

```


$\displaystyle \frac{Vco}{s \left(C R s + 1\right)}$



$\displaystyle Vco \theta\left(t\right) - Vco e^{- \frac{t}{C R}} \theta\left(t\right)$



```python

```

5c5924a659417357cbb2b457c843dfd02a03f729
ipynb
Jupyter Notebook
python/0/EDO.ipynb
WayraLHD/SRA21
1b0447bf925678b8065c28b2767906d1daff2023
Apache-2.0
2021-09-29T16:38:53.000Z
2021-09-29T16:38:53.000Z
python/0/EDO.ipynb
WayraLHD/SRA21
1b0447bf925678b8065c28b2767906d1daff2023
Apache-2.0
2021-08-10T08:24:57.000Z
2021-08-10T08:24:57.000Z
python/0/EDO.ipynb
WayraLHD/SRA21
1b0447bf925678b8065c28b2767906d1daff2023
Apache-2.0
Qwen/Qwen-72B
1. YES
2. YES