You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
878 B

  1. //
  2. // Lol Engine - Sample math program: Chebyshev polynomials
  3. //
  4. // Copyright: (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
  5. // This program is free software; you can redistribute it and/or
  6. // modify it under the terms of the Do What The Fuck You Want To
  7. // Public License, Version 2, as published by Sam Hocevar. See
  8. // http://sam.zoy.org/projects/COPYING.WTFPL for more details.
  9. //
  10. #if defined HAVE_CONFIG_H
  11. # include "config.h"
  12. #endif
  13. #if USE_SDL && defined __APPLE__
  14. # include <SDL_main.h>
  15. #endif
  16. #include "lol/math/real.h"
  17. #include "lol/math/remez.h"
  18. using lol::real;
  19. using lol::RemezSolver;
  20. /* See the tutorial at http://lol.zoy.org/wiki/doc/maths/remez */
  21. real f(real const &x) { return exp(x); }
  22. real g(real const &x) { return exp(x); }
  23. int main(int argc, char **argv)
  24. {
  25. RemezSolver<4, real> solver;
  26. solver.Run(-1, 1, f, g, 40);
  27. return 0;
  28. }