| 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() |