Version 8 (modified by 9 years ago) (diff) | ,
---|

#### Table of Contents

# Remez exchange toolbox

**TL;DR:** this toolbox helps find CPU-friendly approximations to complicated functions.

The Remez exchange algorithm is a fast method for approximating functions in a Chebyshev space. More precisely, the Lol Engine provides its own implementation of the Remez exchange algorithm to find **polynomial approximations to real functions**. Such polynomials are also known as **minimax polynomials**.

## Example

The following graph shows approximations of *sin(x)* over [-π, π] using three different polynomials:

- the Taylor series to the 5th order:
*x-x³/3!+x⁵/5!* - the Taylor series to the 7th order:
*x-x³/3!+x⁵/5!-x⁷/7!* - the minimax polynomial to the 5th order:
*x-0.1587164x³+0.00585375x⁵*

It is obvious that the polynomial found using the Remez method is closer to the sine curve than the Taylor series of the same order, and still better than the Taylor series of the next order. If you want to approximate a function over an interval, Remez is always better. If you want to convince people that it is, please refer them to this blog article.

## Prerequisites

In order to use LolRemez, you need:

- basic knowledge of C++ (include headers, write functions, compile programs)
- decent knowledge of algebra (mainly polynomials) and analysis (if you don’t understand how a function behaves, you should not try to approximate it)

Essentially, if you don’t understand the maths in the tutorial, there is a problem either with the tutorial, or with your math skills.

Before you start reading the tutorial, I suggest you have a quick look at the Lol Engine real numbers? documentation.

## Tutorial

There are five main sections in the tutorial:

### Attachments (1)

- taylor-vs-remez.png (24.1 KB) - added by 9 years ago.

Download all attachments as: .zip