Code Monkey home page Code Monkey logo

lolremez's Introduction

LolRemez

A Remez algorithm toolkit to approximate functions using polynomials.

A tutorial is available in the wiki section.

Example

Approximate atan(sqrt(3+x)-exp(1+x)) over the range [-1,1] with a 5th degree polynomial:

lolremez -d 5 -r -1:1 "atan(sqrt(3+x)-exp(1+x))"

Result:

/* Approximation of f(x) = atan(sqrt(3+x)-exp(1+x))
 * on interval [ -1.0000000000000000000, 1.0000000000000000000 ]
 * with a polynomial of degree 5. */
float f(float x)
{
    float u = -1.1514600677101831554e-1f;
    u = u * x + -3.1404157365765952659e-1f;
    u = u * x + 4.7315508009637667259e-1f;
    u = u * x + 5.7678822318891844828e-1f;
    u = u * x + -1.2480195820255797595f;
    return u * x + -7.6941172112944451609e-1f;
}

Available functions

Binary functions/operators:

  • + - * /
  • atan2(y, x), pow(x, y)
  • min(x, y), max(x, y)

Math functions:

  • abs() (absolute value)
  • sqrt() (square root), cbrt() (cubic root)
  • exp(), exp2(), log(), log2(), log10()
  • sin(), cos(), tan()
  • asin(), acos(), atan()
  • sinh(), cosh(), tanh()

Changes

News for LolRemez 0.3:

  • implemented an expression parser so that the user does not have to recompile the software before each use.
  • C/C++ function output.
  • use threading to find zeros and extrema.
  • use successive parabolic interpolation to find extrema.

News for LolRemez 0.2:

  • significant performance and accuracy improvements thanks to various bugfixes and a better extrema finder for the error function.
  • user can now define accuracy of the final result.
  • exp(), sin(), cos() and tan() are now about 20% faster.
  • multiplying a real number by an integer power of two is now a virtually free operation.
  • fixed a rounding bug in the real number printing routine.

Initial release: LolRemez 0.1

lolremez's People

Contributors

samhocevar avatar jylam avatar

Watchers

Noon van der Silk avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.