In Quaternion.h we have Logmap, but we have to be careful when qw approaches -1 (from above) or 1 (from below). The Taylor expansions below are the basis for the code.

angle=2ArcCos[qw]

s=Sqrt[1-qw*qw]

factor = angle/s

Expand[Series[((2 ArcCos[qw])/(Sqrt[1-(qw^2)])),{qw,1,1},Assumptions->(qw<1)]]

ArcCos[-1]

Expand[Series[((-2ArcCos[-qw])/(Sqrt[1-(qw^2)])),{qw,-1,1},Assumptions->(qw>-1)]]