90 | | a0 = -1.66666666666658080941942898789420724e-1; |
91 | | a1 = +8.33333333326271609442503773834687308e-3; |
92 | | a2 = -1.98412698200591143928364634696492885e-4; |
93 | | a3 = +2.75573160733868922065738227278330896e-6; |
94 | | a4 = -2.50518513021429359590028300127165228e-8; |
95 | | a5 = +1.60472959182597740337401201006549498e-10; |
96 | | a6 = -7.36458957326227991327065122848667046e-13; |
| 90 | a0 = -1.666666666666580938362041558393413542600e-1; |
| 91 | a1 = +8.333333333262715528278347301093116699226e-3; |
| 92 | a2 = -1.984126982005911547055378498482154233331e-4; |
| 93 | a3 = +2.755731607338689059680115311170244593349e-6; |
| 94 | a4 = -2.505185130214293461336864464029272975945e-8; |
| 95 | a5 = +1.604729591825977276746033955401272849354e-10; |
| 96 | a6 = -7.364589573262279656101943192883347174447e-13; |
| 97 | |
| 98 | E = 1.098969630370672683831702893969063712485e-16; |
135 | | a0 = -1.666666666666666587374325845020415990185e-1; |
136 | | a1 = +8.333333333333133768001243698120735518527e-3; |
137 | | a2 = -1.984126984109960366729319073763957206143e-4; |
138 | | a3 = +2.755731915499171528179303925040423384803e-6; |
139 | | a4 = -2.505209340355388148617179634180834358690e-8; |
140 | | a5 = +1.605725287696319345779134635418774782711e-10; |
141 | | a6 = -7.535968124281960435283756562793611388136e-13; |
| 137 | a0 = -1.666666666666618655330686951220600109093e-1; |
| 138 | a1 = +8.333333333285509269011390197274270193963e-3; |
| 139 | a2 = -1.984126982504390943378441670654599796999e-4; |
| 140 | a3 = +2.755731659890484005079622148869365590255e-6; |
| 141 | a4 = -2.505188017067512158000464673183918592305e-8; |
| 142 | a5 = +1.604809231079007402834515514014751626424e-10; |
| 143 | a6 = -7.373308642081174610234470417310065337523e-13; |
| 144 | |
| 145 | E = 1.536616934979294924070319645582179175464e-16; |
| 147 | |
| 148 | === Another example === |
| 149 | |
| 150 | Trying to reproduce [http://www.insomniacgames.com/remez-exchange-algorithm/ Mike Acton]'s experimental result: |
| 151 | |
| 152 | {{{ |
| 153 | #!latex |
| 154 | \[\max_{x \in [-1, 1]}{\dfrac{\big\vert\sin(\frac\pi{2}x) - P(x)\big\vert}{|\sin(\frac\pi{2}x)|}} = E\] |
| 155 | }}} |
| 156 | |
| 157 | Using `P(x) = xQ(x²)`: |
| 158 | |
| 159 | {{{ |
| 160 | #!latex |
| 161 | \[\max_{y \in [0, 1]}{\dfrac{\bigg\lvert\dfrac{\sin(\frac\pi{2}\sqrt{y})}{\sqrt{y}} - Q(y)\bigg\rvert}{\bigg\lvert\dfrac{\sin(\frac\pi{2}y)}{\sqrt{y}}\bigg\rvert}} = E\] |
| 162 | }}} |
| 163 | |
| 164 | {{{ |
| 165 | #!cpp |
| 166 | static real myfun(real const &y) |
| 167 | { |
| 168 | real x = sqrt(y); |
| 169 | return sin(real::R_PI_2 * x) / x; |
| 170 | } |
| 171 | |
| 172 | RemezSolver<4> solver; |
| 173 | solver.Run(real::R_1 >> 400, real::R_1, myfun, myfun, 40); |
| 174 | }}} |
| 175 | |
| 176 | {{{ |
| 177 | #!cpp |
| 178 | a0 = +1.570796318452974170937444182514099057668; |
| 179 | a1 = -6.459637106518004316895285560913086847441e-1; |
| 180 | a2 = +7.968967893119537554369879233657335437244e-2; |
| 181 | a3 = -4.673766402124326801818077428151491285886e-3; |
| 182 | a4 = +1.514849803879821510688050931907848092814e-4; |
| 183 | |
| 184 | E = 5.310632770140865101487747414605249755889e-9; |
| 185 | }}} |