輸入兩個數的幾何平均值與調和平均值,快速計算這兩個數。
假設這兩個數為 \( x \) 和 \( y \),已知它們的幾何平均值 \( G \) 和調和平均值 \( H \)。
幾何平均值(Geometric Mean)是兩個數的積的平方根,公式為: \( G = \sqrt{x \cdot y} \)
調和平均值(Harmonic Mean)是兩個數的倒數的平均數的倒數,公式為: \( H = \frac{2xy}{x + y} \)
對幾何平均值進行轉換,算出這兩個數的乘積: \( x \cdot y = G^2 \) 把乘積代入到調和平均值公式中,計算\( x \) 與 \( y \)的和: \( x + y = \frac{2xy}{H} \) \( x + y = \frac{2G^2}{H} \) 利用和積公式構建二次方程:: \( t^2 - \frac{2G^2}{H}t + G^2 = 0 \) 通過求解這個二次方程,就可以得到 \( x \) 和 \( y \): \( t = \frac{ \frac{2G^2}{H} \pm \sqrt{( \frac{2G^2}{H})^2 - 4 \cdot G^2}}{2} \)
解答:
1. 計算乘積:
\( x \cdot y = 12^2 = 144 \)
2. 計算總和:
\( x + y = \frac{2 \cdot 12^2}{7.2} = \frac{2 \cdot 144}{7.2} = 40 \)
3. 構建二次方程:
\( t^2 - 40t + 144 = 0 \)
4. 二次方程求解:
\( t = \frac{40 \pm \sqrt{40^2 - 4 \cdot 144}}{2} = \frac{40 \pm \sqrt{1600 - 576}}{2} = \frac{40 \pm \sqrt{1024}}{2} \)
\( t_1 = \frac{40 + \sqrt{1024}}{2} = 36 \)
\( t_2 = \frac{40 - \sqrt{1024}}{2} = 4 \)
結果:這兩個數是 36 和 4。
解答:
1. 計算乘積:
\( x \cdot y = 6^2 = 36 \)
2. 計算總和:
\( x + y = \frac{2 \cdot 6^2}{\frac{72}{13}} = \frac{2 \cdot 36}{\frac{72}{13}} = \frac{72 \cdot 13}{72} = 13 \)
3. 構建二次方程:
\( t^2 - 13t + 36 = 0 \)
4. 二次方程求解:
\( t = \frac{13 \pm \sqrt{13^2 - 4 \cdot 36}}{2} = \frac{13 \pm \sqrt{169 - 144}}{2} = \frac{13 \pm \sqrt{25}}{2} \)
\( t_1 = \frac{13 + \sqrt{25}}{2} = 9 \)
\( t_2 = \frac{13 - \sqrt{25}}{2} = 4 \)
結果:這兩個數是 9 和 4。