main.cpp 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #include "modules/Elliptic_integrals.h"
  2. #include <iomanip>
  3. #include <string>
  4. void PrintEF(int index)
  5. {
  6. Elliptic_Integrals EL;
  7. std::cout << "------------------------------------------------------------------------------------------" << std::endl;
  8. std::cout << std::setw(2) << "alpha/phi";
  9. for (int j=0; j <=6; j++)
  10. {
  11. std::cout << std::setw(11) << std::right << std::setprecision(6) << j * 5;
  12. }
  13. std::cout << std::endl;
  14. // std::cout << " ";
  15. for (double alpha = 0; alpha <= 90; alpha = alpha + 2)
  16. {
  17. double k = sin(alpha * M_PI / 180);
  18. if ((int) alpha % 10 == 0 && alpha != 0)
  19. {
  20. std::cout << std::endl;
  21. }
  22. std::cout << std::setw(9) << int(alpha) << ' ';
  23. for (double phi = 0; phi <= 30; phi = phi + 5)
  24. {
  25. std::vector<double> res = EL.Elliptic(phi, k);
  26. std::cout << std::fixed << std::setprecision(8) << res[index] << " ";
  27. }
  28. std::cout << std::endl;
  29. }
  30. std::cout << "------------------------------------------------------------------------------------------" << std::endl;
  31. std::cout << std::setw(2) << "alpha/phi";
  32. for (int j=7; j <=12; j++)
  33. {
  34. std::cout << std::setw(11) << std::right << std::setprecision(6) << j * 5;
  35. }
  36. std::cout << std::endl;
  37. // std::cout << " ";
  38. for (double alpha = 0; alpha <= 90; alpha = alpha + 2)
  39. {
  40. double k = sin(alpha * M_PI / 180);
  41. if ((int) alpha % 10 == 0 && alpha != 0)
  42. {
  43. std::cout << std::endl;
  44. }
  45. std::cout << std::setw(9) << int(alpha) << ' ';
  46. for (double phi = 35; phi <= 60; phi = phi + 5)
  47. {
  48. std::vector<double> res = EL.Elliptic(phi, k);
  49. std::cout << std::fixed << std::setprecision(8) << res[index] << " ";
  50. }
  51. std::cout << std::endl;
  52. }
  53. std::cout << "------------------------------------------------------------------------------------------" << std::endl;
  54. std::cout << std::setw(2) << "alpha/phi";
  55. for (int j=13; j <=18; j++)
  56. {
  57. std::cout << std::setw(11) << std::right << std::setprecision(6) << j * 5;
  58. }
  59. std::cout << std::endl;
  60. // std::cout << " ";
  61. for (double alpha = 0; alpha <= 90; alpha = alpha + 2)
  62. {
  63. double k = sin(alpha * M_PI / 180);
  64. if ((int) alpha % 10 == 0 && alpha != 0)
  65. {
  66. std::cout << std::endl;
  67. }
  68. std::cout << std::setw(9) << int(alpha) << ' ';
  69. for (double phi = 65; phi <= 90; phi = phi + 5)
  70. {
  71. std::vector<double> res = EL.Elliptic(phi, k);
  72. std::cout << std::fixed << std::setprecision(8) << res[index] << " ";
  73. }
  74. std::cout << std::endl;
  75. }
  76. std::cout << "------------------------------------------------------------------------------------------" << std::endl;
  77. }
  78. int main()
  79. {
  80. std::cout << "------------------------------------------------------------------------------------------" << std::endl;
  81. std::cout << "Elliptic integral of the first kind F(phi, sin(alpha))" << std::endl;
  82. std::cout << "------------------------------------------------------------------------------------------" << std::endl;
  83. PrintEF(0);
  84. std::cout << "------------------------------------------------------------------------------------------" << std::endl;
  85. std::cout << "Elliptic integral of the second kind E(phi, sin(alpha))" << std::endl;
  86. std::cout << "------------------------------------------------------------------------------------------" << std::endl;
  87. PrintEF(1);
  88. }