12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- #include "modules/Elliptic_integrals.h"
- #include <iomanip>
- #include <string>
- void PrintEF(int index)
- {
- Elliptic_Integrals EL;
- std::cout << "------------------------------------------------------------------------------------------" << std::endl;
- std::cout << std::setw(2) << "alpha/phi";
- for (int j=0; j <=6; j++)
- {
- std::cout << std::setw(11) << std::right << std::setprecision(6) << j * 5;
- }
- std::cout << std::endl;
- // std::cout << " ";
- for (double alpha = 0; alpha <= 90; alpha = alpha + 2)
- {
- double k = sin(alpha * M_PI / 180);
- if ((int) alpha % 10 == 0 && alpha != 0)
- {
- std::cout << std::endl;
- }
- std::cout << std::setw(9) << int(alpha) << ' ';
- for (double phi = 0; phi <= 30; phi = phi + 5)
- {
- std::vector<double> res = EL.Elliptic(phi, k);
- std::cout << std::fixed << std::setprecision(8) << res[index] << " ";
- }
- std::cout << std::endl;
- }
- std::cout << "------------------------------------------------------------------------------------------" << std::endl;
- std::cout << std::setw(2) << "alpha/phi";
- for (int j=7; j <=12; j++)
- {
- std::cout << std::setw(11) << std::right << std::setprecision(6) << j * 5;
- }
- std::cout << std::endl;
- // std::cout << " ";
- for (double alpha = 0; alpha <= 90; alpha = alpha + 2)
- {
- double k = sin(alpha * M_PI / 180);
- if ((int) alpha % 10 == 0 && alpha != 0)
- {
- std::cout << std::endl;
- }
- std::cout << std::setw(9) << int(alpha) << ' ';
- for (double phi = 35; phi <= 60; phi = phi + 5)
- {
- std::vector<double> res = EL.Elliptic(phi, k);
- std::cout << std::fixed << std::setprecision(8) << res[index] << " ";
- }
- std::cout << std::endl;
- }
- std::cout << "------------------------------------------------------------------------------------------" << std::endl;
- std::cout << std::setw(2) << "alpha/phi";
- for (int j=13; j <=18; j++)
- {
- std::cout << std::setw(11) << std::right << std::setprecision(6) << j * 5;
- }
- std::cout << std::endl;
- // std::cout << " ";
- for (double alpha = 0; alpha <= 90; alpha = alpha + 2)
- {
- double k = sin(alpha * M_PI / 180);
- if ((int) alpha % 10 == 0 && alpha != 0)
- {
- std::cout << std::endl;
- }
- std::cout << std::setw(9) << int(alpha) << ' ';
- for (double phi = 65; phi <= 90; phi = phi + 5)
- {
- std::vector<double> res = EL.Elliptic(phi, k);
- std::cout << std::fixed << std::setprecision(8) << res[index] << " ";
- }
- std::cout << std::endl;
- }
- std::cout << "------------------------------------------------------------------------------------------" << std::endl;
- }
- int main()
- {
- std::cout << "------------------------------------------------------------------------------------------" << std::endl;
- std::cout << "Elliptic integral of the first kind F(phi, sin(alpha))" << std::endl;
- std::cout << "------------------------------------------------------------------------------------------" << std::endl;
- PrintEF(0);
- std::cout << "------------------------------------------------------------------------------------------" << std::endl;
- std::cout << "Elliptic integral of the second kind E(phi, sin(alpha))" << std::endl;
- std::cout << "------------------------------------------------------------------------------------------" << std::endl;
- PrintEF(1);
- }
|