Question: make a python program that does the following: For inputs, you will prompt the user to enter (in this order): Indices of refraction for the

make a python program that does the following:

For inputs, you will prompt the user to enter (in this order):

Indices of refraction for the two media. Input them as lists or tuples (i.e one line input).

Incoming angle 1 in degrees (1 value).

Vertical distances through the media from the point where the light ray starts (d1, d2, in Figure 1). Again, these will be input as lists or tuples.

After entering the values, you need to check them for obvious errors. Next, calculate and output the final horizontal distance (d3 in Figure 1). If the ray will not pass between media (i.e., it gets reflected), your program should display an error and terminate. Your file should be named

equation 1= n*sin()=n2*sin()

may use diffrent equation if wish

Enter indices of refraction for bottom two media:

1.26 1.33

Enter angle of incidence (in degrees):

48

Enter d1 and d2 (units):

1 1

Ending distance is:

2.102 units

Enter indices of refraction for bottom two media:

2 1

Enter angle of incidence (in degrees):

40

Enter d1, d2 (units):

1.25 2.3

Error, no refraction in the second media

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!