How to compute the sine of a complex number in floating-point arithmetic?

422 Views Asked by At

What is the most efficient way to numerically compute the sine of a complex number?

Suppose I want to calculate the sine of a complex number a + bi on a computer. Suppose that a and b are both floating point numbers with a limited precision and I want to compute the real and complex parts of the sine of a + bi.

I'm sure that there are many ways to break this down, but supposing that I have functions available in a library that compute exponents and trig functions of real numbers, how can I go about computing the sine of a complex number?

2

There are 2 best solutions below

5
On BEST ANSWER

You can use the usual trigonometric formulas ($\cos(a+b)=\cos a \cos b-\sin a\sin b$, etc.), and you also need:

$$\cos ix=\mathrm{cosh}\, x$$

$$\sin ix=i \,\mathrm{sinh}\, x$$

They are direct consequences of the definition of $e^z$ (and then trigonometric and hyperbolic functions) as a series.

Thus, for example,

$$\cos(a+ib)=\cos a\,\mathrm{cosh}\,b-i\sin a\,\mathrm{sinh}\, b$$

5
On

$(1)$ You can always use the taylor series of the $\sin$ function namely, $$\sin(z) = z - \frac{z^3}{3!} + \frac{z^5}{5!} - \frac{z^7}{7!} + \cdots$$

$(2)$ You can also use the relationship $$e^{iz}=\cos(z)+i\sin(z),\ \sin(z)=\frac{e^{iz}-e^{-iz}}{2i}$$