Update from HH
[Flyspeck/.git] / legacy / oldnonlinear / nonlinear / main_ineq_calcs.ml
1 #directory "/Users/thomashales/Desktop/googlecode/flyspeck/glpk";;
2 #use "sphere.ml";;
3
4
5   open Sphere_math;;
6
7   let arc = arclength;;
8
9   let rec binary_rec f a b eps = 
10     let fa = f a in 
11       if abs_float (fa) < eps then a
12       else 
13         let c = (a +. b) /. 2. in
14         let fc = f c in
15           (if (fa *. fc <= 0.0) then binary_rec f a c eps 
16            else binary_rec f c b eps);;
17
18   let binary f a b eps = 
19     let _ = (a < b) or failwith "a b inversion" in
20     let _ = f a *. f b <= 0.0 or failwith "same sign" in
21       binary_rec f a b eps;;
22
23   let length_of_arc theta = 
24       binary (fun x -> arc 2. 2. x -. theta) 2.0 4.0 (10.0** -8.0);;
25
26   let tame_table_d r s = 
27     if (r + 2 * s <= 3) then 0.0
28     else
29       let r' = float_of_int r in
30       let s' = float_of_int s in
31         0.103 *. (2.0 -. s') +. 0.2759 *. (r' +. 2.0 *. s' -. 4.0);;
32
33 tame_table_d 3 1;;
34 tame_table_d 2 2;;
35 (* "2065952723 A1" 
36 15.53 is the upper bound on the deforming edge.
37 Let's check that two adjacent standard edges fit within this bound.
38 Conclusion, whenever there is a pair of adjacent standard edges, they
39 are extremal 2 or 2.52; EXCEPT in something that starts out a hexagon
40 or protracted pent with two adjacent flats.
41 *)
42
43   let check_206A1_constant = 
44     let u = 2.0 *. arc 2. 2. 2.52 in
45     let m =  length_of_arc u in
46     let m2 = m*.m in
47       (m2 < 15.53);;  (* 15.319 *)
48
49   let check_206A1_protracted51 = 
50     let u = arc 2. 2. 2.52 +. arc 2. 2. sqrt8 in
51     let m = length_of_arc u in
52     let m2 = m*.m in
53       m2;;
54       (m2 < 15.53);;  (* 15.319 *)
55
56   let factoid1 = (* generic fans except for hexagons *)
57     let u = arc 2. 2. cstab +. arc 2. 2. 2.52 in 
58       u < pi;;  (* u = 3.0668... *)
59
60   let two_flats_arc_min = 2.0 *. arc 2.52 2. 2. +. arc 2. 2. 2.;;
61
62 dihedral;;
63 arc 2. 2. 2.52;;
64 Pervasives.cos 1.364;;
65 Pervasives.cos 2.98;;
66 arc 2. 2. 2. +. arc 2. 2. 2. +. arc 2.52 2. 2.;;
67 arc 2. 2.52 4.0;;  
68 let dih = dih_y;;
69   dih 2.52 2. 2.