Blog Archives

How Lp spaces nest

A function f(x) is said to be in Lp if the integral of |f(x)|p is finite. So if you know f is in Lp for some value of p, can conclude that f is also in Lq for some q?

Tagged with:
Posted in Math

Avoiding underflow in Bayesian computations

Here’s a common problem that arises in Bayesian computation. Everything works just fine until you have more data than you’ve seen before. Then suddenly you start getting infinite, NaN, or otherwise strange results. This post explains what might be wrong

Tagged with: ,
Posted in Statistics

Fractional integration

Define the integration operator I by so I f is an antiderivative of f. Define the second antiderivative I2 by applying I to f twice: It turns out that To see this, notice that both expressions for I2 are equal

Tagged with: ,
Posted in Math

Numerical integration trick

Suppose you want to evaluate the following integral: We’d like to do a change of variables to make the range of integration finite, and we’d like the transformed integral to be easy to evaluate numerically. The change of variables t

Tagged with:
Posted in Math

SciPy integration misunderstanding

Today I needed to compute an integral similar to this: I used the following SciPy code to compute the integral: from scipy.integrate import quad def f(x): return 0.01*x**-3 integral, error = quad(f, 1000, sp.inf, epsrel = 1e-6) print integral, error

Tagged with: , ,
Posted in Python

Care and treatment of singularities

My favorite numerical analysis book is Numerical Methods that Work. In the hardcover version of the book, the title was impressed in the cover and colored in silver letters. Before the last word of the title, there was another word

Tagged with:
Posted in Math

Saved by symmetry

When I solve a problem by appealing to symmetry, students’ jaws drop. They look at me as if I’d pulled a rabbit out of a hat. I used think of these tricks as common knowledge, but now I think they’re

Tagged with: ,
Posted in Statistics

Three surprises with the trapezoid rule

The trapezoid rule is a very simple method for estimating integrals. The idea is to approximate the area under a curve by a bunch of thin trapezoids and add up the areas of the trapezoids as suggested in the image

Tagged with: ,
Posted in Math

Optical illusion, mathematical illusion

Someone sent me a link to an optical illusion while I was working on a math problem. The two things turned out to be related. In the image below, what look like blues spiral and green spirals are actually exactly

Tagged with: , ,
Posted in Graphics, Math

Quasi-random sequences in art and integration

Sometimes when people say they want random points, that’s not what they really want. Random points clump more than most people expect. Quasi-random sequences are not random in any mathematical sense, but they might match popular expectations of randomness better

Tagged with: ,
Posted in Math

Numerical integration article posted

This weekend CodeProject posted an article I wrote entitled Fast numerical integration. The algorithm in the article, introduced in the 1970′s by Masatake Mori and Hidetosi Takahasi, is indeed fast. It integrates analytical functions over bounded intervals with the most accuracy for

Tagged with: , ,
Posted in Math

Random inequalities III: numerical results

The first post in this series introduced random inequalities. The second post discussed random inequalities can could be computed in closed form. This post considers random inequalities that must be evaluated numerically. The simplest and most obvious approach to computing

Tagged with: ,
Posted in Math

Random inequalities II: analytical results

My previous post introduced random inequalities and their application to Bayesian clinical trials. This post will discuss how to evaluate random inequalities analytically. The next post in the series will discuss numerical evaluation when analytical evaluation is not possible. For

Tagged with: , ,
Posted in Math, Statistics

Diagramming modes of convergence

Sometimes a good diagram is a godsend, reducing the entropy in your head at a glace. When I was studying integration theory, I ran across a diagram something like the following in the out-of-print book Elements of Integration by Robert G.

Tagged with: ,
Posted in Math

Fibonacci numbers at work

Today I needed to use Fibonacci numbers to solve a problem at work. Fibonacci numbers are great fun, but I don’t recall needing them in an applied problem before. I needed to compute a series of integrals of the form f(x, y)

Tagged with: , , , ,
Posted in Math