# File lib/facets/more/quaternion.rb, line 465
  def log
    # log(r+uv)=1/2 log(r^2+v^2)+u atan(v/r)
    if is_real?;
      if @re>=0; return Quaternion(Math::log(@re));
      else return Quaternion(Math::log(-@re),Math::PI,0,0);
      end
    end
    vec=self.vector; v=vec.abs; u = vec/v;
    Math::log(self.abs2.to_f)/2+u*Math::atan2( v, @re)
  end