Home > Python > Iterable Data Type

Ch. 2.1 List

Chapters Index
Program 1

List

Python 3.11 Ready

                                
Click "Run Code" to execute script and render figures.
Program 2

List

Python 3.11 Ready

                                
Click "Run Code" to execute script and render figures.
Program 3

List

Python 3.11 Ready

                                
Click "Run Code" to execute script and render figures.
Program 4

List

Python 3.11 Ready

                                
Click "Run Code" to execute script and render figures.
Program 5

List

Python 3.11 Ready

                                
Click "Run Code" to execute script and render figures.
Program 6

List

Python 3.11 Ready

                                
Click "Run Code" to execute script and render figures.
Program 7

List

Python 3.11 Ready

                                
Click "Run Code" to execute script and render figures.
Program 8

List

Python 3.11 Ready

                                
Click "Run Code" to execute script and render figures.
Program 9

List

Python 3.11 Ready

                                
Click "Run Code" to execute script and render figures.
Program 10

List

Python 3.11 Ready

                                
Click "Run Code" to execute script and render figures.
Program 11

List

Python 3.11 Ready

                                
Click "Run Code" to execute script and render figures.
Theoretical Principles & Computational Physics Guide

Python Lists: Dynamic Arrays & Trajectory Buffers

Dr. Alorika Chatterjee & Dr. Anirban Shaw Science & Physics Learners Python 3 / NumPy / SciPy

1. Core Principles & Theoretical Framework

Dynamic Sequences: Mutable sequences ideal for appending time-series coordinates during numerical simulations.
Slicing & Indexing: Expressive slicing (x[::2], x[-10:]) allows efficient downsampling and inspection.
List Comprehensions: Compact functional syntax for transforming coordinate arrays into energies.

2. Mathematical Formulation & Algorithmic Pipeline

Discrete trajectory state vector sequence:

$$ \mathbf{X} = [x_0, x_1, x_2, \dots, x_N], \quad E_k = \frac{1}{2}m v_k^2 + V(x_k) $$

3. Numerical Mechanics & Implementation Logic

  • Buffer Initialization: Initialize empty lists (t_list = [], x_list = []) before stepping loops.
  • State Appending: Record variables via .append() at each integration interval.
  • Transformations: Convert lists to kinetic energies using list comprehensions: [0.5 * m * v**2 for v in vel].

4. Relevant Computational Practice Exercises

Exercise 1
Simulate a free-falling body, accumulating height and velocity in lists, then plot $y$ vs $t$ using Matplotlib.
Exercise 2
Compute a 5-point moving average filter over a noisy experimental dataset stored in a list.
Exercise 3
Use list comprehension to compute the gravitational potential energy $U = mgh$ for a list of 100 height samples.
Standard Literature & References:
  • Mark Newman, "Computational Physics", University of Michigan (2013).