0x0f0f0f / gobba

A purely functional dynamically typed programming language.
https://0x0f0f0f.github.io/gobba-book/
MIT License
56 stars 2 forks source link

Differentiable programming and infinites #10

Open 0x0f0f0f opened 4 years ago

0x0f0f0f commented 4 years ago

If a function in minicaml is pure and does only numerical computations, it should be (possibly) integrable or differentiable.

Differentiation should be straightforward to implement, it should be an interpretation of expressions different from evaluation, returning new expressions. Gradients can be easily obtained by iterating single variable derivation over the body of a "nested" lambda. The concrete syntax for derivation should be derive (some n-ary function).

Single variable integration should be done in a similar manner to derivation. The concrete syntax integrate (some 1-ary function) should return a new function denoting the indefinite integral (antiderivative). The concrete syntax integrate from x to y (some 1-ary function) should return the definite integral calculated as in the second fundamental theorem of calculus. To compute multiple integrals the integrate over (domain) (some n-ary function) concrete syntax should be used. It is to be discussed if the integration (domain) should be expressed as a sequence of inequalities, separated by ;. If so, the interpretation of (domain) expressions should not be normal evaluation, but a process that extracts the integration boundaries for each nested integral.

Computing indefinite multiple integrals is to be debated. See this stackexchange post.

Implementing differentiation implies implementing the algebra of limits and infinite values. I am not sure if to include the Infinity value as a first class value of the language, and therefore extending the numerical primitives so that they can compute in the algebra of limits.