title: My differential equation solver not solving the differential equation
body: <p>I'm trying to solve ODE using euler method 1 (<a href="https://en.wikipedia.org/wiki/Euler_method" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Euler_method</a>). But my code isn't solving anything. The code is very similar to my teacher, to the point that I can't find any significant difference. Can anybody help?</p>
  <pre><code>enter from math import *
  import numpy as np
  import matplotlib.pyplot as plt 
  
  def funkce(y, t):
   return(-y)
  
  def euler_1(dt, y, t, funkce ):
   y = y + dt * funkce(y, t)
   t = t + dt
   return (y,t)
  
  def solver(y0, t0, tstop, dt, typ):
   y = y0
   t = t0
   ys = [y]
   ts = [t]
  while (t &lt; tstop):
     (y,t) = typ(dt, y, t, funkce)
     ts.append(t)
     ys.append(y)
   return(ys,ts) 
  
  plt.plot(solver(1, 0, 50, 0.05, euler_1))
  t = np.linspace(0, 5, 50)
  y = np.exp(-t)
  plt.plot(t, y)
  
  plt.show()
  </code></pre>
  <p>Note: the last plot is to compare to the analytical solution.
  You can find the plot output <a href="https://i.stack.imgur.com/y6cff.png" rel="nofollow noreferrer">here</a>.
  When I retun from solver y and t instead of ys,ts it just show the last line of ys and ts.</p>
  <p>Any help apreciated.</p>