--- ./boost/math/octonion.hpp~ 2011-05-20 17:58:33.000000000 +0900 +++ ./boost/math/octonion.hpp 2011-08-01 22:14:24.000000000 +0900 @@ -4797,9 +4797,9 @@ octonion r = -u*log(q*(u) + sqrt(static_cast(1) - pow(q, 2))); return(r.real() + r.unreal()*static_cast((abs(unreal(q)) != static_cast(0) || real(q) < 0) ? 1 : -1)); #else - // asin(z) = 1/UVq asinh(UVq z) - //return(static_cast(1)/u*asinh(u*q)); // the signs of imagpart are different with complex ones when |Vq| == 0 && Sq > 0 - octonion r = static_cast(1)/u*asinh(u*q); + // asin(q) = 1/UVq asinh(q UVq) + //return(static_cast(1)/u*asinh(q*u)); // the signs of imagpart are different with complex ones when |Vq| == 0 && Sq > 0 + octonion r = static_cast(1)/u*asinh(q*u); return(r.real() + r.unreal()*static_cast((abs(unreal(q)) != static_cast(0) || real(q) < 0) ? 1 : -1)); #endif } @@ -4820,16 +4820,16 @@ (q.R_component_8()==static_cast(0)) ? 0 : q.R_component_8()*inf)); octonion u = (abs(unreal(q)) != static_cast(0)) ? unreal(q)/abs(unreal(q)) : octonion (0, 1, 0, 0, 0, 0, 0, 0); #if 1 - // atan(q) = 1/(2UVq) log( (1+q UVq)/(1-q UVq) ) - // = -UVq/2 log( (1+q UVq)/(1-q UVq) ) - //return(-u/static_cast(2)*log((static_cast(1)+q*(u))/(static_cast(1)-q*(u)))); - octonion d = static_cast(1)-q*(u), c = (static_cast(1)+q*(u))/d, r = -u/static_cast(2)*log(c); + // atan(q) = 1/(2UVq) log( (1-q UVq)^{-1} (1+q UVq) ) + // = -UVq/2 log( (1-q UVq)^{-1} (1+q UVq) ) + //return(-u/static_cast(2)*log(static_cast(1)/(static_cast(1)-q*(u))*(static_cast(1)+q*(u)))); + octonion d = static_cast(1)-q*(u), c = static_cast(1)/d*(static_cast(1)+q*(u)), r = -u/static_cast(2)*log(c); //return((abs(d) != static_cast(0) && abs(c) != static_cast(0)) ? r : octonion (0)); return((abs(d) != static_cast(0) && abs(c) != static_cast(0)) ? ((abs(unreal(q)) != static_cast(0)) ? r : octonion (real(r))) : octonion (0)); // the signs of realpart are different with complex ones when Sq == 0 && Vq < -1 #else - // atan(q) = -UVq atanh(UVq.q) - return(static_cast(1)/u*atanh(u*q)); // the signs of realpart are different with complex ones when Sq == 0 && Vq < -1 + // atan(q) = -UVq atanh(q UVq) + return(static_cast(1)/u*atanh(q*u)); // the signs of realpart are different with complex ones when Sq == 0 && Vq < -1 #endif } --- ./boost/math/quaternion.hpp~ 2011-05-20 16:35:53.000000000 +0900 +++ ./boost/math/quaternion.hpp 2011-08-01 22:06:15.000000000 +0900 @@ -1991,9 +1991,9 @@ quaternion r = -u*log(q*(u) + sqrt(static_cast(1) - pow(q, 2))); return(r.real() + r.unreal()*static_cast((abs(unreal(q)) != static_cast(0) || real(q) < 0) ? 1 : -1)); #else - // asin(z) = 1/UVq asinh(UVq z) - //return(static_cast(1)/u*asinh(u*q)); // the signs of imagpart are different with complex ones when |Vq| == 0 && Sq > 0 - quaternion r = static_cast(1)/u*asinh(u*q); + // asin(q) = 1/UVq asinh(q UVq) + //return(static_cast(1)/u*asinh(q*u)); // the signs of imagpart are different with complex ones when |Vq| == 0 && Sq > 0 + quaternion r = static_cast(1)/u*asinh(q*u); return(r.real() + r.unreal()*static_cast((abs(unreal(q)) != static_cast(0) || real(q) < 0) ? 1 : -1)); #endif } @@ -2010,16 +2010,16 @@ (q.R_component_4()==static_cast(0)) ? 0 : q.R_component_4()*inf)); quaternion u = (abs(unreal(q)) != static_cast(0)) ? unreal(q)/abs(unreal(q)) : quaternion(0, 1, 0, 0); #if 1 - // atan(q) = 1/(2UVq) log( (1+q UVq)/(1-q UVq) ) - // = -UVq/2 log( (1+q UVq)/(1-q UVq) ) - //return(-u/static_cast(2)*log((static_cast(1)+q*(u))/(static_cast(1)-q*(u)))); - quaternion d = static_cast(1)-q*(u), c = (static_cast(1)+q*(u))/d, r = -u/static_cast(2)*log(c); + // atan(q) = 1/(2UVq) log( (1-q UVq)^{-1} (1+q UVq) ) + // = -UVq/2 log( (1-q UVq)^{-1} (1+q UVq) ) + //return(-u/static_cast(2)*log(static_cast(1)/(static_cast(1)-q*(u))*(static_cast(1)+q*(u)))); + quaternion d = static_cast(1)-q*(u), c = static_cast(1)/d*(static_cast(1)+q*(u)), r = -u/static_cast(2)*log(c); //return((abs(d) != static_cast(0) && abs(c) != static_cast(0)) ? r : quaternion(0)); return((abs(d) != static_cast(0) && abs(c) != static_cast(0)) ? ((abs(unreal(q)) != static_cast(0)) ? r : quaternion(real(r))) : quaternion(0)); // the signs of realpart are different with complex ones when Sq == 0 && Vq < -1 #else - // atan(q) = -UVq atanh(UVq.q) - return(static_cast(1)/u*atanh(u*q)); // the signs of realpart are different with complex ones when Sq == 0 && Vq < -1 + // atan(q) = -UVq atanh(q UVq) + return(static_cast(1)/u*atanh(q*u)); // the signs of realpart are different with complex ones when Sq == 0 && Vq < -1 #endif }