Home > Python > Introduction to Numpy

Ch. 7.2 Array Creation

Chapters Index
Program 1

Array Creation

Python 3.11 Ready

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

Mathematical Problem Formulation

Creating 1D array
Program 2

Array Creation

Python 3.11 Ready

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

Mathematical Problem Formulation

Creating 2D array
Program 3

Array Creation

Python 3.11 Ready

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

Mathematical Problem Formulation

Array of zeros
Program 4

Array Creation

Python 3.11 Ready

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

Mathematical Problem Formulation

Array of Ones
Program 5

Array Creation

Python 3.11 Ready

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

Mathematical Problem Formulation

Array with Evenly Spaced Values
Program 6

Array Creation

Python 3.11 Ready

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

Mathematical Problem Formulation

Range of numbers
Program 7

Array Creation

Python 3.11 Ready

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

Mathematical Problem Formulation

Numpy Linear space endpoint
Program 8

Array Creation

Python 3.11 Ready

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

Array Creation

Python 3.11 Ready

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

Mathematical Problem Formulation

Numpy Logscale
Program 10

Array Creation

Python 3.11 Ready

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

Mathematical Problem Formulation

Logspace with base 2
Program 11

Array Creation

Python 3.11 Ready

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

Mathematical Problem Formulation

Identity Matrix
Program 12

Array Creation

Python 3.11 Ready

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

Mathematical Problem Formulation

Random array uniform distribution
Program 13

Array Creation

Python 3.11 Ready

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

Mathematical Problem Formulation

Random Array Normal distribution
Program 14

Array Creation

Python 3.11 Ready

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

Mathematical Problem Formulation

Maximum and minimum value
Theoretical Principles & Computational Physics Guide

Array Creation: Computational Physics Modeling & Analysis

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

1. Core Principles & Theoretical Framework

Core Concept: Computational formulation and simulation of Array Creation within the study of Introduction to Numpy.
Algorithmic Translation: Translates theoretical governing equations into clean, discrete Python procedures and verified numerical solvers.
Numerical Verification: Evaluates numerical accuracy, parameter sensitivity, and error bounds for reliable computational results.

2. Mathematical Formulation & Algorithmic Pipeline

Governing computational formulation for Array Creation:

$$ \mathcal{F}_{\text{model}}(\mathbf{x}, t; \mathbf{p}) = 0 \implies \mathbf{y}_{n+1} = \mathcal{S}(\mathbf{y}_n, \Delta t, \mathbf{p}) $$
1. Define Physical Parameters & Boundaries → 2. Execute Numerical Simulation Steps → 3. Evaluate Observables & Plot Results

3. Numerical Mechanics & Implementation Logic

  • Parameter Initialization: Set physical constants, initial states, and coordinate boundary bounds for Array Creation.
  • Step Execution: Advance the computational state using optimized vector operations and scientific libraries.
  • Convergence Control: Monitor stability and ensure simulation metrics remain physically meaningful.

4. Relevant Computational Practice Exercises

Exercise 1
Implement Array Creation and observe how the output responds to variations in primary physical parameters.
Exercise 2
Refine the calculation grid or step size to observe convergence and reduction in numerical approximation error.
Exercise 3
Compare the simulated computational results against an analytical benchmark or limiting physical case.
Standard Literature & References:
  • Mark Newman, "Computational Physics", University of Michigan (2013).
  • Hans Petter Langtangen, "A Primer on Scientific Programming with Python", Springer (2016).