Search code examples
macoscurve-fittingtaylor-seriespower-series

Any (free) tools to compute Taylor series expansion of a function?


After painful trial and error, I arrived at a grotesque function that behaves the way I want it to:

(exp(- abs(6 * (x - 0.7)) ^ 2.5 ) + exp(- (x-1.7) ^ 8 ) * 1.2)/1.5785

I only care about the values for the range 0 <= x <= 1 and the slope at x = 1. In this interval, 0 <= y <= 1 as well.

Are there any free tools (web-based or MAC OS X) that will generate the Taylor series expansion for this? (I found one, but it choked on such a complex formula and does not support abs.)

My purpose in generating the series expansion is that it may be more efficient to compute. (This function will be called hundreds of thousands of times in Javascript, so performance is an issue.)

Alternately, I could sample the points and do a curve fitting if I had a curve fitting tool. (I do not own MS Excel, alas.) Know of any free non-linear curve-fitting tools (web-based or MAC OS X)?


Solution

  • GNU Octave is a free package that, among other things, has a function polyfit to do least-squares polynomial curve fitting. I think this (or some other package with an equivalent function) is probably a better match for your problem than Taylor series expansion. That absolute value term might make it hard to find a Taylor series that extrapolates well through the point at x=0.7, where the first derivative has a discontinuity.