# rk.py # Runge-Kutta per equazioni non autonome # in una variabile. def rungekuttaphi (f,t,x,h): hd2=float(h)/2; v0=f(t,x); v1=f(t+hd2,x+hd2*v0) v2=f(t+hd2,x+hd2*v1); v3=f(t+h,x+h*v2) return (v0+2*v1+2*v2+v3)/6