<reponame>RocketRedNeck/PythonPlayground
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 17 13:41:28 2018

@author: mtkes
"""

import numpy as np
from scipy.integrate import odeint
import matplotlib.pyplot as plt

# function that returns dy/dt
def model(y,t):
    k = 0.3
    dydt = -k * y
    return dydt

# initial condition
y0 = 5

# time points
t = np.linspace(0,20)

# solve ODE
y = odeint(model,y0,t)

# plot results
plt.plot(t,y)
plt.xlabel('time')
plt.ylabel('y(t)')
plt.show()
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 17 13:41:28 2018

@author: mtkes
"""

import numpy as np
from scipy.integrate import odeint
import matplotlib.pyplot as plt

# function that returns dy/dt
def model(y,t):
    k = 0.3
    dydt = -k * y
    return dydt

# initial condition
y0 = 5

# time points
t = np.linspace(0,20)

# solve ODE
y = odeint(model,y0,t)

# plot results
plt.plot(t,y)
plt.xlabel('time')
plt.ylabel('y(t)')
plt.show()
# -*- coding: utf-8 -*- Created on Fri Aug 17 13:41:28 2018  @author: mtkes # function that returns dy/dt # initial condition # time points # solve ODE # plot results