let mu = 5.0 let hybrid vdp_c() = (x, y) where rec der x = y init 1.0 and der y = (mu *. (1.0 -. (x *. x)) *. y) -. x init 1.0 let node forward(h)(x0, x') = x where rec x = x0 fby (x +. h *. x') let node backward(h)(x0, x') = x where rec x = x0 -> pre x +. h *. x' let node vdp_d(h)() = (x, y) where rec x = backward(h)(1.0, y) and y = forward(h)(1.0, (mu *. (1.0 -. (x *. x)) *. y) -. x) let stop_time = 50.0 let node print (t, (x, y)) = print_endline (String.concat ",\t" (List.map string_of_float [t;x;y])) let node main_d() = let rec t = 0.0 -> pre t +. 0.001 in print(t, vdp_d(0.001)()) let node main_dc() = let rec (t0, (x0, y0)) = ((0.0 -> pre t0 +. 0.1), vdp_d(0.1)()) in let rec (t1, (x1, y1)) = ((0.0 -> pre t1 +. 0.2), vdp_d(0.2)()) in let rec (t2, (x2, y2)) = ((0.0 -> pre t2 +. 0.3), vdp_d(0.3)()) in let rec (t3, (x3, y3)) = ((0.0 -> pre t3 +. 0.4), vdp_d(0.4)()) in let rec (t4, (x4, y4)) = ((0.0 -> pre t4 +. 0.5), vdp_d(0.5)()) in let rec (t5, (x5, y5)) = ((0.0 -> pre t5 +. 0.6), vdp_d(0.6)()) in let rec (t6, (x6, y6)) = ((0.0 -> pre t6 +. 0.7), vdp_d(0.7)()) in let rec (t7, (x7, y7)) = ((0.0 -> pre t7 +. 0.8), vdp_d(0.8)()) in let rec (t8, (x8, y8)) = ((0.0 -> pre t8 +. 0.9), vdp_d(0.9)()) in let rec (t9, (x9, y9)) = ((0.0 -> pre t9 +. 1.0), vdp_d(1.0)()) in print_endline (String.concat "\t" [string_of_float t0; "x0"; string_of_float x0; "y0"; string_of_float y0]); print_endline (String.concat "\t" [string_of_float t1; "x1"; string_of_float x1; "y1"; string_of_float y1]); print_endline (String.concat "\t" [string_of_float t2; "x2"; string_of_float x2; "y2"; string_of_float y2]); print_endline (String.concat "\t" [string_of_float t3; "x3"; string_of_float x3; "y3"; string_of_float y3]); print_endline (String.concat "\t" [string_of_float t4; "x4"; string_of_float x4; "y4"; string_of_float y4]); print_endline (String.concat "\t" [string_of_float t5; "x5"; string_of_float x5; "y5"; string_of_float y5]); print_endline (String.concat "\t" [string_of_float t6; "x6"; string_of_float x6; "y6"; string_of_float y6]); print_endline (String.concat "\t" [string_of_float t7; "x7"; string_of_float x7; "y7"; string_of_float y7]); print_endline (String.concat "\t" [string_of_float t8; "x8"; string_of_float x8; "y8"; string_of_float y8]); print_endline (String.concat "\t" [string_of_float t9; "x9"; string_of_float x9; "y9"; string_of_float y9]) let input _ = () let vdp_s = Solve.solve_sundials vdp_c let node main_c() = let o = run vdp_s (Some (Solve.make(stop_time, input)) fby None) in Solve.period'_t 1.0 print o