let newnextY ?(schema="gauche") ?(n=n) ?(c=c) ?(h=h) y =
(* Array.init (n+1) (fun i ->
y.(i) +. (c /. ( sqrt(h**2. +. (( y.(i) -. y.(iMoins1 i) )**2.) ) ))
) *)
match schema with
| "gauche" ->
(** Schéma gauche. *) |
Array.init (n+1) (fun i ->
y.(i) +. (c /. ( sqrt(h**2. +. (( y.(i) -. y.(iMoins1 i) )**2.) ) ))
)
| "droit" ->
(** Schéma droit. *) |
Array.init (n+1) (fun i ->
y.(i) +. (c /. ( sqrt(h**2. +. (( y.(iPlus1 i) -. y.(i) )**2.) ) ))
)
| "centre" ->
(** Schéma centré. @see <https://fr.wikipedia.org/wiki/Dérivée#D.C3.A9rivation_num.C3.A9rique> Cet article sur Wikipédia. *) |
Array.init (n+1) (fun i ->
y.(i) +. (c /. ( sqrt(h**2. +. 0.5*.(( y.(iPlus1 i) -. y.(iMoins1 i) )**2.) ) ))
)
| _ -> y;