Search This Blog

Showing posts with label Programming. Show all posts
Showing posts with label Programming. Show all posts

Saturday, August 2, 2025

Demystifying the Finite Element Method: A Very Simple Truss Stiffness Matrix in Python



I dont recall how long ago i worked on FEM methods but found this basic program of stiffness matrix calculation in one of my older hard drive. So why go it to waste here is a brief blog on how FEM, a numerical technique can be approached. This technique breaks down a complex structure into smaller, simpler pieces called "finite elements." By analyzing these small elements and then reassembling them, we can understand the behavior of the entire structure.

One of the most fundamental concepts in FEM is the stiffness matrix. This matrix represents the relationship between the forces applied to a structure's nodes and the resulting displacement of those nodes. In a simple truss, which is a structure made of straight members connected at joints (like a bicycle frame), we can build a stiffness matrix to understand its behavior.

Let's take a look at a Python script that calculates the global stiffness matrix for a simple plane truss with three members.

Friday, August 1, 2025

Parsing an XML File in Java with SAX Parser



Parsing XML files is a common task in Java development, and a SAX parser is a popular choice for this purpose. The SAX parser is known for being faster and using less memory compared to the DOM parser. This is because the SAX parser doesn't load the entire XML document into memory or create an object representation of it. Instead, it uses callback functions to inform clients about the XML document's structure as it reads through the file.

This post will guide you through parsing an XML file using the SAX parser in Java, based on the provided examples.