Predefined Functions – ln

Function name: ln – Natural logarithm
Synopsis: ln(x)


Input data type Output data type
real real
complex complex
quaternion quaternion

Description:

The natural logarithm may be written either as log or as ln. These two functions are the same.

The logarithm of a complex or quaternion number is not uniquely defined. Mathematically the logarithm of a complex or quaternion number has an unlimited number of solutions. The solution calculated in ChaosPro is the main branch of the logarithm.

ChaosPro automatically detects the input data type.

In order to calculate ln(z) (z = any complex number) ChaosPro performs the following calculation:

  ln(z) = 0.5*(ln(x^2+y^2))+i*arctan(y/x)  

For the definition of arctan(x) see:

In order to calculate ln(q) (q = quaternion number) ChaosPro performs the following calculation:

  quaternion fr_ln(quaternion q)  {  quaternion ret;            n = sqrt( sqr(real(loquat(q))) + sqr(imag(loquat(q))) +sqr(imag(q)) );          f = arg(real(q)/n+flip(1));          f = f/n;          c0 = 0.5*ln(sqr(real(q)) + n*n);          c1 = f*imag(q);          c2 = f*real(loquat(q));          c3 = f*imag(loquat(q));          ret = loquat(c2+flip(c3))+c0+flip(c1);          return(ret);  }  

ln