# Bell's theorem: Malus's law simulation

## Recommended Posts

Malus's law simulation algorithm:

L1= (rand()%100 < ((cos(P1) * cos(P1)) * 100)) ? 1:0
L2= (rand()%100 < ((cos(P2) * cos(P2)) * 100)) ? 1:0

Using Malus's law calculate probability of photon L1 passing through polarizer P1, and L2 through P2. If random number between 0 and 100 is less than photon's probability percentage the photon goes through (= 1), otherwise it gets blocked (= 0).

if (L1 == L2) MATCH++ else MISMATCH++
RESULT= (MATCH - MISMATCH)/(N_MEASURE/100))

If both L1 and L2 passed through (1 = 1) or both got stopped (0 = 0) increase matching pairs counter, otherwise increase opposite pairs counter. That's all, just like in the experiment. Here is roughly what's happening with 100 photon pairs sequences:

Example (-25,25):
P1= -25 -> Malus's law -> 82% ~ 82 out of 100
P2= 25 -> Malus's law -> 82% ~ 82 out of 100

0111110011 1111111011 1111100111 1111111111 1111111110 1101111011 0111101110 1111111111 1111111111 1111101111
1111111111 1110111011 1111001111 1111111101 0111111101 0011011111 1011111011 1111110001 1110001111 1101110111

match= 71
mismatch= 29
num_data= 100
Result: (71-29)/(100/100) = 42%

QM prediction: cos^2(50) * 100 = 41.32%

I thought this was supposed to be impossible, classical physics simulating QM prediction?

##### Share on other sites

rand() function will give you always the same results each time program is run, if you dont use srand().

You should use srand(time(NULL)); before the first execution.

Two rand() in row

print rand();

print rand();

will always give the same value of second rand().

Malus was living in XVIII-XIX century, when there was no QM yet.

http://en.wikipedia.org/wiki/%C3%89tienne-Louis_Malus

If you would have linear polarized photons, and correctly adjusted polarization filter, you would see 100% of photons passing through. And 0% passing through after rotating polarization filter by 90 degree.

http://www.scienceforums.net/topic/80366-particle-location/?p=783255

Edited by Sensei

##### Share on other sites

QM is often similar to classical physics. For one, it has to give the same result in some circumstances where classical physics is excellent. Then, for photons, you can most often compute the field exactly as a classical wave, and add photon behaviour only at emission and absorption, only if needed.

The equations for a photon's wave are the equations of electromagnetics. So much that most people allege that the E field is the photon's wavefunction - that's sometimes not enough.

##### Share on other sites

rand() function will give you always the same results each time program is run, if you dont use srand().

You should use srand(time(NULL)); before the first execution.

Yes, there is srand(), here is the whole program:

#include <math.h>
#include <time.h>
#include <stdio.h>

void main()
{
int         N_REPEAT= 100000;
float       P1=                  30;        // <--- polarizer-1
float       P2=                  30;        // <--- polarizer-2

Init_Setup:;
system("cls");
printf("\Repeat #: 100,000");
printf("\nAngle polarizer P1: "); scanf("%f", &P1);
printf("Angle polarizer P2: "); scanf("%f", &P2);

srand(time(NULL));
int         N_MEASURE= 0;
int         MATCH= 0;
int         MISMATCH= 0;

// relative angle & radian conversion
float       REL_P1= 0.0174533* (P1-P2)/2;
float       REL_P2= 0.0174533* (P2-P1)/2;

BEGIN:;
int L1= ((rand()%201)/2 < ((cos(REL_P1)*cos(REL_P1))*100)) ? 1:0;
int L2= ((rand()%201)/2 < ((cos(REL_P2)*cos(REL_P2))*100)) ? 1:0;

printf("\n %d%d", L1, L2);
if (L1 == L2) MATCH++; else MISMATCH++;
if (++N_MEASURE < N_REPEAT) goto BEGIN;

printf("\n\n1.)\n--- MALUS LAW INTEGRATION (%.0f,%.0f) ---", P1, P2);
printf("\nMATCH: %d\nMISMATCH: %d", MATCH, MISMATCH);
printf("\nMalus(%d): %.0f%%", abs((int)((P1-P2)/2)), ((cos(REL_P1)*cos(REL_P1))*100));
printf("\n>>> STATISTICAL AVERAGE RESULT: %.2f%%", (float)abs(MATCH-MISMATCH)/(N_MEASURE/100));

// Exact probabilty equation
float T= cos(REL_P1)*cos(REL_P2);
float F= 1.0 - T;

float MCH= (T*T)+(F*F);
float MSM= (T*F)+(F*T);

printf("\n\n\n2.)\n--- MALUS LAW PROBABILTY (%.0f,%.0f) ---", (P1-P2)/2, (P2-P1)/2);
printf("\nMATCH: %.2f%%\nMISMATCH: %.2f%%", MCH*100, MSM*100);
printf("\n>>> EXACT PROBABILTY RESULT: %.2f%%", (MCH-MSM)*100);

printf("\n\nPress any key to repeat.");
getch(); goto Init_Setup;
}



If you would have linear polarized photons, and correctly adjusted polarization filter, you would see 100% of photons passing through. And 0% passing through after rotating polarization filter by 90 degree.

Yes, it gives correct results for any combination of agles of the two polarizers. The more measurements there are, the more results get stable and converge to QM prediction: cos^2(theta).

There is also an exact solution, like calculating probability of matching pairs in two-coins toss sequences.

//Malus's law probability for relative angle theta(P1,P2)
REL_P1= (P1-P2)/2
REL_P2= (P2-P1)/2

T= cos(REL_P1)*cos(REL_P2)
F= 1.0 - T

MACH= (T*T)+(F*F)
MISM= (T*F)+(F*T)

RESULT= (MACH-MISM)*100 = CORRELATION %

Take this experiment for example:

2.)

"Foreground polarizer" P1= +30

"Background polarizer" P2= 0

REL_P1= (30-0)/2= +15

REL_P2= (0-30)/2= -15

T= cos(+15) * cos(-15) = 0.933

F= 1.0 - T = 0.067

MACH= (0.933 * 0.933) + (0.067 * 0.067) = 0.875

MISM= (0.933 * 0.067) + (0.067 * 0.933) = 0.125

RESULT= (0.875 - 0.125) * 100 = 75% correlation = 25% discordance

4.)

"Foreground polarizer" P1= +30

"Background polarizer" P2= -30

REL_P1= (30+30)/2= +30

REL_P2= (-30-30)/2= -30

T= cos(+30) * cos(-30) = 0.75

F= 1.0 - T = 0.25

MACH= (0.75 * 0.75) + (0.25 * 0.25) = 0.625

MISM= (0.75 * 0.25) + (0.25 * 0.75) = 0.375

RESULT= (0.625 - 0.375) * 100 = 25% correlation = 75% discordance

## Create an account

Register a new account