jacobi_zeta_data.cpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // Copyright John Maddock 2006.
  2. // Use, modification and distribution are subject to the
  3. // Boost Software License, Version 1.0.
  4. // (See accompanying file LICENSE_1_0.txt
  5. // or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. #include <boost/math/tools/test_data.hpp>
  7. #include <boost/test/included/prg_exec_monitor.hpp>
  8. #include <boost/math/special_functions/ellint_1.hpp>
  9. #include <boost/math/special_functions/ellint_2.hpp>
  10. #include <fstream>
  11. #include <boost/math/tools/test_data.hpp>
  12. #include "mp_t.hpp"
  13. using namespace boost::math::tools;
  14. using namespace boost::math;
  15. using namespace std;
  16. mp_t jacobi_zeta(mp_t phi, mp_t k)
  17. {
  18. return ellint_2(k, phi) - ellint_2(k) * ellint_1(k, phi) / ellint_1(k);
  19. }
  20. int cpp_main(int argc, char*argv [])
  21. {
  22. using namespace boost::math::tools;
  23. parameter_info<mp_t> arg1, arg2;
  24. test_data<mp_t> data;
  25. bool cont;
  26. std::string line;
  27. if(argc < 1)
  28. return 1;
  29. do{
  30. if(0 == get_user_parameter_info(arg1, "phi"))
  31. return 1;
  32. if(0 == get_user_parameter_info(arg2, "k"))
  33. return 1;
  34. mp_t(*fp)(mp_t, mp_t) = &jacobi_zeta;
  35. data.insert(fp, arg1, arg2);
  36. std::cout << "Any more data [y/n]?";
  37. std::getline(std::cin, line);
  38. boost::algorithm::trim(line);
  39. cont = (line == "y");
  40. }while(cont);
  41. std::cout << "Enter name of test data file [default=jacobi_zeta_data.ipp]";
  42. std::getline(std::cin, line);
  43. boost::algorithm::trim(line);
  44. if(line == "")
  45. line = "jacobi_zeta_data.ipp";
  46. std::ofstream ofs(line.c_str());
  47. line.erase(line.find('.'));
  48. ofs << std::scientific << std::setprecision(40);
  49. write_code(ofs, data, line.c_str());
  50. return 0;
  51. }