Server Side Programming Articles

Page 29 of 2109

Modelling Thermodynamic Entropy in Python

Dr Pankaj Dumka
Dr Pankaj Dumka
Updated on 27-Mar-2026 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
Dr Pankaj Dumka
Updated on 27-Mar-2026 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
Dr Pankaj Dumka
Updated on 27-Mar-2026 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
Kalyan Mishra
Updated on 27-Mar-2026 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
Kalyan Mishra
Updated on 27-Mar-2026 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
Dr Pankaj Dumka
Updated on 27-Mar-2026 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
Kalyan Mishra
Updated on 27-Mar-2026 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
Kalyan Mishra
Updated on 27-Mar-2026 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

Python - Replace punctuations with K

Kalyan Mishra
Kalyan Mishra
Updated on 27-Mar-2026 196 Views

In this article, we will learn how to replace punctuation marks with the letter "K" in Python strings. This is a common task in text processing and data cleaning operations where you need to replace punctuations with specific characters. Let's start with an example string ? original_string = "Welcome, to, * the website ! aliens" print("Original string:", original_string) Original string: Welcome, to, * the website ! aliens Our goal is to replace punctuation marks like ,, *, and ! with the letter "K", resulting in: "WelcomeK toK K the website K aliens". ...

Read More

Modelling the Gauss Seidel Method in Python

Dr Pankaj Dumka
Dr Pankaj Dumka
Updated on 27-Mar-2026 4K+ Views

The Gauss-Seidel method is an iterative technique for solving systems of linear equations. Unlike the Jacobi method, Gauss-Seidel uses newly computed values within the same iteration, which speeds up convergence. Mathematical Foundation A system of linear equations can be written as: $$\mathrm{a_{1, 1}x_{1} \: + \: a_{1, 2}x_{2} \: + \: \dotso \: + \: a_{1, n}x_{n} \: = \: b_{1}}$$ $$\mathrm{a_{2, 1}x_{1} \: + \: a_{2, 2}x_{2} \: + \: \dotso \: + \: a_{2, n}x_{n} \: = \: b_{2}}$$ $$\mathrm{\vdots}$$ $$\mathrm{a_{n, 1}x_{1} \: + \: a_{n, 2}x_{2} \: + \: \dotso \: + \: a_{n, ...

Read More
Showing 281–290 of 21,090 articles
« Prev 1 27 28 29 30 31 2109 Next »
Advertisements