clear all
clc
close all
N = 1000;
f = zeros(N, 1);
deltat = 0.0001;
f(1) = 1;
n = 1;
while n <= N - 1
  m1   = - f(n)
  prov = f(n) + m1 * deltat;
  m2   = - prov
  m    = (m1 + m2) / 2
  f(n+1) = f(n) + m * deltat;
  n += 1;
end
