MCPcopy Create free account
hub / github.com/arguiot/TheoremJS / tan

Method tan

__test__/theorem.js:531–555  ·  view source on GitHub ↗
(n)

Source from the content-addressed store, hash-verified

529 return result.length == 1 ? result[0] : result
530 }
531 tan(n) {
532 if (n.isComplex) {
533 const Ta = n.a.times(2).toNumber()
534 const Tb = n.b.times(2).toNumber()
535
536 const sin = Math.sin(Ta)
537 const cos = Math.cos(Ta)
538 const cosh = Math.cosh(Tb)
539 const sinh = Math.sinh(Tb)
540
541 const re = sin / (cos + cosh)
542 const im = sinh / (cos + cosh)
543
544 return this.complex(re, im)
545 }
546 if (typeof n != 'object' || BigNumber.isBigNumber(n)) {
547 n = BigNumber.isBigNumber(n) == true ? n.toNumber() : n
548 n = [n]
549 }
550 let result = []
551 for (var i = 0; i < n.length; i++) {
552 result.push(Math.tan(n[i]).toFixed(15))
553 }
554 return result.length == 1 ? result[0] : result
555 }
556 tanh(n) {
557 if (n.isComplex) {
558 const Ta = n.a.times(2).toNumber()

Callers 2

tan.jsFile · 0.80
test.jsFile · 0.80

Calls 6

complexMethod · 0.95
timesMethod · 0.80
sinMethod · 0.80
cosMethod · 0.80
coshMethod · 0.80
sinhMethod · 0.80

Tested by

no test coverage detected