| 554 | return result.length == 1 ? result[0] : result |
| 555 | } |
| 556 | tanh(n) { |
| 557 | if (n.isComplex) { |
| 558 | const Ta = n.a.times(2).toNumber() |
| 559 | const Tb = n.b.times(2).toNumber() |
| 560 | |
| 561 | const sin = Math.sin(Tb) |
| 562 | const cos = Math.cos(Tb) |
| 563 | const cosh = Math.cosh(Ta) |
| 564 | const sinh = Math.sinh(Ta) |
| 565 | |
| 566 | const re = sinh / (cos + cosh) |
| 567 | const im = sin / (cos + cosh) |
| 568 | |
| 569 | return this.complex(re, im) |
| 570 | } |
| 571 | if (typeof n != 'object' || BigNumber.isBigNumber(n)) { |
| 572 | n = BigNumber.isBigNumber(n) == true ? n.toNumber() : n |
| 573 | n = [n] |
| 574 | } |
| 575 | let result = [] |
| 576 | for (var i = 0; i < n.length; i++) { |
| 577 | result.push(Math.tanh(n[i]).toFixed(15)) |
| 578 | } |
| 579 | return result.length == 1 ? result[0] : result |
| 580 | } |
| 581 | derivate(poly) { |
| 582 | if (poly.type != 'polynomial') { |
| 583 | throw "TheoremJS: Derivative: Not a polynomial" |