Skip to main content

Posts

Showing posts with the label Numerical Methods

Featured Post

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...
NEW RELEASE: Stop trying to be a Hero. Start being a Mechanic. Get "The Sheet Mechanic" on Amazon »
Disclosure: As an Amazon Associate, I earn from qualifying purchases.

Gauss Elimination Solver: Video Demo & Series Recap (Part 6)

Figure 1: The completed Gauss Elimination Solver ready for action. Putting It All Together We have reached the conclusion of our 6-part series on building a Linear Equation Solver in Excel. Over the course of this tutorial, we have moved from the raw mathematical theory of Gauss Elimination to writing efficient VBA Code , and finally designing a professional User Interface that handles dynamic matrix scaling. Search for Engineering Simulation Tools Advertisement Video Demonstration Below is a video clip demonstrating the final result. You will see how the program takes user input, automatically resizes the matrix (as discussed in Part 5), and solves for the unknowns instantly. By following the code provided in Part 1 and Part 4 , you can build this exact tool yourself. Video 1: Live demonstration of the dynamic Excel Solver tool. Complete Series Recap If you missed any part of this tutorial, here...

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

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. Search for Numerical Analysis & Algorithm Design Books 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 x 1 (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....

Gauss Elimination: Mathematical Derivation (Part 2)

Figure 1: Visualizing the matrix transformation process. Deep Dive into the Algorithm In the previous post (Part 1) , we introduced the basic concept and Excel VBA code for the Gauss Elimination Method . In this post, we will look under the hood at the mathematical derivation that makes this algorithm work. Understanding these steps is critical for engineers who want to write their own solvers or understand why simulation software sometimes fails (e.g., division by zero errors). Search for Numerical Methods with MATLAB Advertisement Phase 1: Forward Elimination Why do we call it "Elimination"? Because our goal is to systematically remove variables from equations until we are left with a solvable state. Let's consider the general form of a system of linear equations: Step 1: Normalization The algorithm starts by normalizing the first equation. We divide the entire Equation (1) by...

Solving System of Equations using Gauss Elimination Method (Part 1)

The Backbone of Engineering Simulation In mechanical engineering, solving a system of linear equations is perhaps the most fundamental calculation we perform. Whether you are running a Finite Element Analysis (FEA) to check stress concentrations or a Computational Fluid Dynamics (CFD) simulation, the computer is ultimately solving a massive system of equations in the form of [A]{x} = {B} . The Gauss Elimination Method is a classic algorithm used to solve these systems. Unlike Cramer's Rule, which is inefficient for large matrices, Gauss Elimination scales well for complex engineering problems. Search for Numerical Methods for Engineers Books Advertisement Step 1: Setting up the Matrix To solve a system of equations in Excel, we first organize our coefficients into a matrix format. As shown in the figure below, the coefficients of the variables (x, y, z) form the [A] Matrix , while the constants on the right ...

FEA Solution Phase: Stiffness Matrices, Solvers, and Convergence

The following four-article series serves as a comprehensive introduction to the analysis discipline known as the finite element method (FEM). Originally based on works by engineering consultant Steve Roensch, this guide has been updated to cover modern solver algorithms and hardware acceleration. Third in a four-part series. Previous: Part 2: Pre-processing & Meshing Advertisement The Solution Phase: Solving the Matrix While the pre-processing and post-processing phases are interactive and human-intensive, the solution phase is a computational batch process. It is the "black box" where the computer does the heavy lifting. This phase is the primary bottleneck for complex models. For professional analysis, we recommend using dedicated Mobile Workstations or high-performance desktops equipped with ample RAM (64GB+) and, increasingly, GPU acceleration (CUDA) to speed up matrix operations. The Governing Equation: [K]{d} = {...

Numerical Methods - The Newton-Raphson Method (Part 2)

In the previous post , we talked about several root finding techniques. In this post, we're going to see how we can use Microsoft Excel VBA to find the roots using the Newton-Raphson Method. Advertisement Figure 1: The Newton-Raphson method rapidly converges on a solution using the function's derivative. The Logic As we know, the Newton-Raphson Method is the most widely used of all root-locating formulas. It uses the slope ( first derivative ) of the function to find the root. That means, in the VBA code, we have to calculate the first derivative of the function. We already discussed how to find the first derivative using numerical methods , and we will incorporate that logic here. Figure 2: Geometric interpretation: The tangent line points to the next approximate root. The Iterative Formula: The method uses the Taylor series to approximate the next position (x N ) based on the curre...

Calculate First Derivatives with Numerical Method Using Excel VBA

In the previous post, Numerical Methods - First derivative using Excel formula , we learned how to calculate the first derivative of functions using standard formulas in the spreadsheet grid. While effective, that method can be cumbersome to set up for repeated use. In this post, let's see how we can simplify the process by creating a reusable custom function using Excel VBA (Visual Basic for Applications) . Instead of downloading a pre-made file, follow the steps below to build this powerful tool yourself. Advertisement The VBA Code Solution The following code implements the Five-Point Stencil method for high precision. It defines the mathematical function f(x) and a derivative function fDeriv(x) . Step 1: Open Excel and press Alt+F11 to open the VBA Editor. Step 2: Go to Insert > Module . Step 3: Copy and paste the code below into the module window. ' ================================================ ' Created ...

Numerical Methods - The Newton-Raphson Method (Part 1)

Machine designers frequently deal with complex equations in their design projects . While some roots can be found directly, many algebraic and transcendental equations require numerical approximation. Advertisement For example, the classical equation f(x) = e -x - x cannot be solved analytically. In these cases, engineers rely on robust Root Finding Algorithms . Figure 1: Numerical methods approximate the point where the function crosses zero. These algorithms generally fall into two categories: Bracketing Methods and Open Methods . 1. Bracketing Methods Bracketing methods require two initial guesses that must "bracket" the root (one positive, one negative relative to the root). They are reliable but often slower. The Bisection Method: An incremental search based on sign changes. It repeatedly cuts the interval in half. Also known as binary chopping or Bolzano's method . The False-Position Me...

Numerical Differentiation in Excel: Calculating First Derivatives

Numerical methods are powerful tools for mechanical engineering design calculations. In this post, I will demonstrate how to calculate the first derivative (velocity) of a motion profile using numerical methods directly in Microsoft Excel, without the need for specialized math software. While textbooks provide extensive derivations, for practical engineering, we can jump straight to the high-accuracy finite difference formulas. The 5-Point Stencil Formula To calculate the first derivative of a function f(x) with high precision, we use the "Five-Point Stencil" method. This formula utilizes interior points to achieve an error order of h 4 , which is significantly more accurate than standard forward or backward difference methods. f'(x i ) = [ -f(x i+2 ) + 8f(x i+1 ) - 8f(x i-1 ) + f(x i-2 ) ] / 12h Where: i = The current point of interest h = The step size (the distance between points) The smaller the step size ( h ), the higher the a...