Changeset 1027
 Timestamp:
 Oct 17, 2011, 1:45:40 PM (11 years ago)
 Location:
 trunk/test/math
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

trunk/test/math/remezsolver.h
r1014 r1027 155 155 b = zeroes[i]; 156 156 157 printf("Error for [%g..%g]: ", (double)a, (double)b);158 157 for (;;) 159 158 { … … 184 183 final = e; 185 184 control[i] = (a + b) >> 1; 186 printf("%g (at %g)\n", (double)e, (double)control[i]);187 185 break; 188 186 } … … 291 289 } 292 290 293 printf(" Final polynomial:\n");291 printf("Polynomial estimate:\n"); 294 292 for (int j = 0; j < ORDER + 1; j++) 295 293 { 
trunk/test/math/remez.cpp
r1014 r1027 25 25 26 26 /* The function we want to approximate */ 27 static real myfun(real const &x)27 real myfun(real const &y) 28 28 { 29 real y = sqrt(x);30 return (sin( y)  y) / (x * y);29 real x = sqrt(y); 30 return (sin(x)  x) / (x * y); 31 31 } 32 32 33 static real myerr(real const &x)33 real myerr(real const &y) 34 34 { 35 real y = sqrt(x);36 return re(x * y);35 real x = sqrt(y); 36 return sin(x) / (x * y); 37 37 } 38 38 39 39 int main(void) 40 40 { 41 RemezSolver< 4> solver;42 solver.Run(real::R_1 >> 400, real::R_PI_2 * real::R_PI_2, myfun, myerr, 15);41 RemezSolver<6> solver; 42 solver.Run(real::R_1 >> 400, real::R_PI_2 * real::R_PI_2, myfun, myerr, 40); 43 43 44 44 return EXIT_SUCCESS;
Note: See TracChangeset
for help on using the changeset viewer.