@@ -154,7 +154,6 @@ public: | |||||
if (i < ORDER + 1) | if (i < ORDER + 1) | ||||
b = zeroes[i]; | b = zeroes[i]; | ||||
printf("Error for [%g..%g]: ", (double)a, (double)b); | |||||
for (;;) | for (;;) | ||||
{ | { | ||||
real c = a, delta = (b - a) >> 3; | real c = a, delta = (b - a) >> 3; | ||||
@@ -183,7 +182,6 @@ public: | |||||
if (e > final) | if (e > final) | ||||
final = e; | final = e; | ||||
control[i] = (a + b) >> 1; | control[i] = (a + b) >> 1; | ||||
printf("%g (at %g)\n", (double)e, (double)control[i]); | |||||
break; | break; | ||||
} | } | ||||
} | } | ||||
@@ -290,7 +288,7 @@ public: | |||||
an[i] *= k2p[i]; | an[i] *= k2p[i]; | ||||
} | } | ||||
printf("Final polynomial:\n"); | |||||
printf("Polynomial estimate:\n"); | |||||
for (int j = 0; j < ORDER + 1; j++) | for (int j = 0; j < ORDER + 1; j++) | ||||
{ | { | ||||
if (j) | if (j) | ||||
@@ -24,22 +24,22 @@ using namespace std; | |||||
#include "remez-solver.h" | #include "remez-solver.h" | ||||
/* The function we want to approximate */ | /* The function we want to approximate */ | ||||
static real myfun(real const &x) | |||||
real myfun(real const &y) | |||||
{ | { | ||||
real y = sqrt(x); | |||||
return (sin(y) - y) / (x * y); | |||||
real x = sqrt(y); | |||||
return (sin(x) - x) / (x * y); | |||||
} | } | ||||
static real myerr(real const &x) | |||||
real myerr(real const &y) | |||||
{ | { | ||||
real y = sqrt(x); | |||||
return re(x * y); | |||||
real x = sqrt(y); | |||||
return sin(x) / (x * y); | |||||
} | } | ||||
int main(void) | int main(void) | ||||
{ | { | ||||
RemezSolver<4> solver; | |||||
solver.Run(real::R_1 >> 400, real::R_PI_2 * real::R_PI_2, myfun, myerr, 15); | |||||
RemezSolver<6> solver; | |||||
solver.Run(real::R_1 >> 400, real::R_PI_2 * real::R_PI_2, myfun, myerr, 40); | |||||
return EXIT_SUCCESS; | return EXIT_SUCCESS; | ||||
} | } | ||||