1 (* code automatically generated from Parse_ineq.ocaml_code *)
3 module Sphere_math = struct
5 let sqrt = Pervasives.sqrt
7 let pi = 4.0 *. atan(1.0);;
8 let sqrt2 = sqrt (2.) ;;
11 let sqrt8 = sqrt (8.) ;;
14 let delta_x (x1) (x2) (x3) (x4) (x5) (x6) = ((x1 *. (x4 *. ((-. x1) +. (x2 +. ((x3 -. x4) +. (x5 +. x6)))))) +. ((x2 *. (x5 *. ((x1 -. x2) +. (x3 +. ((x4 -. x5) +. x6))))) +. (((((x3 *. (x6 *. (x1 +. ((x2 -. x3) +. (x4 +. (x5 -. x6)))))) -. (x2 *. (x3 *. x4))) -. (x1 *. (x3 *. x5))) -. (x1 *. (x2 *. x6))) -. (x4 *. (x5 *. x6)))));;
17 let delta_y (y1) (y2) (y3) (y4) (y5) (y6) = delta_x ((y1 *. y1)) ((y2 *. y2)) ((y3 *. y3)) ((y4 *. y4)) ((y5 *. y5)) ((y6 *. y6)) ;;
20 let delta_x4 (x1) (x2) (x3) (x4) (x5) (x6) = ((((-. x2) *. x3) -. (x1 *. x4)) +. ((x2 *. x5) +. (((x3 *. x6) -. (x5 *. x6)) +. (x1 *. ((-. x1) +. (x2 +. ((x3 -. x4) +. (x5 +. x6))))))));;
23 let delta_x6 (x1) (x2) (x3) (x4) (x5) (x6) = ((((-. x1) *. x2) -. (x3 *. x6)) +. ((x1 *. x4) +. (((x2 *. x5) -. (x4 *. x5)) +. (x3 *. ((-. x3) +. (x1 +. ((x2 -. x6) +. (x4 +. x5))))))));;
26 let ups_x (x1) (x2) (x6) = (((((-. x1) *. x1) -. (x2 *. x2)) -. (x6 *. x6)) +. ((2. *. (x1 *. x6)) +. ((2. *. (x1 *. x2)) +. (2. *. (x2 *. x6)))));;
29 let eta_x (x1) (x2) (x3) = sqrt (((x1 *. (x2 *. x3)) /. ups_x (x1) (x2) (x3) )) ;;
32 let eta_y (y1) (y2) (y3) = eta_x ((y1 *. y1)) ((y2 *. y2)) ((y3 *. y3)) ;;
35 let dih_x (x1) (x2) (x3) (x4) (x5) (x6) = (( pi /. 2.) +. atan2 ((-. delta_x4 (x1) (x2) (x3) (x4) (x5) (x6) )) ( sqrt ((4. *. (x1 *. delta_x (x1) (x2) (x3) (x4) (x5) (x6) ))) ) );;
38 let dih_y (y1) (y2) (y3) (y4) (y5) (y6) = dih_x ((y1 *. y1)) ((y2 *. y2)) ((y3 *. y3)) ((y4 *. y4)) ((y5 *. y5)) ((y6 *. y6)) ;;
41 let dih2_y (y1) (y2) (y3) (y4) (y5) (y6) = dih_y (y2) (y1) (y3) (y5) (y4) (y6) ;;
44 let dih3_y (y1) (y2) (y3) (y4) (y5) (y6) = dih_y (y3) (y1) (y2) (y6) (y4) (y5) ;;
47 let sol_x (x1) (x2) (x3) (x4) (x5) (x6) = ( dih_x (x1) (x2) (x3) (x4) (x5) (x6) +. ( dih_x (x2) (x3) (x1) (x5) (x6) (x4) +. ( dih_x (x3) (x1) (x2) (x6) (x4) (x5) -. pi )));;
50 let sol_y (y1) (y2) (y3) (y4) (y5) (y6) = ( dih_y (y1) (y2) (y3) (y4) (y5) (y6) +. ( dih_y (y2) (y3) (y1) (y5) (y6) (y4) +. ( dih_y (y3) (y1) (y2) (y6) (y4) (y5) -. pi )));;
53 let interp (x1) (y1) (x2) (y2) (x) = (y1 +. ((x -. x1) *. ((y2 -. y1) /. (x2 -. x1))));;
56 let ly (y) = interp (2.) (1.) (2.52) (0.) (y) ;;
59 let const1 = ( sol_y (2.) (2.) (2.) (2.) (2.) (2.) /. pi );;
62 let rho (y) = (1. +. ( const1 -. ( const1 *. ly (y) )));;
65 let rhazim (y1) (y2) (y3) (y4) (y5) (y6) = ( rho (y1) *. dih_y (y1) (y2) (y3) (y4) (y5) (y6) );;
68 let lnazim (y1) (y2) (y3) (y4) (y5) (y6) = ( ly (y1) *. dih_y (y1) (y2) (y3) (y4) (y5) (y6) );;
71 let taum (y1) (y2) (y3) (y4) (y5) (y6) = (( sol_y (y1) (y2) (y3) (y4) (y5) (y6) *. (1. +. const1 )) -. ( const1 *. ( lnazim (y1) (y2) (y3) (y4) (y5) (y6) +. ( lnazim (y2) (y3) (y1) (y5) (y6) (y4) +. lnazim (y3) (y1) (y2) (y6) (y4) (y5) ))));;
74 let arclength (a) (b) (c) = (( pi /. 2.) +. atan2 ((((c *. c) -. (a *. a)) -. (b *. b))) ( sqrt ( ups_x ((a *. a)) ((b *. b)) ((c *. c)) ) ) );;