25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

43 lines
845 B

  1. //
  2. // Lol Engine - Sample math program: Chebyshev polynomials
  3. //
  4. // Copyright: (c) 2005-2013 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://www.wtfpl.net/ for more details.
  9. //
  10. #if defined HAVE_CONFIG_H
  11. # include "config.h"
  12. #endif
  13. #include "core.h"
  14. #include <lol/math/real.h>
  15. #include <lol/math/remez.h>
  16. using lol::real;
  17. using lol::RemezSolver;
  18. /* See the tutorial at http://lol.zoy.org/wiki/doc/maths/remez */
  19. real f(real const &x)
  20. {
  21. return exp(x);
  22. }
  23. real g(real const &x)
  24. {
  25. return exp(x);
  26. }
  27. int main(int argc, char **argv)
  28. {
  29. UNUSED(argc, argv);
  30. RemezSolver<4, real> solver;
  31. solver.Run(-1, 1, f, g, 40);
  32. return 0;
  33. }