Optical Optimization#3827

Optical Optimization

1 sekondë
64 megabajt
E vështirë

The state of a linearly polarized laser beam is represented by a pair of equal and opposite 2D vectors (blue), parametrized by (E,\theta), where E \geq 0 is the beam's field strength and 0^\circ \leq \theta < 180^\circ is the beam's polarization angle. This representation is illustrated on the right:

A polarization filter is represented by a line (red) through the origin, parametrized by its filter angle , 0^\circ \leq \varphi < 180^\circ. When a filter is applied to a beam (E_a, \theta_a), a new beam (E_b, \theta_b) emerges, evaluated by:

E_b = E_a |\cos(\theta_a - \varphi)|, \theta_b = \varphi.

That is, the new beam loses strength and takes on the angle of the filter. Geometrically, the opposing vectors represented by (E_a,\theta_a) are "orthogonally projected" onto the line represented by , forming new opposing vectors (E_b,\theta_b), as shown on the left:

Let us begin with a beam (E_0, \theta_0) = (1, 0^\circ). If we apply a filter \varphi_y = 90^\circ, we obtain a beam (E_y, \theta_y) = (\cos(90^\circ), 90^\circ) = (0, 90^\circ), i.e., a beam with zero strength.

Suppose we have another filter \xi_x = 45^\circ, and we apply it to (E_0,\theta_0) before applying \varphi_y = 90^\circ. We would obtain (E_x,\theta_x) = (\cos(45^\circ), 45^\circ) first, followed by (E_y,\theta_y) = (\cos^2(45^\circ), 90^\circ) = (0.5, 90^\circ). Therefore, adding an extra filter can increase the strength of the final beam! This is illustrated by a double projection:

In this problem, we wish to pass a beam (E_0, \theta_0) = (1, 0^\circ) sequentially through fixed filters \varphi_1, \varphi_2, \ldots, \varphi_m. The intermediate beam emerging from filter \varphi_i is (E_i, \theta_i) = (E_i, \varphi_i). We also have extra filters that can have any angle and can be placed before any fixed filter. Our objective is to find the maximum possible output field strength E_m.

Suppose each fixed filter \varphi_i is allotted k_i extra filters that interact first with the beam (E_{i-1}, \theta_{i-1}) (n = k_1 + k_2 + \ldots + k_m). The k_i extra filters before \varphi_i will have angles that evenly span between \theta_{i-1} and \theta_i = \varphi_i, along the acute (or right) angle between \theta_{i-1} and \varphi_i. An example with k_i = 3 is shown on the right:

Using this method, the following formula can be derived:

where f(\Delta,k) for 0^\circ \leq \Delta < 180^\circ and k \geq 0 is defined as:

If k_i = 0 (no extra filter is inserted), the formula degenerates to E_i = E_{i-1} |\cos(\theta_i - \theta_{i-1})|.

Since (E_0, \theta_0) = (1, 0^\circ), the expression for the final output strength is:

Given , , and \varphi_1, \varphi_2, \ldots, \varphi_m, your task is to compute the maximum possible E_m.

Hyrja

The first input line contains the number of test cases , 1 \leq N \leq 100.

Each test case begins with integers and , separated by a space. lines follow, each containing an integer \varphi_i (for 1 \leq i \leq m).

- is the number of fixed filters, 1 \leq m \leq 10. - is the number of extra filters, 0 \leq n \leq 100. - \varphi_i is the filter angle (in degrees) for the -th fixed filter, 0 \leq \varphi_i < 180.

Note: Remember to convert degrees to radians before using .

Dalja

For each test case, print the maximum possible magnitude for E_m, with 8 decimal places.

Shembuj

Shembulli 1

Loading
Loading