## Convergence of Pi: Interactive Post

In an earlier post, I discussed how Pi can be expressed as a summation.

$$4 \sum _{n=1}^{\infty } \frac{(-1)^{n-1}}{2 n-1}=4 \left(1 \frac{1}{1}-\frac{1}{3}+\frac{1}{5}-\frac{1}{7}+\frac{1}{9}\text{…}\right)=\pi$$

I thought I would create some embedded Mathematica applets that show how the terms of the series converge to π. To start out, let’s look at how the summation converges as we add more an more terms.

Notice how the approximation jumps between overestimating and underestimating π.

You can try evaluating the summation to different numbers of terms with this interactive tool.

## Scripted Drafting

Suppose you want to create a drawing for a simple part, like a typical tensile dogbone.

You could draw up this part according to specifications in a conventional drafting program. But parts like this often come in different sizes with different proportions, depending on the material and your testing needs. So for this kind of part, there’s a strong chance you would need to draft different versions to satisfy different specifications. When that need arises, your first impulse might be to draft a whole new part or modify an old one as needed, but there is a more efficient approach.

The key is in recognizing that all of the dogbones you are making have the same basic features, and you can follow the same basic steps when drafting each one. Here is one possible workflow:

• Draw a rectangle for the reduced middle section
• Draw rectangles for the grips at the ends
• Subtract out the rounded fillets

Regardless of how long, wide, or thick the dogbone is, you can make it following those same steps. All that changes are the measurements.

So if we approach our drafting project as a sequence of steps, we can draft practically every conceivable dogbone with the effort of drafting just one. It turns out that many software suites out there have some kind of scripting capability. For our example, there is a good free option: OpenSCAD.

OpenSCAD only lets you draft parts with scripts. Making an all-purpose dogbone-making script is simply a matter of setting up the variables which describe the part dimensions up at the beginning of the script.

Then, when it comes time to create the part, the same set of steps are followed every time.

So now you only need to change the numbers at the beginning of the script any time you want to draft a dogbone with new dimensions. This concept of simple, scripted drafting should work with a variety of parts. Keep an eye out situations where:

• You are designing simple parts
• The parts’ interrelated measurements that can be handled algebraically
• Any part can be made by repeating the same set of steps
• You will need to draft multiple versions of the part

If you use scripted drafting, you can save yourself the trouble of having to go back and re-invent the part from scratch each time. All it takes is a little thought focusing on the steps it takes to make the part rather than just the end result.

## Digital Image Correlation Analysis

Digital image correlation (DIC) is a technique for measuring the deformation (i.e. strain) of materials using a sequence of images taken over the course of a mechanical experiment. DIC analysis generally follows 4 steps: capturing an image sequence, tracking features, deformation analysis, and data mining.

## Problem: Image-Centric DIC Limitations

Our research group used DIC as our primary tool for non-contact measurement of material deformation. However, our work was inhibited by several limitations of our existing DIC analysis software.

1. Computationally inefficient and error-prone motion tracking
2. No measurement validation or error estimation
3. Poor record-keeping of the steps of completed DIC analyses
4. A single type of strain result which required long computation times and large amounts of disk space
5. Limited data mining potential due to strain analysis, static reference states, and lack of error estimation

However, the biggest limitation was that our old DIC software was image-centric. From beginning to end, the data was formatted, processed, and saved in arrays matching pixels in the original image. This approach ignores the fact that the discrete feature tracking and the deformation gradient calculation trade location accuracy for displacement and deformation information while introducing and propagating error. Handling the data at the resolution of the image wastes computing resources while misrepresenting the accuracy of the analysis.

## Solution: Deformation-Centric DIC

I started by retrofitting our old DIC software with new features and add-ons to compensate for its shortcomings.

1. Improved motion-tracking based on the Lucas-Kanade optical flow function set from the OpenCV library
2. A “rigid body motion” test for motion tracking validation, error estimation, and artifact detection
3. A robust documentation policy that saves every step of the analysis human-and-machine-readable directory tree, eg: .\\images\motion tracking\deformation\data mining
4. Deformation gradient-focused data structures which save computational resources and enable a wider variety of data mining strategies without sacrificing accuracy
5. Flexible reference states, making it possible to target sections of experiments and compute deformation rates

In addition to these improvements, my DIC software was built fundamentally differently from our old DIC platform. Rather than handling data in an image-centric manner, I implemented a deformation-centric scheme. My DIC software treats deformation data in similar to the nodes and elements found in finite element analysis. This approach facilitates error estimation and enables faster computation times and more efficient use of memory.

My analysis suite has become the primary tool of my former research group at Georgia Tech. They are now able to distinguish real deformation from artifacts, validate their measurements, and perform sophisticated strain analyses which are not possible with conventional DIC analysis. For my dissertation, I combined deformation rate analyses with in-situ stress measurements, creating create the first-ever real-time deformation energy measurement based entirely on empirical measurement without simulation or model. By building a DIC analysis suite from the ground up with deformation analysis in mind, I granted my research group significantly more powerful tools for mining mechanical testing data.

## Definitions

Terminology
We would call this “x raised to the a power”

x is called the base
a is called the exponent

Example:
is called “seven raised to the eleventh power”
the base is 7
the exponent is 11

Integer exponents
An integer exponent just means multiplying a number by itself.

Example:

Fraction exponents
An exponent which is the reciprocal of an integer means taking the root

Example:

Negative exponents
A negative exponent indicates a reciprocal

Example:

NOTICE: This means you don’t ever have to deal with fractions or roots ever again if you don’t want to! You can treat them all like exponents.

## Algebra rules

Combining exponents
When two numbers with the same base are multiplied, the exponents may be added

Example:

Exponents in ratios
When exponents in the numerator an denominator have the same base, their exponents may be subracted

NOTE: This is just a combination of the negative exponent rule with the multiplication rule!

Distributing exponents
If you have 2 layers of exponents, they may be combined

Example:

Negative bases
When the base is a negative number, the sign of the expression overall depends on whether the exponent is even or odd.
if n is an odd integer
if n is an even integer

Therefore:
if n is an odd integer
if n is an even integer

Examples:

Exponents DO NOT distribute cleanly over addition

You either have to find a way to simplify the base first OR use the definition of the exponent to simplify things.
Examples:

## Algebra: Shifting and scaling functions

Functions of a certain form can be scaled and translated by modifying the constants contained in the expression. Suppose we have some function of x that has not been shifted or scaled in any way.

$$y = f(x)$$

We can modify that function to be shifted by (h, k) and scaled by the factor a.

$$y = a*f(x-h)+k$$

• Scaling occurs by simply multiplying the expression by some scale factor. In my examples here, that scale factor is a.
• Translation left and right can be accomplished by replacing x with (x-h), where h is how far the function is shifted to the right.
• Translation up and down is accomplished by simply adding a constant k, where k is how far the function is shifted up.

Here is an interactive example showing how a parabolic function may be shifted and scaled. (If the embedded applet isn’t working, you can access it here.)

And here is the scaling of an exponential function.
(If the embedded applet isn’t working, you can access it here.)

You can also play with examples of function shifting and scaling with the Desmos online graphing calculator.

You can represent a quadratic equation in a whole lot of different forms. Each has its advantages.

Standard forms let you learn valuable information about an equation just by looking at what number was put where. There are three common forms of quadratic equations, also known as second-order polynomials.

Note that variables like a, b, and c in these descriptions will change in meaning from form to form.

#### Standard form

$$y=\text{ax}^2+\text{bx}+c$$

Advantage: Relative mathematical simplicity, sets you up to use the quadratic formula, and easy to find the y-intercept. It is just the constant y=c.

Example: $$y=2 x^2+12 x-14$$

#### Factored form

$$y=a(x+b)(x+c)$$

Advantage: Easy to find the x-intercepts. They are at x=-b and x=-c. You don’t even need the quadratic formula!

Example $$y = 2(x+7)(x-1)$$

#### Vertex form

$$y=a(x-h)^2+k$$

Advantage: Easy to find the vertex, which is at (h,k).

Example: $$y=2 (x+3)^2-32$$

## K: The Stress Intensity Factor

Fracture Mechanics is the study of how cracks grow and materials break apart. One of the most important concepts in the world of fracture mechanics is K, the linear-elastic stress intensity factor.

It is easy to confuse what K is used for with what it actually means. K is useful for measuring a material’s resistance to fracture starting at a sharp-tipped crack. However, K is defined as a measurement of the magnitude of stress distribution around a sharp crack tip in a linear-elastic solid. K only has meaning in the context of materials that can be expected to form a certain distribution of stress around a sharp crack tip!

So if we have something that is predominantly linear-elastic (high-strength steels, glass, etc.) and it contains a sharp-tipped crack, then the stress distribution around that crack can be given in terms of this parameter we call K. The stress distributions for a crack in tension perpendicular to the crack faces (aka Mode I loading) are:

$$\sigma _{\text{yy}}=\frac{K }{\sqrt{2 \pi r}} \cos (\theta ) \left(\sin \left(\frac{\theta }{2}\right) \sin \left(\frac{3 \theta }{2}\right)+1\right)$$

$$\sigma _{\text{xx}}=\frac{K }{\sqrt{2 \pi r}} \cos (\theta ) \left(1-\sin \left(\frac{\theta }{2}\right) \sin \left(\frac{3 \theta }{2}\right)\right)$$

$$\sigma _{\text{xy}}=\frac{K }{\sqrt{2 \pi r}} \left(\sin \left(\frac{\theta }{2}\right) \cos \left(\frac{\theta }{2}\right) \cos \left(\frac{3 \theta }{2}\right)\right)$$

These plots show how the stress distribution looks for a stress intensity factor of K = 1 MPa √m.

Hopefully, this helps illustrate what the stress intensity factor, K, means in a mathematical sense. Though K is useful for measuring fracture toughness, it is only applicable for sharp crack tips in linear-elastic materials that exhibit stress distributions similar to what I have shown here.

Note that these solutions are approximations: they are the first, most significant term of a summation. But K is still a very useful parameter for materials that obey linear-elastic fracture mechanics.

I created a live-view applet for Wolfram Cloud, but it wasn’t playing nice with the cloud, hence my screenshots above. In the event I get it working, I’ll put it here.

Ce qui est simple est toujours faux. Ce qui ne l’est pas est inutilisable.
What is simple is always wrong. What is not is unusable.

Paul Valéry

## Silly Math Question: Is It Possible to Write Pi Backwards?

This was inspired by the Quora question “What is Pi backwards?” It seemed like a good early post to try converting Mathematica code and LaTeX to WordPress.

The concise answer to the question is “That question is meaningless,” but why is this the case? After all we can write 123 “backwards” as 321, why not π?

One explanation is that π is an irrational number with unlimited digits, and something without an end cannot be reversed. Or something with no end, written backwards, becomes a thing with no beginning. Or one could say that “reversing” any number really doesn’t have much meaning in the first place. Yet, this question gives us a good opportunity to explore what we mean when we describe π as an irrational number.

One way to look at π is as a summation, like this summation equivalent to the arctangent function. $$4*ArcTan(1) = \pi$$

$$4 \sum _{n=1}^{\infty } \frac{(-1)^{n-1}}{2 n-1}=4 \left(1 \frac{1}{1}-\frac{1}{3}+\frac{1}{5}-\frac{1}{7}+\frac{1}{9}\text{…}\right)=\pi$$

If you look at that sum, it adds up an infinite terms, and every term is smaller than the previous one. Thus, every term we evaluate brings us closer to the actual value of π. But, we never run out of terms, so we never find the exact value of π. We just get closer and closer forever.

We can approximate π by going out to 100 terms.

$$4 \sum _{n=1}^{100} \frac{(-1)^{n-1}}{2 n-1} = 3.13159$$

This gets us in the neighborhood. (Note that I rounded to 7 digits.) But we can get closer by going to 1000 terms.

$$4 \sum _{n=1}^{1000} \frac{(-1)^{n-1}}{2 n-1} = 3.14059$$

Now π is starting to look like the number we recognize! If I kept adding more terms, then I would need to round to a larger number of digits to see the change. If we could go forever, the summation converges to π itself. Now you probably have some idea of why approximating π to a certain number of digits is such a popular problem to throw at big computers.

This sets us up to see why “π backwards” ends up being meaningless. The number has no end, so there is nowhere to “start” the reverse-order number. Just for fun, though, we can interpret “π backwards” as an excuse to switch the starting and ending place of the summation.

$$4 \sum _{n=\infty }^1 \frac{(-1)^{n-1}}{2 n-1}=\pm 4\left(\frac{1}{2 \infty -1}-\frac{1}{2 \infty -3}+\frac{1}{2 \infty -5}\text{…}\right)$$

Notice that we are starting at infinity, so we will never reach a definite answer to this summation either. But it’s worse than that. We are effectively dividing by infinity in every term, so every term is practically zero. We can’t even figure out if the “first” term is positive or negative! (Not that it really matters when every term is zero.)

$$4 \sum _{n=\infty }^1 \frac{(-1)^{n-1}}{2 n-1}= \pm 4\left(\frac{1}{\infty }-\frac{1}{\infty }+\frac{1}{\infty }\right) =\pm (0-0+0\text{…})$$

So we do have an answer for what “Pi backwards” might look like. Every term is effectively zero, yet infinitesimally larger than the previous term, we can’t even figure out the sign of the terms, and there is an infinite number of these infinitely insignificant terms to add up. We will never get to a term that isn’t zero because by starting at the “infinity” term, we put ourselves infinitely far away the “end” of our summation.

So “Pi backwards” looks like an infinite summation of zeroes. At least looking at π forwards gave us a reasonable approximation of the actual number because it prioritized the largest, most significant terms.

Film is one of the three universal languages, the other two: mathematics and music.

Frank Capra