25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 

47 satır
974 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. #include <cstring>
  14. #include <cstdio>
  15. #include "core.h"
  16. using namespace lol;
  17. using namespace std;
  18. #include "remez-matrix.h"
  19. #include "remez-solver.h"
  20. /* The function we want to approximate */
  21. static real myfun(real const &x)
  22. {
  23. real y = sqrt(x);
  24. return (sin(y) - y) / (x * y);
  25. }
  26. static real myerr(real const &x)
  27. {
  28. real y = sqrt(x);
  29. return re(x * y);
  30. }
  31. int main(void)
  32. {
  33. RemezSolver<4> solver;
  34. solver.Run(real::R_1 >> 400, real::R_PI_2 * real::R_PI_2, myfun, myerr, 15);
  35. return EXIT_SUCCESS;
  36. }