ellint_d_data.cpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 ellint_d(mp_t k)
  17. {
  18. return (boost::math::ellint_1(k) - boost::math::ellint_2(k)) / (k * k);
  19. }
  20. int cpp_main(int argc, char*argv [])
  21. {
  22. using namespace boost::math::tools;
  23. parameter_info<mp_t> arg1;
  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, "k"))
  31. return 1;
  32. mp_t(*fp)(mp_t) = &ellint_d;
  33. data.insert(fp, arg1);
  34. std::cout << "Any more data [y/n]?";
  35. std::getline(std::cin, line);
  36. boost::algorithm::trim(line);
  37. cont = (line == "y");
  38. }while(cont);
  39. std::cout << "Enter name of test data file [default=ellint_d_data.ipp]";
  40. std::getline(std::cin, line);
  41. boost::algorithm::trim(line);
  42. if(line == "")
  43. line = "ellint_d_data.ipp";
  44. std::ofstream ofs(line.c_str());
  45. line.erase(line.find('.'));
  46. ofs << std::scientific << std::setprecision(40);
  47. write_code(ofs, data, line.c_str());
  48. return 0;
  49. }