Angular and Numerical Analysis: creating a library for numerical integration of ODEs, Euler’s method

Jorge Guerra Pires, PhD
Geek Culture
Published in
3 min readNov 13, 2021

--

Recently, I wanted to use numerical integration on Angular. I was able to find several packages, however, they are all for Node.js.

Nowadays, we can do a lot at the frontend: i) machine learning; ii) database connection; iii) play chess and have your match analyzed! and I am working to make it possible for you to run numerical simulations also in the frontend!

Why I have created the library

My first attempts:

  • Use Octave, as I am doing on my ebook — the issue is that I could not find an easy solution for using Octave at the frontend, neither at the backend;
  • Use an already built library on NPM — found several of them, none to Angular/Typescript, writing soon an article about this issue!
  • During my second postdoc, they used Galaxy to run those calculation on a separate server, it is a mess!
Euler’s method compared to the actual solution
Optimal Control applied to life sciences: a numerical method based presentation. https://www.academia.edu/18365349/Optimal_Control_applied_to_life_sciences_a_numerical_method_based_presentation
Optimal Control applied to life sciences: a numerical method based presentation. https://www.academia.edu/18365349/Optimal_Control_applied_to_life_sciences_a_numerical_method_based_presentation

User defined derivatives

Just added a new feature: Cameleon is a generic function, using mathjs, that you can define your own function, and integrate normally, like the functions already on the library.

In general, the notation is like any mathematics based software, like Octave. See here a Notepad: https://mathjs.org/

thanks to mathjs now you can add your own function for integration, awesome!

Our library, have fun!😎

This library is used here, should you use it, just let me know!

Q&A

What about Wolfram Online?

Asking about mathjs, which we shall add to our app in the future! The question is applicable to our case!

From: Theoretical and Mathematical Biology Facebook Group

It is a good option, but it is paid! and quite expensive! This solution is free, you can add to your app! PS. by paid, I mean, you do not have access to the codes, if you want to use in your online app.

Here are some open source codes from them: https://www.wolfram.com/open-materials/?fbclid=IwAR1A47jqjw6KhxJcGul9KZxnvKURz_rZ9LLTyf9APqglwL4a-1R7o7GD0Ls

For those of you not aware: Wolfram is the group behind Mathematica, one of the most powerful software for symbolic calculation, I used on bifurcation theory, in order to expand in Taylor series, quite useful. Prof. Ganna also used on modelling COVID.

Upcoming course

--

--

Jorge Guerra Pires, PhD
Geek Culture

Independent Researcher and writer at Amazon | “I want thinkers, not followers!” | More: https://linktr.ee/jorgeguerrapiresphd