manifolds: Add phase factor function.

Fix incorrect naming of cosine function with imaginary component.

Use Math.sinh/cosh if available.