let nextY ?(schema="gauche") ?(n=n) ?(c=c) ?(h=h) yold ynew =
for i = 0 to n do
match schema with
| "gauche" ->
(** Schéma gauche. *) |
ynew.(i) <- yold.(i) +. (c /. ( sqrt(h**2. +. (( yold.(i) -. yold.(iMoins1 i) )**2.) ) ))
| "droit" ->
(** Schéma droit. *) |
ynew.(i) <- yold.(i) +. (c /. ( sqrt(h**2. +. (( yold.(iPlus1 i) -. yold.(i) )**2.) ) ))
| "centré" ->
(** Schéma centré. @see <https://fr.wikipedia.org/wiki/Dérivée#D.C3.A9rivation_num.C3.A9rique> Cet article sur Wikipédia. *) |
ynew.(i) <- yold.(i) +. (c /. ( sqrt(h**2. +. 0.5*.(( yold.(iPlus1 i) -. yold.(iMoins1 i) )**2.) ) ))
| _ -> ();
done