/* * Tests Joy Christian's 3-sphere model for the EPR-Bohm correlation */ /** * * @author Chantal Roth-Korosten, 2013 (Java version) * Translated into javascript by Daniel Sabsay 2013 * **/ /* whether to Math.Pick a and b on a plane or on the sphere */ PICK_AB_VECTORS_ON_SPHERE = false; /* whether to Math.PIck e on a plane or on the sphere - default must be SPHERE! */ PICK_E_VECTORS_ON_SPHERE = true; /* constant phase shifts */ PHI_OP = 0.000; // in radians PHI_OQ = 0.000; // in radians PHI_OR = -1.517; // in radians PHI_OS = 0.663; // in radians PLUS_TYPE = 0; TOTAL_TYPE = 1; MINUS_TYPE = 2; NEITHER_TYPE = 3; max_angle = 2*Math.PI; deltaAngle = 1.0; // in degrees buckets = parseInt(max_angle/deg2rad(deltaAngle)); databuckets = []; // [PLUS_TYPE,TOTAL_TYPE] for (j=0;j<=buckets;j++) databuckets[databuckets.length] = [0,0]; /* # of trials per experiment */ number_of_trials = 5000000; document.getElementById("count").innerHTML = number_of_trials; totalcount = 0; for (i=0;i 0) { // if plus databuckets[bucket][PLUS_TYPE]++; } else { // if !plus databuckets[bucket][PLUS_TYPE]--; } } } function getBucket(angleDeg) { return parseInt(Math.abs(angleDeg)/deltaAngle); } function deg2rad(deg) { return deg*Math.PI/180; } function rad2deg(rad) { return rad*180/Math.PI; } function drawResults() { var canvas = document.getElementById("canvas"); if (null==canvas || !canvas.getContext) return; var ctx = canvas.getContext("2d"); var x0 = 0.5 + 0.5*canvas.width; // x0 pixels from left to x=0 var y0 = 0.5 + 0.5*canvas.height; // y0 pixels from top to y=0 var max_bucket = databuckets.length-1; var xx, yy, dx = canvas.width/max_bucket; ctx.strokeStyle = "red"; ctx.lineWidth = .4; ctx.beginPath(); yscale = max_bucket/4*canvas.height/number_of_trials; for (var i=0;i