Category Archives: Mathematics

RK4 in Haskell

Ran across this today. It’s a well written implementation of RK4. 4th order Runge-Kutta (RK4) integration in Haskell

Posted in Mathematics, Programming | Leave a comment

Line Segment to Circle Collision/Intersection Detection

Style and Notation All variables are represented in italics except in the diagrams and Python code. Vectors are shown in bold except in the diagrams and Python code. The notation |a| is used to represent the length of a vector … Continue reading

Posted in Computational Geometry, Mathematics, Physics, Programming | 6 Comments

Improved RK4 Implementation

This is a Python implementation of the RK4 numerical integrator that works with differential functions of all orders. That is, any function in the form F(x, y, y’, y”, …, ). If you’re new to numerical integration or even RK4 … Continue reading

Posted in Mathematics, Physics, Programming | Leave a comment

Extending derivatives and integrals into fractions

In the previous post, I wrote about a way to generalize derivatives and integrals into one function. What happens if a number other than an integer is passed to that function? Here is the generalization from the last post: Set … Continue reading

Posted in Mathematics | Leave a comment

Generalizing derivatives and integrals

Start with a simple expression, , and take a few derivatives: A pattern is emerging: , where c is the coefficient. Now the hard part is finding the pattern in the coefficient. This needs to be taken out of the … Continue reading

Posted in Mathematics | 3 Comments

Fourth order Runge-Kutta numerical integration

Here’s a Python implementation of RK4, hardcoded for double-integrating the second derivative (acceleration up to position). For a more generalized solution, see my other implementation. I tried to keep this as simple as I could, so people can easily see … Continue reading

Posted in Mathematics, Physics, Programming | 6 Comments