Skip to main content
New · Free engineering tools Spring calculator and shaft power drive sizing. Animated, with charts and PDF export. Open tools →

Why I Wrote The Sheet Mechanic (And Why Calculations Aren’t Enough)

For engineers who already know the math—but still lose projects. For the last few years, I’ve been sharing technical guides here on Mechanical Design Handbook —how to size a motor, how to calculate fits, and (as you recently read) how to choose between timing belts and ball screws. But after 25 years in industrial automation, I realized something uncomfortable: Projects rarely fail because the math was wrong. They fail because: The client changed the scope three times in one week. A critical vendor lied about a shipping date (and no one verified it). The installation technician couldn’t fit a wrench into the gap we designed. University taught us the physics. It didn’t teach us the reality. That gap is why I wrote my new book, The Sheet Mechanic . This is not a textbook. It is a field manual for the messy, political, and chaotic space between the CAD model and the factory floor. It captures the systems I’ve used to survive industrial projec...

Stop trying to be a hero. Start being a mechanic.

Get the book →

The Sheet Mechanic on Amazon. Affiliate link, I earn from qualifying purchases.

Gauss Elimination: Partial Pivoting & Zero Errors (Part 3)

Visualization of Partial Pivoting in Gauss Elimination to prevent division by zero

Figure 1: Partial Pivoting involves swapping rows to avoid zero pivots.

The "Fatal Flaw" in Basic Code

In our previous post, Gauss Elimination (Part 2), we derived the mathematical foundation of the algorithm. However, if you implement that raw math directly into code (VBA, MATLAB, or C++), your program will eventually crash.

Why? Because the basic algorithm assumes the diagonal element (the pivot) is never zero. In the real world of engineering simulations, zeros happen frequently.

Advertisement

The Problem: Division by Zero

Let's look at a standard solvable system of equations:

The first step of the algorithm is to normalize the first row by dividing by the coefficient of x1 (which is 5). Since 5 is not zero, this works perfectly.

But what if the equations were rearranged?
Mathematically, the order of equations doesn't matter. But computationally, it changes everything. Look at this arrangement:

Here, the coefficient of x1 is 0. The computer attempts to divide by zero, resulting in a runtime error.

The Hidden Danger: Small Numbers

Even if the number isn't zero, but is very small (e.g., 0.000001), it causes Round-off Errors. Dividing by a tiny number creates a massive result, which can cause the computer to lose precision in the remaining digits. This is known as an "Ill-conditioned system."

The Solution: Partial Pivoting

To solve this, we use a technique called Partial Pivoting. Before performing the elimination step on a column, the algorithm must:

  1. Search: Look down the current column (below the diagonal).
  2. Identify: Find the row with the largest absolute value.
  3. Swap: Switch the current row with that row.

By ensuring the largest possible number is always in the pivot position, we avoid division by zero and minimize round-off errors.

Advertisement

Next Part: The Final Code

Now that we understand the logic and the safety features required, we are ready to build the robust Excel VBA tool.

Continue to Part 4:
Solving System of Equations using Gauss Elimination Method (Part 4: The Final Program)

References

Comments

Popular posts from this blog

Dowel Pins & Locating Pins: The Basics of Fixture Design

Dowel pins are precision cylindrical pins used for accurate part alignment in assemblies. They control position, not clamping force. This guide explains tolerances, fits, sizing rules, and design best practices. Figure 1: A typical fixture setup. Notice how dowel pins (silver) provide precise location, while bolts (not shown here) provide the clamping force. In the world of Precision Engineering , the difference between a high-quality product and a scrap part often comes down to microns. While bolts hold parts together, they are terrible at positioning them. This is where Dowel Pins and Locating Pins become essential components in industrial tooling . Advertisement What is a Dowel Pin? Dowel pins are precision-ground fasteners used to secure the relative position of two parts. They are typically machined to extremely tight tolerances (often within 0.0001 inches) and are available in materials like: Hardened Steel: For high-wea...

AC, DC and Three-Phase Power Explained for Machine Design

What single-phase, three-phase, AC and DC actually mean, why machines are built around them, and how to use all of it the next time you size a motor or write a machine spec. What Voltage, current, power Direct current (DC) Alternating current (AC) Power in AC: kW, kVA, PF Single-phase Three-phase, star and delta Why Why the grid is AC Why three phases Why controls run on 24 V DC How Read a motor nameplate Current calculator Inside a VFD Supply systems worldwide Cheat sheet and checklist A mechanical engineer does not wire the panel. We still own the decisions that set what goes in it. Pick a motor and you have just told the customer what supply their building must provide. Choose a 60 Hz site for a machine designed on 50 Hz and every conveyor, pump and fan speeds up by 20 percent. Specify a star-delta starter and the driven load has to break away on one third of the torque. These are me...

Watt Straight-Line Linkage: Analysis and Automotive Uses

Figure 1: Watt's linkage example geometry and path generation. Introduction to Watt's Linkage The Watt's linkage (also known as the parallel motion linkage) is a cornerstone in the history of mechanical engineering. It is a type of four-bar linkage originally invented by James Watt in the late 18th century to solve a critical problem in steam engine design: constraining the piston rod to move in a straight line without using high-friction guideways. Before this invention, engines used chains to connect the piston to the beam, which meant they could only pull, not push. Watt's rigid linkage allowed for double-acting engines (pushing and pulling), doubling the power output. He was immensely proud of this kinematic solution, describing it in a 1784 letter to his partner Matthew Boulton: "I have got a glimpse of a method of causing a piston rod to move up and down perpendicularly by only fixing it to a piece of iron u...