#include "numeric.h"
#include "power.h"
+#ifndef NO_GINAC_NAMESPACE
namespace GiNaC {
+#endif // ndef NO_GINAC_NAMESPACE
//////////
// exponential function
static ex exp_diff(ex const & x, unsigned diff_param)
{
- ASSERT(diff_param==0);
+ GINAC_ASSERT(diff_param==0);
return exp(x);
}
static ex log_diff(ex const & x, unsigned diff_param)
{
- ASSERT(diff_param==0);
+ GINAC_ASSERT(diff_param==0);
return power(x, -1);
}
static ex sin_diff(ex const & x, unsigned diff_param)
{
- ASSERT(diff_param==0);
+ GINAC_ASSERT(diff_param==0);
return cos(x);
}
static ex cos_diff(ex const & x, unsigned diff_param)
{
- ASSERT(diff_param==0);
+ GINAC_ASSERT(diff_param==0);
return numMINUSONE()*sin(x);
}
static ex tan_diff(ex const & x, unsigned diff_param)
{
- ASSERT(diff_param==0);
+ GINAC_ASSERT(diff_param==0);
return (1+power(tan(x),exTWO()));
}
static ex asin_diff(ex const & x, unsigned diff_param)
{
- ASSERT(diff_param==0);
+ GINAC_ASSERT(diff_param==0);
return power(1-power(x,exTWO()),exMINUSHALF());
}
static ex acos_diff(ex const & x, unsigned diff_param)
{
- ASSERT(diff_param==0);
+ GINAC_ASSERT(diff_param==0);
return numMINUSONE()*power(1-power(x,exTWO()),exMINUSHALF());
}
static ex atan_diff(ex const & x, unsigned diff_param)
{
- ASSERT(diff_param==0);
+ GINAC_ASSERT(diff_param==0);
return power(1+x*x, -1);
}
static ex atan2_diff(ex const & y, ex const & x, unsigned diff_param)
{
- ASSERT(diff_param<2);
+ GINAC_ASSERT(diff_param<2);
if (diff_param==0) {
// d/dy atan(y,x)
- return pow(x*(1+y*y/(x*x)),-1);
+ return x*pow(pow(x,2)+pow(y,2),-1);
}
// d/dx atan(y,x)
- return -y*pow(x*x+y*y,-1);
+ return -y*pow(pow(x,2)+pow(y,2),-1);
}
REGISTER_FUNCTION(atan2, atan2_eval, atan2_evalf, atan2_diff, NULL);
static ex sinh_diff(ex const & x, unsigned diff_param)
{
- ASSERT(diff_param==0);
+ GINAC_ASSERT(diff_param==0);
return cosh(x);
}
static ex cosh_diff(ex const & x, unsigned diff_param)
{
- ASSERT(diff_param==0);
+ GINAC_ASSERT(diff_param==0);
return sinh(x);
}
static ex tanh_diff(ex const & x, unsigned diff_param)
{
- ASSERT(diff_param==0);
+ GINAC_ASSERT(diff_param==0);
return exONE()-power(tanh(x),exTWO());
}
static ex asinh_diff(ex const & x, unsigned diff_param)
{
- ASSERT(diff_param==0);
+ GINAC_ASSERT(diff_param==0);
return power(1+power(x,exTWO()),exMINUSHALF());
}
static ex acosh_diff(ex const & x, unsigned diff_param)
{
- ASSERT(diff_param==0);
+ GINAC_ASSERT(diff_param==0);
return power(x-1,exMINUSHALF())*power(x+1,exMINUSHALF());
}
static ex atanh_diff(ex const & x, unsigned diff_param)
{
- ASSERT(diff_param==0);
+ GINAC_ASSERT(diff_param==0);
return power(exONE()-power(x,exTWO()),exMINUSONE());
}
REGISTER_FUNCTION(atanh, atanh_eval, atanh_evalf, atanh_diff, NULL);
+#ifndef NO_GINAC_NAMESPACE
} // namespace GiNaC
+#endif // ndef NO_GINAC_NAMESPACE