feat: a LOT of stuff (final report, examples, simulation of a single assert, move from node instances to node definitions, etc.)
This commit is contained in:
parent
ba5db5bd99
commit
f2c545ce2c
49 changed files with 12377 additions and 1898 deletions
|
|
@ -3,6 +3,16 @@ let epsilon = 0.0001
|
|||
|
||||
let input _ = ()
|
||||
|
||||
let time t = t
|
||||
|
||||
let hybrid fsin t = s where der s = cos t init 0.0
|
||||
let hybrid fcos t = c where der c = -. (sin t) init 1.0
|
||||
let hybrid fboth t = (s, c) where (s, c) = (fsin t, fcos t)
|
||||
|
||||
let fsind = Solve.solve_sundials(fsin)
|
||||
let fcosd = Solve.solve_sundials(fcos)
|
||||
let fbothd = Solve.solve_sundials(fboth)
|
||||
|
||||
let hybrid sincos() =
|
||||
let rec der sin = cos init 0.0
|
||||
and der cos = -. sin init 1.0
|
||||
|
|
@ -22,38 +32,36 @@ let ball_ode45 = Solve.solve_ode45(ball)
|
|||
let ball_sundials = Solve.solve_sundials(ball)
|
||||
let ball_both = Solve.synchr(ball_ode45)(ball_sundials)
|
||||
|
||||
let node print_ball_both (now, (y1, y2)) =
|
||||
print_float(now); print_string("\t");
|
||||
print_float(y1); print_string("\t");
|
||||
print_float(y2); print_string("\n");
|
||||
()
|
||||
let node print1 (now, v) =
|
||||
print_float(now); print_string "\t";
|
||||
print_float v; print_string "\n"
|
||||
|
||||
let node print_sincos (now, (sin, cos)) =
|
||||
let node print2 (now, (l, r)) =
|
||||
print_float now; print_string "\t";
|
||||
print_float sin; print_string "\t";
|
||||
print_float cos; print_string "\n"
|
||||
print_float l; print_string "\t";
|
||||
print_float r; print_string "\n"
|
||||
|
||||
let node print_sincos2 (now, ((sin1, cos1), (sin2, cos2))) =
|
||||
let node print22 (now, ((ll, rl), (lr, rr))) =
|
||||
print_float now; print_string "\t";
|
||||
print_float sin1; print_string "\t";
|
||||
print_float sin2; print_string "\t";
|
||||
print_float cos1; print_string "\t";
|
||||
print_float cos2; print_string "\n"
|
||||
print_float ll; print_string "\t";
|
||||
print_float lr; print_string "\t";
|
||||
print_float rl; print_string "\t";
|
||||
print_float rr; print_string "\n"
|
||||
|
||||
let node check_sincos (now, (sin, cos)) =
|
||||
print_sincos (now, (sin, cos));
|
||||
print2 (now, (sin, cos));
|
||||
sin <= 1.0 +. epsilon && sin >= -1.0 -. epsilon &&
|
||||
cos <= 1.0 +. epsilon && cos >= -1.0 -. epsilon
|
||||
|
||||
let node check_sincos2 (now, ((sin1, cos1), (sin2, cos2))) =
|
||||
print_sincos2 (now, ((sin1, cos1), (sin2, cos2)));
|
||||
print22 (now, ((sin1, cos1), (sin2, cos2)));
|
||||
sin1 <= 1.0 +. epsilon && sin1 >= -1.0 -. epsilon &&
|
||||
cos1 <= 1.0 +. epsilon && cos1 >= -1.0 -. epsilon &&
|
||||
sin2 <= 1.0 +. epsilon && sin2 >= -1.0 -. epsilon &&
|
||||
cos2 <= 1.0 +. epsilon && cos2 >= -1.0 -. epsilon
|
||||
|
||||
let node main() =
|
||||
let input = Some (Solve.make (30.0, input)) fby None in
|
||||
let o = run sincos_sundials input in
|
||||
Solve.check_t 100 check_sincos o
|
||||
let input = Some (Solve.make (100.0, time)) fby None in
|
||||
let o = run fbothd input in
|
||||
Solve.iter_t 100 print2 o
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue