27 lines
569 B
Text
27 lines
569 B
Text
(*
|
|
let hybrid g () = (sin, cos) where
|
|
rec der sin = cos init 0.0
|
|
and der cos = -. sin init 1.0
|
|
|
|
let hybrid f () =
|
|
let der t = 1.0 init 0.0 in
|
|
let sin, cos = g () in
|
|
let z = period (0.01) in
|
|
present z -> (
|
|
print_float t;
|
|
print_string "\t";
|
|
print_float sin;
|
|
print_string "\t";
|
|
print_float cos;
|
|
print_newline ()
|
|
); ()
|
|
*)
|
|
let h = 0.01
|
|
|
|
let node integr(x0, x') = (x) where
|
|
rec x = x0 -> pre(x +. x' *. h)
|
|
|
|
let node sincos() = (now, sin, cos) where
|
|
rec sin = integr(0.0, cos)
|
|
and cos = integr(1.0, -. sin)
|
|
and now = integr(0.0, 1.0)
|