main.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #include "modules/OrthPol.h"
  2. #include <iomanip>
  3. #include <string>
  4. int main()
  5. { std::cout << "Chebyshev Polynomial of the first kind" << std::endl;
  6. std::cout << "------------------------------------------------------------------------" << std::endl;
  7. std::cout << std::setw(2) << "n ";
  8. for (int j=1; j <=5; j++)
  9. {
  10. if (j == 5)
  11. {
  12. std::cout << std::setw(5) << std::left << std::setprecision(8) << j * 0.2 << std::endl;
  13. }
  14. else
  15. {
  16. std::cout << std::setw(5) << std::left << std::setprecision(8) << j * 0.2 << " ";
  17. }
  18. }
  19. std::cout << "------------------------------------------------------------------------" << std::endl;
  20. for (int i=0; i<=20; ++i)
  21. {
  22. std::cout << std::setw(2) << i << " ";
  23. for (int j=1; j <=5; ++j)
  24. {
  25. std::vector<double> res = OrthPol(1, i, j*0.2);
  26. if (j == 5)
  27. {
  28. std::cout << std::to_string(res[0]).substr(0,8) << std::endl;
  29. //std::cout << std::setw(10) << std::right << std::setprecision(8) << res[0] << std::endl;
  30. }
  31. else
  32. {
  33. std::cout << std::to_string(res[0]).substr(0,8) << " ";
  34. //std::cout << std::setw(10) << std::right << std::setprecision(8) << res[0] << " " ;
  35. }
  36. }
  37. }
  38. }