GithubHelp home page GithubHelp logo

Trigonometric simplifications about faust HOT 4 OPEN

grame-cncm avatar grame-cncm commented on May 17, 2024
Trigonometric simplifications

from faust.

Comments (4)

sletz avatar sletz commented on May 17, 2024

Having symbolic computation on mathematical expressions would certainly by very interesting... The thing is that the question (in general...) seems quite large:

  • do we only need a limited subset of simplifications? Only trigonometric simplifications ? Or a larger class of expressions?

  • what would be the criteria of simplifications ? I guess the "computation cost" of the resulting expression. Or "expression complexity " ? So we would have to characterize that. Is it enough? Do we need to think about other criteria like "calculation precision" (since we are using approximation of numbers when we compute with floats...) ?

  • can we develop something ourself? Or the problem is difficult enough to use an already existing system like for instance: GiNaC (https://www.ginac.de/tutorial/) or Simply (http://docs.sympy.org/latest/index.html) ?

Any insight would be welcome..

from faust.

sekisushai avatar sekisushai commented on May 17, 2024

For my applications, the first criterion for simplification is the lowest computation cost. I guess it associated with the simplest mathematical expression.

In fact, some algorithms never compiles because of too complex expressions and high computation cost. If it compiles it is often very CPU consuming while a lot of terms could be computed with simpler mathematical expressions or are even 0 ('cos(ma.PI/2)', 'sin(ma.PI)', ...).

I have no idea how a symbolic computation system is integrable in Faust and at which point. But as for factorization, the compiler could maybe at least recognize some mathematical identities ..?

About precision, my thought is that symbolic form could help to gain a lot computation cost, especially with trigonometry.
For example with the number 'PI'. If 'cos(ma.PI/2)' gives a true '0' (and not '6.123233995736766e-17' in double precision), it could simplify the output at compilation time, or if use in association with some sliders, it could be associated with the primitives ‘control' or ‘enable’ and save a some computations at execution time.

from faust.

josmithiii avatar josmithiii commented on May 17, 2024

from faust.

cbix avatar cbix commented on May 17, 2024

Picking up this old issue, I second the idea of more advanced term rewriting for mathematical expressions. The extent to which you can do static optimization is one of the things I really like about functional language compilers and Faust use cases often require optimization of CPU cycles.

One particular thing I needed was the simplification of exp(log(x)) (resp. pow(a, log10(x))) so I can normalize a frequency parameter given in Hz for va.moogLadder without having to worry about precision loss and unnecessary calculations. But I can imagine other use cases that would benefit from this.

from faust.

Related Issues (20)

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.