From 93f40364826ff36218cc3e681599282f718828ee Mon Sep 17 00:00:00 2001
From: Oliver Sander <sander@igpm.rwth-aachen.de>
Date: Thu, 21 Apr 2011 10:35:22 +0000
Subject: [PATCH] adjust the bounds for when to use the series expansions for
 the derivatives of arccos squared

[[Imported from SVN: r7196]]
---
 dune/gfe/unitvector.hh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/dune/gfe/unitvector.hh b/dune/gfe/unitvector.hh
index de6df3f9..17116adc 100644
--- a/dune/gfe/unitvector.hh
+++ b/dune/gfe/unitvector.hh
@@ -20,9 +20,9 @@ class UnitVector
 
     /** \brief Compute the derivative of arccos^2 without getting unstable for x close to 1 */
     static double derivativeOfArcCosSquared(const double& x) {
-        const double eps = 1e-12;
+        const double eps = 1e-4;
         if (x > 1-eps) {  // regular expression is unstable, use the series expansion instead
-            return -2 + 2*(x-1)/3 - 4/15*(x-1)*(x-1) + 4/35*(x-1)*(x-1)*(x-1);
+            return -2 + 2*(x-1)/3 - 4/15*(x-1)*(x-1);
         } else if (x < -1+eps) {  // The function is not differentiable
             DUNE_THROW(Dune::Exception, "arccos^2 is not differentiable at x==-1!");
         } else
@@ -31,7 +31,7 @@ class UnitVector
 
     /** \brief Compute the second derivative of arccos^2 without getting unstable for x close to 1 */
     static double secondDerivativeOfArcCosSquared(const double& x) {
-        const double eps = 1e-12;
+        const double eps = 1e-4;
         if (x > 1-eps) {  // regular expression is unstable, use the series expansion instead
             return 2.0/3 - 8*(x-1)/15;
         } else if (x < -1+eps) {  // The function is not differentiable
@@ -42,7 +42,7 @@ class UnitVector
 
     /** \brief Compute the third derivative of arccos^2 without getting unstable for x close to 1 */
     static double thirdDerivativeOfArcCosSquared(const double& x) {
-        const double eps = 1e-12;
+        const double eps = 1e-4;
         if (x > 1-eps) {  // regular expression is unstable, use the series expansion instead
             return -8.0/15 + 24*(x-1)/35;
         } else if (x < -1+eps) {  // The function is not differentiable
-- 
GitLab