I wanted to make a program that would numerically evaluate
for f(x)
being any function comprised of standard, real, math functions.
Additionaly, I didn't want to rely on any external tools, therefore external compiler (eg. gcc) or JIT based approach was out of the question. In the end, I concluded I need to write my own Just In Time Compiler.
- User provides number of samples and the function string (eg. f(x)=
sin(x)*exp(x)+ln(x)*tan(x)
), - Provided function is parsed, optimized and compiled to LLVM IR,
- LLVM Backend then compiles generated IR to native machine code and emmits it to object file savet to a buffer in operating memory (refered to as object buffer),
- This object buffer is dinamically linked against the definitons of used mathematical functions (using host OS's standard lib or my custom implementations),
- Object buffer has the
f(x)
symbol, pointer to the it's location is returned as a result of linking process, - This generated function is then used in unsafe Rust code to numerically approximate the integral using trapezoidal formula.
Will subsequently add this section
Will subsequently add this section
Will subsequently add this section
This project is licensed under the CC BY-NC 4.0 License. Non-commercial use is allowed with attribution. For commercial use, please contact me, Andreja Janković via e-mail: [email protected]