Modelling Two Dimensional Heat Conduction Problem using Python

Dr Pankaj Dumka
Updated on 27-Mar-2026 14:45:29

3K+ Views

In this tutorial, we will see how to model the 2D heat conduction equation using Python. A 2D, steady-state heat conduction equation with heat generation can be written in Cartesian coordinates as follows − $$\mathrm{abla^{2} T \: + \: \frac{q_{g}}{k} \: = \: \frac{\partial^{2}T}{\partial x^{2}} \: + \: \frac{\partial^{2}T}{\partial y^{2}} \: + \: \frac{q_{g}}{k} \: = \: 0 \:\:\dotso\dotso (1)}$$ This equation must be discretized to obtain a finite difference equation. Let us consider a rectangular grid as shown below. ... Read More

Modelling the Taylor Table Method in Python

Dr Pankaj Dumka
Updated on 27-Mar-2026 14:44:49

544 Views

The Taylor Table method is an efficient technique for deriving finite difference schemes for derivatives using a specific stencil. A stencil is a collection of grid points used to approximate derivatives numerically. Understanding the Taylor Table Method Consider evaluating the second derivative using Taylor series expansions. For points around $x_i$: ... Read More

Modelling Thermodynamic Entropy in Python

Dr Pankaj Dumka
Updated on 27-Mar-2026 14:44:11

730 Views

Thermodynamic entropy is a fundamental property that measures the degree of randomness or disorder in a system. In Python, we can model entropy changes for various thermodynamic processes using mathematical formulations and create visualization tools. Understanding Entropy Entropy remains constant during a reversible adiabatic process. When a system exchanges dQ heat with its surroundings at temperature T, the entropy change is: ds = dQ/T ... (1) According to Clausius' inequality, the cyclic integral along any path satisfies: ∮(dQ/T) ≤ 0 ... (2) The equality holds for reversible processes, while inequality holds for irreversible cycles. ... Read More

Modelling the Trapezoidal Rule for Numerical Integration in Python

Dr Pankaj Dumka
Updated on 27-Mar-2026 14:43:39

2K+ Views

The purpose of definite integration is to calculate the area under a curve of a function between two limits, a and b. Numerical integration (also called quadrature) approximates this area by dividing it into simple geometric shapes. ... Read More

Modelling Stirling and Ericsson Cycles in Python

Dr Pankaj Dumka
Updated on 27-Mar-2026 14:42:48

396 Views

The Stirling cycle and Ericsson cycle are important thermodynamic cycles used in heat engines. Python provides excellent tools for modeling these cycles using matplotlib and pandas to visualize the pressure-volume relationships and calculate state properties. Stirling Cycle The Stirling cycle consists of four processes: two reversible isochoric (constant volume) and two reversible isothermal (constant temperature) processes. The ideal regenerative Stirling cycle has the same efficiency as the Carnot cycle in the same temperature range. ... Read More

Finding the Summation of Random Numbers using Python

Kalyan Mishra
Updated on 27-Mar-2026 14:42:01

932 Views

In this article, we will learn different methods to find the summation of random numbers using Python. Whether you need to generate random numbers for testing, simulations, or statistical analysis, these approaches will help you calculate their sum efficiently. Let's explore various methods to generate random numbers and calculate their summation ? Using Simple Loop This method generates random numbers using a loop and stores them in a list before calculating the sum ? import random n = 10 rand_nums = [] for _ in range(n): rand_nums.append(random.randint(1, 100)) total ... Read More

Queue.LIFOQueue vs Collections.Deque in Python

Kalyan Mishra
Updated on 27-Mar-2026 14:41:41

424 Views

In this article we will learn about Queue.LIFOQueue vs Collections.Deque in Python programming language. When we need to manage our data using the last in first out method, we can use these data structures. But to choose one of them we need to know about their functionalities and characteristics. Queue.LIFOQueue This class is part of the queue module. It works as a stack data structure and is thread-safe, meaning we can communicate between different threads simultaneously. Here are some key specifications: Stack-based − LIFOQueue behaves like a stack data structure where the item inserted last will ... Read More

Modelling the Otto and Diesel Cycles in Python

Dr Pankaj Dumka
Updated on 27-Mar-2026 14:41:15

739 Views

The Otto cycle and Diesel cycle are fundamental thermodynamic cycles used in internal combustion engines. Python provides powerful tools for modeling these cycles using mathematical equations and visualization libraries like matplotlib and pandas. Otto Cycle An air standard cycle called the Otto Cycle is employed in spark ignition (SI) engines. It comprises of two reversible adiabatic processes and two isochoric processes (constant volume), totaling four processes. When the work interactions take place in reversible adiabatic processes, the heat addition (2-3) and rejection (4-1) occur isochorically (3-4 and 1-2). ... Read More

Python - Replace sublist with others in list

Kalyan Mishra
Updated on 27-Mar-2026 14:40:31

438 Views

Replacing a sublist (portion of a list) with another list is a common operation in Python. This article explores multiple approaches to replace elements at specific index ranges with new values. Let's understand the problem with an example ? original_list = [1, 2, 3, 4, 5, 6] new_items = [7, 8, 9] # Replace elements from index 2 to 5 (exclusive) with new_items # Result should be: [1, 2, 7, 8, 9, 6] Using List Slicing (Recommended) The simplest and most Pythonic approach uses slice assignment to replace a sublist ? ... Read More

Python - Replace rear word in String

Kalyan Mishra
Updated on 27-Mar-2026 14:40:08

261 Views

In this article, we will learn how to replace the rear (last) word in a string with any other given word. This is a common string manipulation task in Python programming. Let's understand this with an example ? original_string = "This cat is running very Fast" # We want to replace "Fast" with "Slow" # Result: "This cat is running very Slow" Method 1: Using split() and join() The most straightforward approach is to split the string into words, replace the last word, and join them back ? def replace_rear(text, new_word): ... Read More

Advertisements