1

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

Praveen Kumar Purushothaman
  • 164,888
  • 24
  • 203
  • 252
Paul Chernoch
  • 5,275
  • 3
  • 52
  • 73

4 Answers4

1

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.

Jim Lewis
  • 43,505
  • 7
  • 82
  • 96
  • Thank you. And you are right about the discontinuity. Wasn't paying attention. I can probably find a way to remove it by messing with the other terms. – Paul Chernoch Jan 27 '10 at 18:03
1

Maxima does this. See the taylor function.

Alex Budovski
  • 17,947
  • 6
  • 53
  • 58
0

https://ctaylor.codeplex.com

This is a C++ library which allows you to write expressions and variables and calculate not only the value but also any order derivative. The compiler is the one generating the code for the derivatives.

0

Wolfram Alpha will do this for you symbolically for free on the web. H/T @ExcessPhase for the idea of using abs(x)=sqrt(x*x).

Wolfram Alpha output

kuzzooroo
  • 6,788
  • 11
  • 46
  • 84