Fourier series in Mathematica
June 8, 2026 at 11:35 AM by Dr. Drang
After my last post—the one about using Fourier series—I started thinking about how to use Mathematica to develop Fourier series.1 I could, of course, use the Integrate function to determine the Fourier coefficients, but Mathematica has other functions that can do the job directly once you understand how they work.
Mathematica has several Fourier functions, but I’m going to stick with the ones associated with sine series, FourierSinCoefficient and FourierSinSeries. They’re meant to be easy to use, and they are, but you need to know how they’re defined.
The coefficients used in both of these functions are defined this way:
This doesn’t match up exactly with the definition I used for getting the Fourier coefficients of a loading function, :
To use the Mathematica functions to get the , we have to do a change of variable. Let
so
(Here, z is just another variable name; I’m not using it to represent a complex number.)
This changes the expression for to
which means we can use the Mathematica functions as long as we substitute in for in the expression for .
Let’s give it a try on this parabolic loading function:
It shouldn’t take many Fourier terms to get a good approximation of this.

Here are the Mathematica commands I used:
q = 4 qmax x (L - x)
qn = FourierSinCoefficient[q /. x -> L z/Pi, z, n]
You can see the substitution in the first argument to FourierSinCoefficient.
After simplification, the results were
We could also get the series (through ) directly with FourierSinSeries:
qapprox2 = FourierSinSeries[q /. x -> L z/Pi, z, 7] /. z -> Pi x /L
where the inverse substitution comes at the end to put the expression back in the form we want. Here’s a screenshot from the Mathematica notebook:

You can see that the coefficients match what we got earlier.
A quick plot of the difference between this truncated Fourier series and the original parabolic function shows that, as expected, the series does a good job of replicating the original:

In this plot, the horizontal axis is the fraction of and the vertical axis is the fraction of .
If you’re interested, here’s the entire Mathematica notebook:
Now that I understand the way these functions work, I can do more complicated Fourier analysis in Mathematica without questioning myself on whether I’m using them correctly.
-
Something I couldn’t do in any of the posts in that series, as that would be breaking the rules I had set up for myself. ↩
Simply supported beam—Fourier series solution of the ODE
June 6, 2026 at 3:36 PM by Dr. Drang
We’re finally here, at the end of all things. In this post, we’ll use a Fourier series to get the formula for the center deflection of a simply supported beam with a uniformly distributed load. We’ll see some of the same math that we saw in the previous Fourier series solution, but the fundamental approach will be different.
Let’s start with the fourth-order ordinary differential equation for a beam with a general loading function, :
The simple supports at both ends give us these boundary conditions:
Let’s work out the solution for a loading condition we haven’t considered before, a distributed load in the form of a sine wave:
where is a positive integer and is some constant amplitude. Given the form of the governing ODE and the boundary conditions, it seems likely that the solution will look like this:
It satisfies the boundary conditions, and if we plug it and the expression for q into the governing ODE, we get
which is a solution for all values of x if
This will work for any value of m that’s a positive integer.
Since the governing ODE is linear, if q is the sum of several sine terms, the solution will be the sum of several sine terms. Returning to our favorite problem,

we now have a path for expressing the solution as a sum of sines, as long as we can express the constant function, , as a sum of sines.
And of course we can. The Fourier sine series expression that fits a constant is
where
This result comes from the orthogonality of the sine function. The Fourier coefficients are the same as those for a square wave.
Plugging this result into the expression for , we get
for odd m. Therefore,
You may recall from our earlier post that there’s a closed-form solution for this sum:

The last entry in this table with gives us
Substituting the closed-form solution in for the sum yields our old friend:
The purpose of this series of posts—apart from a bit of showing off—was to demonstrate why I love structural analysis. It has, even in the simplest of problems, a depth that rewards those who study it. And when you’re confronted with problems that aren’t so simple, you can draw on that depth to understand and solve them.
Simply supported beam—Newmark’s method
June 6, 2026 at 7:44 AM by Dr. Drang
This would have been the last post in the series if I hadn’t realized recently that another method deserved a post. So this is the penultimate. It was described in this 1943 paper by Nathan Newmark and is known—or was known—as Newmark’s method.
I say was because this method is dead. How dead? Forty-five years ago, when I was an undergraduate taking structural analysis courses, Newmark’s method wasn’t being taught in the department that he had been the head of for decades and whose main building is named after him. That’s dead.
Which isn’t to say it wasn’t a good method. Some of my professors talked about using it when they were young, and it was a practical technique when engineers used slide rules and desk calculators, but it was clear by the 80s that its time had passed. Still, it’s desncribed in the textbook I used as an undergrad, and I did eventually learn it well after I was out of school, so here it is.
Newmark’s method is basically a way of doing double integration, so you can use it to go from loading to bending moments or from bending moments to deflection. As Newmark says in the introduction to his paper,
The numerical procedure is approximate, but leads to exact moments (or deflections) when the loading diagram (or diagram of “angle changes”) is made up of segments that are bounded by straight lines or by arcs of parabolas.
For our simply supported, uniformly loaded beam, the “angle change” diagram—which we’ve been calling a curvature diagram—is a parabola, so we can get an exact solution.
Let’s say we have a beam with any kind of support conditions and some general distributed loading:

The fundamental trick of Newmark’s method is to imagine a set of simply supported beams inserted between the load and the real beam.

The small imaginary beam segments are all of the same length, , and the analysis proceeds by calculating the reaction forces at the ends of these beams and then building a table of loads, shears, and moments based on these reactions (reversed in direction) acting on the large original beam.
Here’s a figure from the paper that explains how to calculate the reaction forces for parabolically distributed loading:

There are simpler formulas if the loading is distributed linearly.
You may have noticed the double curvature in the right drawing, which means that the load shown there is not parabolic. Newmark suggests using the formulas in this figure even if the loading curve is of higher order—the parabolic formulas are close enough if you divide the beam into several segments.
I’ve focused here on the process of going from loads to bending moments because I think the mechanics of that is easier to understand. But the same process applies to going from curvature to deflection. We went through that in the conjugate beam post.
In fact, Newmark does our problem in the paper. He uses the constant q as the intensity of the load and splits the beam into four segments:

This may look impenetrable, but we can simplify it by using only two segments and explaining each step. Here’s the table, starting with the moment diagram:

The row labeled Moment is the value of the bending moment at each point. The Curvature row is just the moment at each point divided by EI and with the sign reversed. Those are the easy ones.
The Angle change row is based on the curvature values and the formulas in Figure 5 above. The value at the left end is
where we’ve used . This is also the value at the right end.
The value at the center is
We start the Average slope row with the knowledge that the slope at the center of the beam is zero, so if the angle change across the center is
then the average slope must go from
as we move from the left half of the beam to the right half.
(If you’re having trouble with this, remember that angle change is analogous to shear and think of a beam with an antisymmetric shear diagram. If the change in shear across the centerline is , then the shear must be in the left half of the beam and in the right half.)
For the Deflection row, we know that the deflection is zero at the left and right ends. Since the average slope in the left half of the beam is
the deflection at the center must be
an answer we’ve now seen twelve times.
Simply supported beam—dummy unit load method
June 5, 2026 at 7:51 AM by Dr. Drang
We’re in the home stretch of this series, so ANIAT will soon go back to complaining about Apple’s UI choices.1 Next week’s WWDC keynote should provide some inspiration.
But today’s post covers our eleventh method for deriving the center deflection of a uniformly loaded simply supported beam: the dummy unit load method. When I was an undergraduate, this was the method we used to determine the deflections of truss structures, but it’s more general than that. My favorite explanation of why it works is in Nicholas J. Hoff’s The Analysis of Structures. I have the original Wiley hardcover of this book, but you can apparently get both paperback and hardcover reprints.
Hoff uses the principle of virtual work in his explanation, and I’d like to quote him here, but unfortunately his explanation is split between one section on the analysis of trusses and another on the analysis of beams. I couldn’t figure out a nice way to put them together coherently, so you’re just going to have to trust me.
For a beam, you can get the deflection at a particular point by following these steps:
- Work out an equation for the bending moment, M, in the beam for the given set of applied loads.
- Imagine that same beam with those loads removed (this is the dummy structure) and a concentrated unit load placed at the point at which we want the deflection. By definition, the magnitude of a unit load is one. The unit load points in the direction of the deflection we want to calculate.
- Work out an equation for the bending moment, m, in the dummy beam with the unit load.
The desired deflection is
Let’s apply this simple principle to our problem:

The bending moment is
where the x coordinate starts at the left end of the beam and increases to the right, as usual.
This same structure with just a unit load at the center is

Its bending moment is
and m is symmetric about the center of the beam.
Therefore,
and we can take advantage of symmetry to say
You can pretty much do this problem in your head if you’re good at figuring out least common multiples. I’m not, but after writing things out, I did realize that the LCM of and is .
-
Heads up, though. I recently thought of a thirteenth method that’s different enough from the others to merit another post. Sorry about that. ↩