All the data you need.

Tag: Math

How to depress a cubic
The title of this post sounds like the opening to a bad joke: How do you depress a cubic? … Insert your own punch line. A depressed cubic is a simplified form of a cubic equation. The odd-sounding terminology suggests that this is a very old idea, older than the …
Calculating sine to an absurd number of digits
Suppose you wanted to calculate sin(x) to a million decimal places using a Taylor series. How many terms of the series would you need? You can use trig identities to reduce the problem to finding sin(x) for |x| ≤ 1. Let’s take the worst case and assume we want to …
Simple example of Kleisli composition
When a program needs to work with different systems of units, it’s best to consistently use one system internally and convert to another system for output if necessary. For example, maybe you need to work in degrees and radians. It would be sensible to do all calculations in radians, because …
Entropy of a Student t distribution
I was looking up the entropy of a Student t distribution and something didn’t seem right, so I wanted to look at familiar special cases. The Student t distribution with ν degrees of freedom has two important special cases: ν = 1 and ν = ∞. When ν = 1 …
Solving quadratic trig equations
A few days ago I wrote about how to systematically solve trig equations. That post was abstract and general. This post will be concrete and specific, looking at the special case of quadratic equations in sines and cosines, i.e. any equation of the form As outlined earlier, we turn the …
Simultaneous root-finding
In 1891 Karl Weierstrass developed a method for numerically finding all the roots of a polynomial at the same time. True to Stigler’s law of eponymy this method is known as the Durand-Kerner method, named after E. Durand who rediscovered the method in 1960 and I. Kerner who discovered it …
Mercator and polar projections
This post is a more quantitative version of the previous post. Before I said that straight lines on a Mercator projection map correspond to loxodrome spirals on a sphere. This post will make that claim more explicit. So suppose we plot a straight path from Quito to Jerusalem on a …
Straight on a map or straight on a globe?
Straight lines on a globe are not straight on a map, and straight lines on a map are not straight on a globe. A straight line on a globe is an arc of a great circle, the shortest path between two points. When projected onto a map, a straight path …
Elliptic coordinates and Laplace’s equation
In rectangular coordinates, constant values of x are vertical lines and constant values of y are horizontal lines. In polar coordinates, constant values of r are circles and constant values of θ are lines from the origin. In elliptic coordinates, the position of a point is specified by two numbers, …
Computing acrcos
Suppose you take two numbers, a and b, and repeatedly take their arithmetic mean and their geometric mean. That is, suppose we set a0 = a b0 = b then a1 = (a0 + b0) b1 = √(a0 b0) and repeat this process, each new a becoming the geometric mean …
Three diagrams
This post will give examples of three similar diagrams that occur in three dissimilar areas: design of experiments, finite difference methods for PDEs, and numerical integration. Central Composite Design (CCD) The most popular design for fitting a second-order response surface is the central composite design or CCD. When there are …
Carlson’s elliptic integrals
Although its a little fuzzy to say exactly which functions are “special” functions, these are generally functions that come up frequently in applications, that have numerous symmetries, and that satisfy many useful identities. The copious interconnections between special functions that are part of what makes them special also makes these …
Kinds of elliptic integrals
There are three fundamental kinds of elliptic integrals, and these are prosaically but unhelpfully called elliptic integrals of the first kind, the second kind, and the third kind. These names sound odd to modern ears, but it’s no different than classical musicians naming symphonies Symphony No. 1, Symphony No. 2, …
What is a Pentanomial GFSR random number generator?
The ISO random number generation standard, ISO 28640, speaks of a “Pentanomial GFSR method” for generating random variates. What is this? We’ll break it down, starting with GFSR. GFSR In short, a GFSR random number generator is what is now more commonly called a linear feedback shift register, or LFSR. …
Systematically solving trigonometric equations
Students are asked to solve trigonometric equations shortly after learning what sine and cosine are. By some combination of persistence and luck they may be able to find a solution. After proudly presenting the solution to a teacher, the teacher may ask “Is that the only solution?” A candid student …
Nephroids and evolutes
The previous post looked at the evolute of an ellipse. This post will look at evolutes more generally, and then look at nephroids. As a quick reminder, given a curve curve c, a point on its evolute is the radius of curvature for a point on c. See the previous …
Newton’s method: The Good, The Bad, and The Ugly
This post will give examples where Newton’s method gives good results, bad results, and really bad results. Our example problem is to solve Kepler’s equation M = E – e sin E for E, given M and e, assuming 0 ≤ M ≤ π and 0 < e < 1. …
Uniform sampling from an ellipse
There is a simple way to randomly sample points from an ellipse, but it is not uniform. Assume your ellipse is parameterized by with t running from 0 to 2π. The naive approach would be to take uniform samples from t and stick them into the equations above. Rather than …