Understanding Hyperbolic Functions: Calculations in Calculators and MATLAB

  • Thread starter Thread starter Firepanda
  • Start date Start date
  • Tags Tags
    Computing
AI Thread Summary
Calculators and MATLAB compute hyperbolic functions using a combination of Taylor series and predefined values for small and large inputs. For large values, they often rely on the exponential function's Taylor series, while for smaller values, they utilize stored values for precision. The discussion highlights that calculators typically maintain around 15 digits of accuracy, which can lead to significant errors for large calculations. The algorithms used for functions like cosh(x) involve computing e^x and e^-x through their respective series. Overall, calculators balance between using mathematical series and stored values to ensure accurate results across a range of inputs.
Firepanda
Messages
425
Reaction score
0
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 :)
 
Physics news on Phys.org
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)
 
Nice advice, but what I think they want is simpler, considering we havn't learned 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).
 
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 I am 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.
 
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)?
 
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:
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
 
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
 
That's exactly what i needed to know, thankyou
 
  • #10
No problem =]
 
Back
Top