#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue May 14 12:11:53 2024

@author: schaedle
"""

import numpy as np
import matplotlib.pyplot as plt

from scipy.integrate import solve_ivp

def exponential_decay(t, y): 
    return -0.5 * y


t_span = [0,10]
y0 = np.array([2,4,8])

sol = solve_ivp(exponential_decay, t_span, y0 ,method='RK45')


print(sol.t)
print(sol.y)

import ivp as awp

loes45 = awp.solve_ivp(exponential_decay, t_span, y0 ,method='RK45')

print(loes45.t)
print(loes45.y)

loes34 = awp.solve_ivp(exponential_decay, t_span, y0 ,method='RK34')

print(loes34.t)
print(loes34.y)

fig, ax = plt.subplots()
ax.plot(sol.t,sol.y.T,'x')
ax.plot(loes45.t,loes45.y.T,'o')
ax.plot(loes34.t,loes34.y.T,'*')