```python
from sympy.interactive import printing
printing.init_printing(use_latex= True)
from sympy import *
import sympy as sp

x =sp.Symbol('x')

f = sp.Function('f')(x)

diffeq = Eq(f.diff(x,x)-5*f,0)
display(diffeq)

dsolve(diffeq,f)
```


```python
import numpy as np
from scipy.integrate import odeint
%matplotlib inline
import matplotlib.pyplot as plt
```


```python
def firstorder(y,t,K,u):
    tau =5.0
    K = 2.0
    u = 1.0
    dydt =(-y +K*u)/tau
    return dydt
    
```


```python
t= np.linspace(0,10,11)
K = 2.0
u = 1.0

```


```python
y = odeint(firstorder,0,t,args=(K,u))

```


```python
plt.plot(t,y)
plt.title("Solving First Order D.E. in Python")
plt.xlabel("time")
plt.ylabel("values")
plt.show()
```


```python
import numpy as np
from scipy.integrate import odeint
%matplotlib inline
import matplotlib.pyplot as plt
```


```python
import numpy as np
import pandas as pd
from scipy.integrate import odeint
import matplotlib.pyplot as plt

def model(y,t):
    k = 0.045
    dydt = k * (100 - y)
    return dydt
y0 = 50


t = np.linspace(0,25)

y = odeint(model,y0,t)

plt.plot(t,y)
plt.xlabel('time')
plt.ylabel('y(t)')
plt.show()

Y = np.squeeze(np.asarray(y))
a = np.squeeze(np.asarray(t))
print(Y)
print(a)




```


```python
import numpy as np
import pandas as pd
from scipy.integrate import odeint
import matplotlib.pyplot as plt

def temperature(T,t):
    k = 0.045
    dTdt = k * (100 - T)
    return dTdt
y0 = 50


t = np.linspace(0,25)

y = odeint(temperature,y0,t)

plt.plot(t,y)
plt.xlabel('time')
plt.ylabel('T(t)')
plt.show()

Y = np.squeeze(np.asarray(T))
A = np.squeeze(np.asarray(t))
print(Y)
print(A)


```


```python
## 15 . 4 dakikada kaç derece olduğunu elle bulduk##
```


```python
import numpy as np
import pandas as pd
from scipy.integrate import odeint
import matplotlib.pyplot as plt

def model(y,t):
    k = 0.045
    dydt = k * (100 - y)
    return dydt
y0 = 68.41004006


t = np.linspace(10.20408163,15.4,2)

y = odeint(model,y0,t)

plt.plot(t,y)
plt.xlabel('time')
plt.ylabel('y(t)')
plt.show()

Y = np.squeeze(np.asarray(y))
T = np.squeeze(np.asarray(t))
print(Y)
print(T)


```


```python
## analitik solution https://youtu.be/xOzjeBaNfgo###
```


```python
from sympy.interactive import printing
printing.init_printing(use_latex= True)
from sympy import *
import sympy as sp

t =sp.Symbol('t')

y = sp.Function('y')(t)

diffeq = Eq(y.diff(t) * 10,-t*y)
display(diffeq)

dsolve(diffeq,y)
```


```python
## numeric solution https://youtu.be/xOzjeBaNfgo ##
```


```python
import numpy as np
import pandas as pd
from scipy.integrate import odeint
import matplotlib.pyplot as plt

def model(y,t):
    k = 10
    dydt = -t*y / k
    return dydt
y0 = 5


t = np.linspace(0,20,2)

y = odeint(model,y0,t)

plt.plot(t,y)
plt.xlabel('time')
plt.ylabel('y(t)')
plt.show()

Y = np.squeeze(np.asarray(y))
T = np.squeeze(np.asarray(t))
print(Y)
print(T)

```

ed32ffda9d7cc942ec8709d726da6ae5e247e698
ipynb
Jupyter Notebook
Basic_Dif_Equ_Solving.ipynb
ugursakarya0707/Solving_DifferantialEquations_withPython
7d640330f5695b8267c706b9be82c2115c358bee
MIT
2020-11-14T19:53:30.000Z
2020-11-14T19:53:30.000Z
Basic_Dif_Equ_Solving.ipynb
ugursakarya0707/Solving_DifferantialEquations_withPython
7d640330f5695b8267c706b9be82c2115c358bee
MIT
Basic_Dif_Equ_Solving.ipynb
ugursakarya0707/Solving_DifferantialEquations_withPython
7d640330f5695b8267c706b9be82c2115c358bee
MIT
Qwen/Qwen-72B
1. YES
2. YES