Returns the sine of this complex number.
()
| 508 | * Returns the sine of this complex number. |
| 509 | */ |
| 510 | public Complex sin() { |
| 511 | double izRe, izIm; |
| 512 | double temp1Re, temp1Im; |
| 513 | double temp2Re, temp2Im; |
| 514 | double scalar; |
| 515 | // sin(z) = ( exp(i*z) - exp(-i*z) ) / (2*i) |
| 516 | izRe = -im; |
| 517 | izIm = re; |
| 518 | // first exp |
| 519 | scalar = Math.exp(izRe); |
| 520 | temp1Re = scalar*Math.cos(izIm); |
| 521 | temp1Im = scalar*Math.sin(izIm); |
| 522 | // second exp |
| 523 | scalar = Math.exp(-izRe); |
| 524 | temp2Re = scalar*Math.cos(-izIm); |
| 525 | temp2Im = scalar*Math.sin(-izIm); |
| 526 | temp1Re -= temp2Re; |
| 527 | temp1Im -= temp2Im; |
| 528 | return new Complex(0.5*temp1Im, -0.5*temp1Re); |
| 529 | } |
| 530 | |
| 531 | /** |
| 532 |