From 8e74f954c662d89ae34a5724b391537f80f4498a Mon Sep 17 00:00:00 2001 From: Johannes Middeke Date: Thu, 5 May 2016 12:55:05 -0400 Subject: [PATCH] Added a file to render the result of the probability experiment. --- makeHTMLprobability.ml | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 makeHTMLprobability.ml diff --git a/makeHTMLprobability.ml b/makeHTMLprobability.ml new file mode 100644 index 0000000..6c94e7e --- /dev/null +++ b/makeHTMLprobability.ml @@ -0,0 +1,56 @@ +#use "topfind";; +#require "tools";; +#use "commonSVG.ml";; + +(* The data from the GCD experiment: *) + +let data = [1,24.79; 2,31.24; 3,33.56; 4,33.75; 5,33.24; 6,33.48; 7,34.32; 8,32.09; 9,32.89; 10,33.11; 11,33.34; 12,33.43; 13,33.76; 14,33.67; 15,33.41; 16,33.78; 17,32.08; 18,33.64; 19,33.00; 20,33.61; 21,33.22; 22,34.21; 23,33.77; 24,32.64; 25,32.82; 26,32.99; 27,33.72; 28,33.71; 29,33.73; 30,33.37; 31,33.68; 32,33.66; 33,32.99; 34,32.88; 35,33.70; 36,33.05; 37,33.66; 38,33.10; 39,32.91; 40,32.68; 41,32.89; 42,32.99; 43,34.05; 44,33.62; 45,34.33; 46,32.94; 47,32.98; 48,33.40; 49,33.06; 50,33.21; 51,33.63; 52,33.99; 53,33.17; 54,32.84; 55,33.29; 56,33.34; 57,33.49; 58,32.81; 59,32.75; 60,33.04; 61,33.62; 62,33.68] + +let average = List.map snd data |> Statistics.mean + +(* (List.map snd data |> List.fold_left (+.) 0.) /. float + (List.length data) *) + + +let description () = Printf.printf " + + + +

+ This graph shows the probability that $$\\frac{\\gcd(a,b)}{\\gcd(a,b,c)}$$ + is non-trivial for randomly chosen \\(a,b,c \\in \\mathrm{GF}(2)[x]\\) + of degree at most \\(n\\). For each degree we used 10.000 samples. +

+ +

+ The average probability was %.2f%%. +

" average + + + let main total predict = + let coords = map_coords ~width:100. ~height:100. in + head "Non-Trivial Prediction" "Non-Trivial Prediction over GF(2)[x]"; + defs total predict; + ticks coords ~x:65 ~step_x:5 ~y:90 ~step_y:10 (); + axes "n" "Probability"; + let (x1,y1) = coords (0.,average) and (x2,y2) = coords (100.,average) in + Printf.printf "" + x1 y1 x2 y2 predict; + Printf.printf " + %.2f%% + " + x2 y2 predict average; + data + |> List.map (fun (n,t) -> (float n, t)) + |> graph coords total "probability"; + description (); + foot () + + +(* "#353E5E" "#661B1B"*) + +let () = main "#353E5E" "#C2A5A5" -- 2.1.4