--- ./boost/math/octonion.hpp~ 2011-08-02 21:24:08.000000000 +0900 +++ ./boost/math/octonion.hpp 2011-08-10 19:25:46.000000000 +0900 @@ -4759,7 +4759,7 @@ T z = abs(unreal(q)); // log(q) = log(|q|) + Vq/|Vq| atan(|Vq|/Sq) - return(log(abs(q)) + ((z != static_cast(0)) ? unreal(q)/z*(atan2(z, real(q))) : octonion (0, (real(q)<0)?M_PI:0, 0, 0, 0, 0, 0, 0))); + return(log(abs(q)) + ((z != static_cast(0)) ? unreal(q)/z*(atan2(z, real(q))) : octonion (0, 1, 0, 0, 0, 0, 0, 0)*static_cast((real(q) < 0) ? M_PI : 0))); } @@ -4827,18 +4827,21 @@ // = -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); + // the signs of realpart are different with complex ones when Sq == 0 && Vq < -1 + r = r.real()*static_cast((real(q) != static_cast(0) || real(octonion (0, 1, 0, 0, 0, 0, 0, 0)*q) < 1) ? 1 : -1) + r.unreal(); //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(q UVq) //return(static_cast(1)/u*atanh(q*u)); // the signs of realpart are different with complex ones when Sq == 0 && Vq < -1 octonion p = q*u; octonion v = (abs(unreal(p)) != static_cast(0)) ? unreal(p)/abs(unreal(p)) : octonion (0, 1, 0, 0, 0, 0, 0, 0); octonion d = (static_cast(1)-p), c = static_cast(1)/d*(static_cast(1)+p), r = static_cast(1)/static_cast(2)*log(c); + r = r.real() + r.unreal()*static_cast((real(q) != static_cast(0) || real(octonion (0, 1, 0, 0, 0, 0, 0, 0)*q) < 1) ? 1 : -1); + // the signs of realpart are different with complex ones when Sq == 0 && Vq < -1 r = (abs(d) != static_cast(0) && abs(c) != static_cast(0)) ? ((real(p) != static_cast(0)) ? r : r.unreal()) : octonion (0); r = -u*r; - return(r); // the signs of realpart are different with complex ones when Sq == 0 && Vq < -1 + return(r); #endif } @@ -4871,14 +4874,17 @@ { #if 1 // asinh(q) = log(q + sqrt(q^2 + 1)) - return(log(q + sqrt(pow(q, 2) + static_cast(1)))); // the signs of realpart are different with complex ones when Sq == 0 && Vq > 1 + //return(log(q + sqrt(pow(q, 2) + static_cast(1)))); // the signs of realpart are different with complex ones when Sq == 0 && Vq > 1 + octonion r = log(q + sqrt(pow(q, 2) + static_cast(1))); + return(r.real()*static_cast((real(q) != static_cast(0) || real(octonion (0, 1, 0, 0, 0, 0, 0, 0)*q) > 1) ? 1 : -1) + r.unreal()); #else octonion u = (abs(unreal(q)) != static_cast(0)) ? unreal(q)/abs(unreal(q)) : octonion (0, 1, 0, 0, 0, 0, 0, 0); // asinh(q) = UVq asin(-q UVq) //return(u*asin(-q*u)); // the signs of realpart are different with complex ones when Sq == 0 && Vq < 1 octonion p = -q*u; octonion v = (abs(unreal(p)) != static_cast(0)) ? unreal(p)/abs(unreal(p)) : octonion (0, 1, 0, 0, 0, 0, 0, 0); - return(u*(-v*log(p*v + sqrt(static_cast(1) - pow(p, 2))))); // the signs of realpart are different with complex ones when Sq == 0 && Vq > 1 + quaternion r = u*(-v*log(p*v + sqrt(static_cast(1) - pow(p, 2)))); // the signs of realpart are different with complex ones when Sq == 0 && Vq > 1 + return(r.real()*static_cast((real(q) != static_cast(0) || real(octonion (0, 1, 0, 0, 0, 0, 0, 0)*q) > 1) ? 1 : -1) + r.unreal()); #endif } --- ./boost/math/quaternion.hpp~ 2011-08-02 20:25:05.000000000 +0900 +++ ./boost/math/quaternion.hpp 2011-08-10 19:11:24.000000000 +0900 @@ -1953,7 +1953,7 @@ T z = abs(unreal(q)); // log(q) = log(|q|) + Vq/|Vq| atan(|Vq|/Sq) - return(log(abs(q)) + ((z != static_cast(0)) ? unreal(q)/z*(atan2(z, real(q))) : quaternion(0, (real(q)<0)?M_PI:0, 0, 0))); + return(log(abs(q)) + ((z != static_cast(0)) ? unreal(q)/z*(atan2(z, real(q))) : quaternion(0, 1, 0, 0)*static_cast((real(q) < 0) ? M_PI : 0))); } @@ -2017,18 +2017,21 @@ // = -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); + // the signs of realpart are different with complex ones when Sq == 0 && Vq < -1 + r = r.real()*static_cast((real(q) != static_cast(0) || real(quaternion(0, 1, 0, 0)*q) < 1) ? 1 : -1) + r.unreal(); //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(q UVq) //return(static_cast(1)/u*atanh(q*u)); // the signs of realpart are different with complex ones when Sq == 0 && Vq < -1 quaternion p = q*u; quaternion v = (abs(unreal(p)) != static_cast(0)) ? unreal(p)/abs(unreal(p)) : quaternion(0, 1, 0, 0); quaternion d = (static_cast(1)-p), c = static_cast(1)/d*(static_cast(1)+p), r = static_cast(1)/static_cast(2)*log(c); + r = r.real() + r.unreal()*static_cast((real(q) != static_cast(0) || real(quaternion(0, 1, 0, 0)*q) < 1) ? 1 : -1); + // the signs of realpart are different with complex ones when Sq == 0 && Vq < -1 r = (abs(d) != static_cast(0) && abs(c) != static_cast(0)) ? ((real(p) != static_cast(0)) ? r : r.unreal()) : quaternion(0); r = -u*r; - return(r); // the signs of realpart are different with complex ones when Sq == 0 && Vq < -1 + return(r); #endif } @@ -2061,14 +2064,17 @@ { #if 1 // asinh(q) = log(q + sqrt(q^2 + 1)) - return(log(q + sqrt(pow(q, 2) + static_cast(1)))); // the signs of realpart are different with complex ones when Sq == 0 && Vq > 1 + //return(log(q + sqrt(pow(q, 2) + static_cast(1)))); // the signs of realpart are different with complex ones when Sq == 0 && Vq > 1 + quaternion r = log(q + sqrt(pow(q, 2) + static_cast(1))); + return(r.real()*static_cast((real(q) != static_cast(0) || real(quaternion(0, 1, 0, 0)*q) > 1) ? 1 : -1) + r.unreal()); #else quaternion u = (abs(unreal(q)) != static_cast(0)) ? unreal(q)/abs(unreal(q)) : quaternion(0, 1, 0, 0); // asinh(q) = UVq asin(-q UVq) //return(u*asin(-q*u)); // the signs of realpart are different with complex ones when Sq == 0 && Vq < 1 quaternion p = -q*u; quaternion v = (abs(unreal(p)) != static_cast(0)) ? unreal(p)/abs(unreal(p)) : quaternion(0, 1, 0, 0); - return(u*(-v*log(p*v + sqrt(static_cast(1) - pow(p, 2))))); // the signs of realpart are different with complex ones when Sq == 0 && Vq > 1 + quaternion r = u*(-v*log(p*v + sqrt(static_cast(1) - pow(p, 2)))); // the signs of realpart are different with complex ones when Sq == 0 && Vq > 1 + return(r.real()*static_cast((real(q) != static_cast(0) || real(quaternion(0, 1, 0, 0)*q) > 1) ? 1 : -1) + r.unreal()); #endif }