Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 

54 Zeilen
1.1 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 "core.h"
  15. using namespace lol;
  16. static int const ORDER = 12;
  17. static int cheby[ORDER][ORDER];
  18. static void make_table()
  19. {
  20. memset(cheby[0], 0, ORDER * sizeof(int));
  21. cheby[0][0] = 1;
  22. memset(cheby[1], 0, ORDER * sizeof(int));
  23. cheby[1][1] = 1;
  24. for (int i = 2; i < ORDER; i++)
  25. {
  26. cheby[i][0] = -cheby[i - 2][0];
  27. for (int j = 1; j < ORDER; j++)
  28. cheby[i][j] = 2 * cheby[i - 1][j - 1] - cheby[i - 2][j];
  29. }
  30. }
  31. int main(int argc, char **argv)
  32. {
  33. make_table();
  34. for (int i = 0; i < ORDER; i++)
  35. {
  36. for (int j = 0; j < ORDER; j++)
  37. printf("% 5i ", cheby[i][j]);
  38. printf("\n");
  39. }
  40. return EXIT_SUCCESS;
  41. }