Category: Algorithms

Multidimensional Linear Interpolation (Part 2)

In an earlier post, I mentioned that we needed an object-oriented modern Fortran library for multidimensional linear interpolation. Well, here it is. I call it finterp, and it is available on GitHub. It can be used for 1D-6D interpolation/extrapolation of data on a regular

Tagged with: , ,

Numerical Differentiation

I present the initial release of a new modern Fortran library for computing Jacobian matrices using numerical differentiation. It is called NumDiff and is available on GitHub. The Jacobian is the matrix of partial derivatives of a set of \(m\) functions

Tagged with: , , , ,

Computing Pi

The digits of can be computed using the “Spigot algorithm” [1-2]. The interesting thing about this algorithm is that it doesn’t use any floating point computations, only integers. A Fortran version of the algorithm is given below (a translation of the Pascal program

Tagged with: , ,

Direct and Inverse

There are two standard problems in geodesy: Direct geodetic problem — Given a point on the Earth (latitude and longitude) and the direction (azimuth) and distance from that point to a second point, determine the latitude and longitude of that second point. Inverse geodetic

Tagged with: ,


SLSQP [1-2] is a sequential quadratic programming (SQP) optimization algorithm written by Dieter Kraft in the 1980s. It can be used to solve nonlinear programming problems that minimize a scalar function: subject to general equality and inequality constraints: and to lower

Tagged with: , , ,

Topological Sorting

Topological sorting can be used to determine the order in which a collection of interdependent tasks must be performed. For example, when building a complex modern Fortran application, there can be many modules with complex interdependencies (via use association). A Fortran building system (like FoBiS,

Tagged with: , ,

Lagrange Interpolating Polynomials

A simple Fortran implementation of interpolation by Lagrange polynomials is given below. Though named after Joseph-Louis Lagrange, the formula was first discovered by English mathematician Edward Waring. Examples of interpolating polynomials for the  function are shown here for different numbers of points , , etc.

Tagged with: , , ,

Complex Step Differentiation

Complex step differentiation is a method for estimating the derivative of a function  using the equation: Unlike finite-difference formulas, the complex-step formula does not suffer from roundoff errors due to subtraction, so a very small value of the step size can be

Tagged with: , ,

Rodrigues’ Rotation Formula

Rodrigues’ rotation formula  can be used to rotate a vector a specified angle about a specified rotation axis :   A Fortran routine to accomplish this (taken from the vector module in the Fortran Astrodynamics Toolkit) is: This operation can also

Tagged with:

Direct Geodetic Problem

The “direct” geodetic problem is: given the latitude and longitude of one point and the azimuth and distance to a second point, determine the latitude and longitude of that second point.  The solution can be obtained using the algorithm by Polish

Tagged with: ,