1

I'm sure this has been answered, but I am not having much luck finding it. Is there a way to implement transcendental functions ($\sin(x)$, $\cos(x)$, $e^{x}$, $\ln(x)$, etc...) using techniques from linear algebra?

My current code uses a successive approximation technique by calculating terms of a Maclaurin series in a loop. When the result stops changing, the loop ends and the result is returned.

Thomas Russell
  • 10,425
  • 5
  • 38
  • 66
  • Are you familiar with continued fraction expansions for transcendental functions? There's a bit of matrix algebra involved in evaluating convergents. – hardmath Feb 17 '13 at 09:44
  • Maybe this is what you're looking for: http://en.wikipedia.org/wiki/CORDIC – Hans Lundmark Feb 17 '13 at 10:20
  • Aside: when summing a large list of floating-point numbers, it's usually better (in terms of roundoff errors) to start adding the smallest numbers first rather than the biggest. –  Feb 17 '13 at 10:58

1 Answers1

1

There is a huge body of literature on approximation of "special" functions. A lot of stuff was written in the 1960's, when people were creating software libraries to calculate these functions.

The classic book is the one by Cody and Waite. A more up-to-date reference is the book by muller

One common approach is to use rational or polynomial approximations, which is what you're doing with your Maclaurin expansion. However, the problem with Taylor expansions is that they are very good at one point, and then they get progressively worse as you move away from this point. Typically, you need an approximation that is uniformly good over some interval, which leads you to Chebshev polynomials.

I wouldn't characterise any of this work as "linear algebra" though.

bubba
  • 43,483
  • 3
  • 61
  • 122