# Computing Hyperbolics

1. Oct 20, 2007

### Firepanda

How do calculators/matlab compute hyperbolic functions?

I believe it may have something to do with the taylor series but apart from that I can't find anything else from the net. I was told to try and compute cosh^2(x) - sinh^2(x) = 1, and notice the errors for increasing values of x, which I have done, but I'm still unsure on how this is computed. If it is in fact the taylor series used, then how do I find out how many terms it was computed to?

Thanks :)

2. Oct 20, 2007

### Hurkyl

Staff Emeritus
For large numbers, I would expect them to make good use of the double-angle and angle-addition formulas. For small numbers, I suppose you could use half-angle formulae, but a Taylor series is probably best in this domain.

Maybe there's a way to use Newton's method to refine an initial estimate?

(Note that you would compute e^x with the same kinds of methods)

3. Oct 20, 2007

### Firepanda

Nice advice, but what I think they want is simpler, considering we havn't learnt much of what you mentioned :P. I was thinking along the lines of them being computed by the maclaurin series, to an already determined-term degree of accuracy. Such that as x increases the graph of the functions converges further away, (as x needs to stay small using maclaurin).

4. Oct 20, 2007

### Gib Z

Not sure about matlab, but pocket calculators only store about 15 digits of accuracy. To get that even for e^(1000) you would require less than 20 taylor series terms (someone could probably reduce that upper bound for me), and im quite certain for large values they have taylor series sums, and for small values they are stored.

eg if you put $exp(\sqrt{163}\pi) - (640320^4 + 744)$ into your calculator, it says exactly zero, because the exponential differs from the integer part by less than 1x 10^(-60). Theoretically, you calculator should be able to display that information, it is by no means too small or too large for the display, but the memory only holds 15 digits, so it thinks they are the same numbers.

5. Oct 21, 2007

### Firepanda

I understand what you mean gib z, but your example doesn't work for me :P

So when the calculator calculates cosh(x), does it use ((e^x) + (e^-x))/2, and use taylor series for e^x and e^-x, or just simply use the series of cosh(x)?

6. Oct 21, 2007

### Gib Z

Ok well let me reiterate that small values are kept on the calculators storage, its only large values we are wondering about. Now, calculators keep it to about 15 digits memory, which means that an error of 1 * 10^(-15) is ok for a calculator. We shall note that e^(-x)/2 reaches this very quickly indeed. In fact, the error bound is already satisfied for x= 35. So really all the calculator does is compute (e^x)/2. For that, it uses the Taylor series of e^x.

PS: Hurkyl, i wouldn't say no to a homework helpers ribbon, i have earned it no :D?

Last edited: Oct 21, 2007
7. Oct 21, 2007

### Firepanda

So let me get this straight, the calculator uses an algorithm inside it using the exact definition of cosh(x), but it uses the taylor series when computing the exponentials.

Also, you say the series for e^x is used for higher values of x, but what series is used for the lower values? Say |x| < 1, or more generally |x| < 35.

P.S. And give him his ribbon :P

8. Oct 21, 2007

### Gib Z

For smaller values the calculator keeps extensive libraries of data, remember a calculators storage memory can have millions upon millions of digits. So it would have handy e, e^10, e^(0.1), e^(0.001)....e^(0.0000000001). Then any power of e can be composed from them, eg e^(3.2) = ( e^1 ) ^ 3 * (e^0.1)^2

9. Oct 21, 2007

### Firepanda

That's exactly what i needed to know, thankyou

10. Oct 21, 2007

### Gib Z

No problem =]

11. Oct 21, 2007