]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/tools/heuman_lambda_data.cpp
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/jacobi_zeta.hpp>
11 #include <boost/math/tools/test_data.hpp>
14 using namespace boost::math::tools
;
15 using namespace boost::math
;
18 mp_t
heuman_lambda(mp_t phi
, mp_t k
)
20 mp_t kp
= sqrt(1 - k
*k
);
21 if((k
* k
< tools::epsilon
<float>()) && (fabs(phi
) >= constants::half_pi
<mp_t
>()))
22 throw std::domain_error("");
23 return ellint_1(kp
, phi
) / ellint_1(kp
) + ellint_1(k
) * jacobi_zeta(kp
, phi
) / constants::half_pi
<mp_t
>();
26 int cpp_main(int argc
, char*argv
[])
28 using namespace boost::math::tools
;
30 parameter_info
<mp_t
> arg1
, arg2
;
40 if(0 == get_user_parameter_info(arg1
, "phi"))
42 if(0 == get_user_parameter_info(arg2
, "k"))
45 mp_t(*fp
)(mp_t
, mp_t
) = &heuman_lambda
;
46 data
.insert(fp
, arg1
, arg2
);
48 std::cout
<< "Any more data [y/n]?";
49 std::getline(std::cin
, line
);
50 boost::algorithm::trim(line
);
54 std::cout
<< "Enter name of test data file [default=heuman_lambda_data.ipp]";
55 std::getline(std::cin
, line
);
56 boost::algorithm::trim(line
);
58 line
= "heuman_lambda_data.ipp";
59 std::ofstream
ofs(line
.c_str());
60 line
.erase(line
.find('.'));
61 ofs
<< std::scientific
<< std::setprecision(40);
62 write_code(ofs
, data
, line
.c_str());