]> www.ginac.de Git - ginac.git/blobdiff - ginac/inifcns_trans.cpp
#ifndef around namespace GiNaC { }
[ginac.git] / ginac / inifcns_trans.cpp
index 40968672dcd01dfb715e9e4a08ab92f562797492..01711a7fa3c9aae70cc9afc536ab651a157d2d34 100644 (file)
@@ -30,7 +30,9 @@
 #include "numeric.h"
 #include "power.h"
 
+#ifndef NO_GINAC_NAMESPACE
 namespace GiNaC {
+#endif // ndef NO_GINAC_NAMESPACE
 
 //////////
 // exponential function
@@ -77,7 +79,7 @@ static ex exp_eval(ex const & x)
 
 static ex exp_diff(ex const & x, unsigned diff_param)
 {
-    ASSERT(diff_param==0);
+    GINAC_ASSERT(diff_param==0);
 
     return exp(x);
 }
@@ -125,7 +127,7 @@ static ex log_eval(ex const & x)
 
 static ex log_diff(ex const & x, unsigned diff_param)
 {
-    ASSERT(diff_param==0);
+    GINAC_ASSERT(diff_param==0);
 
     return power(x, -1);
 }
@@ -181,7 +183,7 @@ static ex sin_eval(ex const & x)
 
 static ex sin_diff(ex const & x, unsigned diff_param)
 {
-    ASSERT(diff_param==0);
+    GINAC_ASSERT(diff_param==0);
     
     return cos(x);
 }
@@ -237,7 +239,7 @@ static ex cos_eval(ex const & x)
 
 static ex cos_diff(ex const & x, unsigned diff_param)
 {
-    ASSERT(diff_param==0);
+    GINAC_ASSERT(diff_param==0);
 
     return numMINUSONE()*sin(x);
 }
@@ -299,7 +301,7 @@ static ex tan_eval(ex const & 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()));
 }
@@ -347,7 +349,7 @@ static ex asin_eval(ex const & x)
 
 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());
 }
@@ -395,7 +397,7 @@ static ex acos_eval(ex const & x)
 
 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());
 }
@@ -431,7 +433,7 @@ static ex atan_eval(ex const & x)
 
 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);
 }
@@ -464,14 +466,14 @@ static ex atan2_eval(ex const & y, ex const & x)
 
 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 power(x*(1+y*y/(x*x)),-1);
+        return x*pow(pow(x,2)+pow(y,2),-1);
     }
     // d/dx atan(y,x)
-    return -y*power(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);
@@ -518,7 +520,7 @@ static ex sinh_eval(ex const & x)
 
 static ex sinh_diff(ex const & x, unsigned diff_param)
 {
-    ASSERT(diff_param==0);
+    GINAC_ASSERT(diff_param==0);
     
     return cosh(x);
 }
@@ -567,7 +569,7 @@ static ex cosh_eval(ex const & x)
 
 static ex cosh_diff(ex const & x, unsigned diff_param)
 {
-    ASSERT(diff_param==0);
+    GINAC_ASSERT(diff_param==0);
     
     return sinh(x);
 }
@@ -616,7 +618,7 @@ static ex tanh_eval(ex const & 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());
 }
@@ -652,7 +654,7 @@ static ex asinh_eval(ex const & x)
 
 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());
 }
@@ -694,7 +696,7 @@ static ex acosh_eval(ex const & x)
 
 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());
 }
@@ -733,11 +735,13 @@ static ex atanh_eval(ex const & x)
 
 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