MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / sin

Method sin

src/org/opensourcephysics/numerics/Complex.java:510–529  ·  view source on GitHub ↗

Returns the sine of this complex number.

()

Source from the content-addressed store, hash-verified

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

Callers 15

builtInFunctionMethod · 0.45
shuffleMethod · 0.45
cartesianMethod · 0.45
powerMethod · 0.45
powMethod · 0.45
expMethod · 0.45
cosMethod · 0.45
tanMethod · 0.45
sinhMethod · 0.45
coshMethod · 0.45
tanhMethod · 0.45
rotationXMethod · 0.45

Calls 2

expMethod · 0.80
cosMethod · 0.45

Tested by

no test coverage detected