# Rane-Kutta of order 2

**URL:** https://community.freefem.org/t/rane-kutta-of-order-2/1030
**Category:** FreeFEM installation
**Created:** [June 13, 2021, 1:18pm UTC](https://community.freefem.org/t/rane-kutta-of-order-2/1030 "2021-06-13T13:18:42Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Kamal\_FEM](https://avatars.discourse-cdn.com/v4/letter/k/a4c791/32.png) [@Kamal\_FEM](https://community.freefem.org/u/Kamal_FEM)
#### Post date: [June 13, 2021, 1:18pm UTC](https://community.freefem.org/t/rane-kutta-of-order-2/1030/1 "2021-06-13T13:18:42Z")

</div>

Hi everybody,

I ask about a Freefem++ code of a Runge-Kutta schema of order 2 if there is one available somewhere?  
I used the following code but it doesn’t work:

// Runge - Kutta Scheme of order 2…  
func real [int] RK2( real [int] u, real t)  
{`Preformatted text`  
int N=5 ; // The size of vectors  
real [int] k0 (N), k1 (N), k2 (N); // vectors of size N.  
real t1;  
real [int] uold (N);  
uold = 0.;  
k0=f(uold, t);  
k1 = uold+ k0;  
t1 = t + 0.5\* dt;  
k2 = f(t1,k1);  
u=uold+0.5\*(k0+k2);  
return u ;  
}

Thank you in advance.
