--- ./boost/math/octonion.hpp~ 2010-03-10 12:09:40.000000000 +0900 +++ ./boost/math/octonion.hpp 2011-05-20 17:58:33.000000000 +0900 @@ -4791,10 +4791,10 @@ { octonion u = (abs(unreal(q)) != static_cast(0)) ? unreal(q)/abs(unreal(q)) : octonion (0, 1, 0, 0, 0, 0, 0, 0); #if 1 - // asin(q) = 1/UVq log(UVq q + sqrt(1 - q^2)) - // = -UVq log(UVq q + sqrt(1 - q^2)) - //return(-u*log((u)*q + sqrt(static_cast(1) - pow(q, 2)))); // the signs of imagpart are different with complex ones when |Vq| == 0 && Sq > 0 - octonion r = -u*log((u)*q + sqrt(static_cast(1) - pow(q, 2))); + // asin(q) = 1/UVq log(q UVq + sqrt(1 - q^2)) + // = -UVq log(q UVq + sqrt(1 - q^2)) + //return(-u*log(q*(u) + sqrt(static_cast(1) - pow(q, 2)))); // the signs of imagpart are different with complex ones when |Vq| == 0 && Sq > 0 + 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) @@ -4820,10 +4820,10 @@ (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+UVq.q)/(1-UVq.q) ) - // = -UVq/2 log( (1+UVq.q)/(1-UVq.q) ) - //return(-u/static_cast(2)*log((static_cast(1)+(u)*q)/(static_cast(1)-(u)*q))); - octonion d = static_cast(1)-(u)*q, c = (static_cast(1)+(u)*q)/d, r = -u/static_cast(2)*log(c); + // 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); //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 @@ -4865,9 +4865,9 @@ (q.R_component_6()==static_cast(0)) ? 0 : q.R_component_6()*inf, (q.R_component_7()==static_cast(0)) ? 0 : q.R_component_7()*inf, (q.R_component_8()==static_cast(0)) ? 0 : q.R_component_8()*inf)); - // atanh(q) = 1/2 log( (1+q)/(1-q) ) - //return(static_cast(1)/static_cast(2)*log((static_cast(1)+q)/(static_cast(1)-q))); - octonion d = (static_cast(1)-q), c = (static_cast(1)+q)/d, r = static_cast(1)/static_cast(2)*log(c); + // atanh(q) = 1/2 log( (1-q)^{-1} (1+q) ) + //return(static_cast(1)/static_cast(2)*log(static_cast(1)/(static_cast(1)-q)*(static_cast(1)+q))); + octonion d = (static_cast(1)-q), c = static_cast(1)/d*(static_cast(1)+q), r = static_cast(1)/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)) ? ((real(q) != static_cast(0)) ? r : unreal(r)) : octonion (0)); } --- ./boost/math/quaternion.hpp~ 2010-03-10 12:09:40.000000000 +0900 +++ ./boost/math/quaternion.hpp 2011-05-20 16:35:53.000000000 +0900 @@ -1985,10 +1985,10 @@ { quaternion u = (abs(unreal(q)) != static_cast(0)) ? unreal(q)/abs(unreal(q)) : quaternion(0, 1, 0, 0); #if 1 - // asin(q) = 1/UVq log(UVq q + sqrt(1 - q^2)) - // = -UVq log(UVq q + sqrt(1 - q^2)) - //return(-u*log((u)*q + sqrt(static_cast(1) - pow(q, 2)))); // the signs of imagpart are different with complex ones when |Vq| == 0 && Sq > 0 - quaternion r = -u*log((u)*q + sqrt(static_cast(1) - pow(q, 2))); + // asin(q) = 1/UVq log(q UVq + sqrt(1 - q^2)) + // = -UVq log(q UVq + sqrt(1 - q^2)) + //return(-u*log(q*(u) + sqrt(static_cast(1) - pow(q, 2)))); // the signs of imagpart are different with complex ones when |Vq| == 0 && Sq > 0 + 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) @@ -2010,10 +2010,10 @@ (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+UVq.q)/(1-UVq.q) ) - // = -UVq/2 log( (1+UVq.q)/(1-UVq.q) ) - //return(-u/static_cast(2)*log((static_cast(1)+(u)*q)/(static_cast(1)-(u)*q))); - quaternion d = static_cast(1)-(u)*q, c = (static_cast(1)+(u)*q)/d, r = -u/static_cast(2)*log(c); + // 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); //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 @@ -2051,9 +2051,9 @@ (q.R_component_2()==static_cast(0)) ? 0 : q.R_component_2()*inf, (q.R_component_3()==static_cast(0)) ? 0 : q.R_component_3()*inf, (q.R_component_4()==static_cast(0)) ? 0 : q.R_component_4()*inf)); - // atanh(q) = 1/2 log( (1+q)/(1-q) ) - //return(static_cast(1)/static_cast(2)*log((static_cast(1)+q)/(static_cast(1)-q))); - quaternion d = (static_cast(1)-q), c = (static_cast(1)+q)/d, r = static_cast(1)/static_cast(2)*log(c); + // atanh(q) = 1/2 log( (1-q)^{-1} (1+q) ) + //return(static_cast(1)/static_cast(2)*log(static_cast(1)/(static_cast(1)-q)*(static_cast(1)+q))); + quaternion d = (static_cast(1)-q), c = static_cast(1)/d*(static_cast(1)+q), r = static_cast(1)/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)) ? ((real(q) != static_cast(0)) ? r : unreal(r)) : quaternion(0)); }