1032: Solving the self-consistency equation of 1D step-index waveguide

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:142 Solved:22

Description

Write a C program to solve the self-consistency equation:

 tan(pi * d / ld *sin(t))-sqrt(cos(tc)*cos(tc)/sin(t)/sin(t)-1) = 0

in which sin(tc) = n2 / n1. 

Find 't' in the region where 0 < pi * d / ld *sin(t) < pi / 2 and t < pi/2-tc

t should be in the unit of degree.

For example,

input: n1 n2 d ld

output: t

The output should round to three digits in the fraction part.



Input

1.5 1.45 14.0 1.55

Output

2.787

Sample Input Copy

1.738 1.124 13.385 1.983 

Sample Output Copy

4.000

HINT

Use bisection method.