Old 04-18-2014, 05:01 PM   #1
SaulT
Human being with feelings
 
Join Date: Oct 2013
Location: Seattle, WA
Posts: 876
Default common Taylor polynomials

So,

Here is a library of functions for common Taylor polynomial expansions. Initially I wrote it to see how it would perform against native Reaper functions, and also to get a dang error function in the system. While I tried to optimize them as much as I could, they are still about 40% slower than their native counterparts.

To use in your plugins, download the attached file, rename it to have the 'jsfx-inc' extension, plop it in your 'effects' folder, include the line "import taylor.jsfx-inc" after your sliders, then put a 't' in front of the expression you wish to use. Supported functions are


sin, cos, tan, asin, acos, atan, exp, erf

become

tsin, tcos, ttan, tasin, tacos, tatan, texp, terf


Two extra functions are included - terf5 and texp5 use an extra term for a small measure of added accuracy, if you so desire. All polynomials are otherwise 4-term expansions, except for cosine, which is 5. Convergence on cosine is iffy, even with 5 terms - I suggest using sin() instead, adding $pi/2 to your value.

example usage

Code:
tan_x = tan(x);
taylor_tan_x = ttan(x);

...

sigmoid = erf(x);  // this is included in the library
taylor_sigmoid = terf(x);
Hope you find it interesting, if not useful.
Attached Files
File Type: txt taylor.jsfx-inc.txt (4.3 KB, 1609 views)

Last edited by SaulT; 04-21-2014 at 10:32 AM. Reason: I love tacos
SaulT is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 01:38 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.