407051: GYM102697 022 Detector Building

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

022. Detector Buildingtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Uh oh! You are working on building an analog thermometer using nonlinear components, so how can you calibrate your temperature sensor with test data? You can use a form of nonlinear regression in the form of the Steinhart-Hart equation, an equation designed to explain the relation between the electrical resistance of a solid and its temperature. While this task may sound difficult, it is actually quite simple using the equation. The Steinhart-Hart equation itself has three calculated constants(A,B, and C), and takes in a value R, which is the resistance of the metal.

The equation is represented as:

$$$\frac1T = A + B(lnR) + C(lnR)^3$$$

This equation is useful for the process of actual temperature determination, but we still need to calculate the constants A, B, and C before we can use it. To find these values, we must first find three resistance to temperature data points, which are usually discovered through experimentation. For this problem, these data points will be provided and you will be required to find the A, B, and C constants. The process of finding these values involves calculating a series of equations. These equations are as follows:

$$$L_1 = lnR_1$$$

$$$L_2 = lnR_2$$$

$$$L_3 = lnR_3$$$

$$$Y_1 = \frac{1}{T_1}$$$

$$$Y_2 = \frac{1}{T_2}$$$

$$$Y_3 = \frac{1}{T_3}$$$

$$$\gamma_2 = (Y_2-Y_1)/(L_2-L_1)$$$

$$$\gamma_3 = (Y_3-Y_1)/(L_3-L_1)$$$

$$$C = ((\gamma_3-\gamma_2)/(L_3-L_2))*(L1+L2+L3)^{-1}$$$

$$$B = \gamma_2-C(L_1^2+L_1L_2+L_2^2)$$$

$$$A = Y_1 - L_1(B+L_1^2C)$$$

For this problem, you will be given R1, R2, R3, T1, T2, and T3. You are tasked with then calculating the value for A, you will not have to return B and C considering that a valid number for A will imply correct values for B and C.

Input

The double values T1, T2, T3, R1, R2, and R3 will be each provided sequentially on a separate line.

Output

A double representing the value of A

ExampleInput
1
50
100
50000
25000
15000
Output
72.6660018932261
Note

Do not worry about precision or rounding, as there is some tolerance in the solution checking. Also, remember that you can calculate the natural log of a number using math.log in Python or Math.log in Java. In addition, some of the provided equations require variables from previous equations, so you will need to solve them in order.

加入题单

算法标签: