Napište funkci, která počítá rozvoj funkce arcsin x {\displaystyle \arcsin x} pro − 1 ≤ x ≤ 1. {\displaystyle -1\leq x\leq 1.}
arcsin x = x + 1 2 ⋅ x 3 3 + 1 ⋅ 3 2 2 ⋅ 2 ! ⋅ x 5 5 + 1 ⋅ 3 ⋅ 5 2 3 ⋅ 3 ! ⋅ x 7 7 + … {\displaystyle \arcsin x=x+{1 \over 2}\cdot {x^{3} \over 3}+{{1\cdot 3} \over {2^{2}\cdot 2!}}\cdot {x^{5} \over 5}+{{1\cdot 3\cdot 5} \over {2^{3}\cdot 3!}}\cdot {x^{7} \over 7}+\ldots }
Zkontrolujte s využitím standardní funkce std::asin(double)
Poznámka: Protože uvedený rozvoj numericky špatně konverguje pro hodnoty x {\displaystyle x} blížíci se +-1, je vhodné pro argumenty | x | ∈< 0.5 , 1 > {\displaystyle |x|\in <0.5,1>} použít vztah arcsin x = π / 2 − 2 ∗ arcsin ( 1 − x ) / 2 ) {\displaystyle \arcsin x=\pi /2-2*\arcsin {\sqrt {(1-x)/2)}}}
[ Zpět | C++ ]