Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

51 строка
1.0 KiB

  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. #include <cstring>
  14. #include <cstdio>
  15. #if USE_SDL && defined __APPLE__
  16. # include <SDL_main.h>
  17. #endif
  18. #include "core.h"
  19. using namespace lol;
  20. using namespace std;
  21. #include "remez-matrix.h"
  22. #include "remez-solver.h"
  23. /* The function we want to approximate */
  24. real myfun(real const &y)
  25. {
  26. real x = sqrt(y);
  27. return (sin(x) - x) / (x * y);
  28. }
  29. real myerr(real const &y)
  30. {
  31. real x = sqrt(y);
  32. return sin(x) / (x * y);
  33. }
  34. int main(int argc, char **argv)
  35. {
  36. RemezSolver<6> solver;
  37. solver.Run(real::R_1 >> 400, real::R_PI_2 * real::R_PI_2, myfun, myerr, 40);
  38. return EXIT_SUCCESS;
  39. }