Tuesday, 3 August 2010

Experimentalized Maths Library

It struck me today, that although I reuse a lot of code and classes, the one thing I tend to rewrite each and every time I start a new program is the mathematics. I dread to think how many hours this has wasted me over the years, so I finally decided to write a toolkit encompassing almost anything maths based. So far I've written a couple of constant utilities, one for mathematical constants, and one for scientific constants and a complex number class. Currently on the list are:
  • Matrices
  • Data sampling and statistics
  • Quadrature (integration) - Rectangle, Trapezium & Simpson's rule 
  • Numerical differentiation - finite differencing ✔,  runge-kutta (and other ODE solvers)
  • Graphs
  • Vectors ( 2, 3  and N dimensional)
  • Geometry class & trigonometry solvers
  • Probability
  • Random numbers (Mersenne Twister, other PRNGs)
  • Time and date
  • Complex numbers 
  • Bitwise operators 
  • Mathematical constants 
  • Scientific constants 
It would be great if you could let me know what kinds of maths utilities you would find useful, and even better if you have some of your own code and would like to collaborate with me on this.

Update: Your suggestions:

  • Bezier curves (Cubic & Quadratic), Bezier surfaces?


  1. Sounds great! I think math about bezier curves(both quad and cubic) will be useful.

    I'm not good at math, but when you published the lib I can try porting it to haXe :)

  2. Added that to the list! In C++ I use the NAG library which is amazing, I think it would be great if there was a tool like that for flash! Guess this could be the start!

    Here is a link to NAG but it isn't open source so I only have access to it at Uni.

    Will have a look if there is any optimised source open source for some of the classes I've been thinking about and see if I can port it to AS3...