<分区>
我最近一直在研究一些数学问题,我想知道是否有人写过/看过可以指定基数(root..?)的日志的 C++ 实现?如:
Mathematical function definition http://i1091.photobucket.com/albums/i383/dannydeth1/forumla.png
显然我更愿意将基数作为参数:double d = log(b,x);
感谢您的宝贵时间,非常感谢您的回答。 :
编辑:另外,我认为它会使用泰勒级数?
<分区>
我最近一直在研究一些数学问题,我想知道是否有人写过/看过可以指定基数(root..?)的日志的 C++ 实现?如:
Mathematical function definition http://i1091.photobucket.com/albums/i383/dannydeth1/forumla.png
显然我更愿意将基数作为参数:double d = log(b,x);
感谢您的宝贵时间,非常感谢您的回答。 :
编辑:另外,我认为它会使用泰勒级数?
最佳答案
log_b_(x) = log(x)/log(b)。只需这样做:
double log(double base, double x)
{
return std::log(x) / std::log(base);
}
关于c++ - 可以指定其基础的日志的 C++ 实现?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8325482/