Cover....1
Half Title....2
Series Page....3
Title Page....4
Copyright Page....5
Dedication....6
Contents....8
Foreword....14
Preface....16
SECTION I: An Introduction to Python....22
CHAPTER 1: The IDLE Integrated Development Learning Environment....24
1.1. INTRODUCTION....25
1.1.1. Tutorial One: Using Python as a Powerful Calculator (30 Minutes)....26
1.1.2. Tutorial Two: Lists (20 Minutes)....28
1.2. SIMPLE PROGRAMMING IN PYTHON....29
1.2.1. Tutorial Three: Defining Functions (30 Minutes)....30
1.2.2. Tutorial Four: For and While Loops (20 Minutes)....32
1.2.3. Tutorial Five: If, elif, else constructs (10 Minutes)....32
1.3. THE TURTLE MODULE AND FRACTALS....32
CHAPTER 2: Anaconda, Spyder and the Libraries NumPy, Matplotlib and SymPy....42
2.1. A TUTORIAL INTRODUCTION TO NUMPY....44
2.1.1. Tutorial One: An Introduction to NumPy and Arrays (30 Minutes)....44
2.2. A TUTORIAL INTRODUCTION TO MATPLOTLIB....46
2.2.1. Tutorial Two: Simple Plots using the Spyder Editor Window (30 minutes)....46
2.3. A TUTORIAL INTRODUCTION TO SYMPY....49
2.3.1. Tutorial Three: An Introduction to SymPy (30 Minutes)....49
CHAPTER 3: Jupyter Notebooks and Google Colab....54
3.1. JUPYTER NOTEBOOKS, CELLS, CODE AND MARKDOWN....54
3.2. ANIMATIONS AND INTERACTIVE PLOTS....58
3.3. GOOGLE COLAB AND GITHUB....62
CHAPTER 4: Python for AS-Level (High School) Mathematics....66
4.1. AS-LEVEL MATHEMATICS (PART 1)....67
4.2. AS-LEVEL MATHEMATICS (PART 2)....71
CHAPTER 5: Python for A-Level (High School) Mathematics....82
5.1. A-LEVEL MATHEMATICS (PART 1)....83
5.2. A-LEVEL MATHEMATICS (PART 2)....89
SECTION II: Python for Scientific Computing....100
CHAPTER 6: Biology....102
6.1. A SIMPLE POPULATION MODEL....102
6.2. A PREDATOR-PREY MODEL....105
6.3. A SIMPLE EPIDEMIC MODEL....108
6.4. HYSTERESIS IN SINGLE FIBER MUSCLE....110
CHAPTER 7: Chemistry....116
7.1. BALANCING CHEMICAL-REACTION EQUATIONS....116
7.2. CHEMICAL KINETICS....118
7.3. THE BELOUSOV-ZHABOTINSKI REACTION....120
7.4. COMMON-ION EFFECT IN SOLUBILITY....122
CHAPTER 8: Data Science....128
8.1. INTRODUCTION TO PANDAS....128
8.2. LINEAR PROGRAMMING....131
8.3. K-MEANS CLUSTERING....136
8.4. DECISION TREES....140
CHAPTER 9: Economics....146
9.1. THE COBB-DOUGLAS QUANTITY OF PRODUCTION MODEL....147
9.2. THE SOLOW-SWAN MODEL OF ECONOMIC GROWTH....149
9.3. MODERN PORTFOLIO THEORY (MPT)....151
9.4. THE BLACK-SCHOLES MODEL....154
CHAPTER 10: Engineering....160
10.1. LINEAR ELECTRICAL CIRCUITS AND THE MEMRISTOR....160
10.2. CHUA'S NONLINEAR ELECTRICAL CIRCUIT....163
10.3. COUPLED OSCILLATORS: MASS-SPRING MECHANICAL SYSTEMS....165
10.4. PERIODICALLY FORCED MECHANICAL SYSTEMS....167
CHAPTER 11: Fractals and Multifractals....174
11.1. PLOTTING FRACTALS WITH MATPLOTLIB....174
11.2. BOX-COUNTING BINARY IMAGES....179
11.3. THE MULTIFRACTAL CANTOR SET....181
11.4. THE MANDELBROT SET....183
CHAPTER 12: Image Processing....188
12.1. IMAGE PROCESSING, ARRAYS AND MATRICES....189
12.2. COLOR IMAGES....190
12.3. STATISTICAL ANALYSIS ON AN IMAGE....191
12.4. IMAGE PROCESSING ON MEDICAL IMAGES....193
CHAPTER 13: Numerical Methods for Ordinary and Partial Differential Equations....198
13.1. EULER'S METHOD TO SOLVE IVPS....199
13.2. RUNGE KUTTA METHOD (RK4)....200
13.3. FINITE DIFFERENCE METHOD: THE HEAT EQUATION....202
13.4. FINITE DIFFERENCE METHOD: THE WAVE EQUATION....205
CHAPTER 14: Physics....212
14.1. THE FAST FOURIER TRANSFORM....213
14.2. THE SIMPLE FIBER RING (SFR) RESONATOR....215
14.3. THE JOSEPHSON JUNCTION....217
14.4. MOTION OF PLANETARY BODIES....219
CHAPTER 15: Statistics....224
15.1. LINEAR REGRESSION....224
15.2. MARKOV CHAINS....228
15.3. THE STUDENT T-TEST....231
15.4. MONTE-CARLO SIMULATION....235
SECTION III: Artificial Intelligence....242
CHAPTER 16: Brain Inspired Computing....244
16.1. THE HODGKIN-HUXLEY MODEL....245
16.2. THE BINARY OSCILLATOR HALF-ADDER....248
16.3. THE BINARY OSCILLATOR SET RESET FLIP-FLOP....252
16.4. REAL-WORLD APPLICATIONS AND FUTURE WORK....255
CHAPTER 17: Neural Networks and Neurodynamics....262
17.1. HISTORY AND THEORY OF NEURAL NETWORKS....262
17.2. THE BACKPROPAGATION ALGORITHM....266
17.3. MACHINE LEARNING ON BOSTON HOUSING DATA....268
17.4. NEURODYNAMICS....271
CHAPTER 18: TensorFlow and Keras....276
18.1. ARTIFICIAL INTELLIGENCE....277
18.2. LINEAR REGRESSION IN TENSORFLOW....278
18.3. XOR LOGIC GATE IN TENSORFLOW....280
18.4. BOSTON HOUSING DATA IN TENSORFLOW AND KERAS....282
CHAPTER 19: Recurrent Neural Networks....288
19.1. THE DISCRETE HOPFIELD RNN....288
19.2. THE CONTINUOUS HOPFIELD RNN....291
19.3. LSTM RNN TO PREDICT CHAOTIC TIME SERIES....294
19.4. LSTM RNN TO PREDICT FINANCIAL TIME SERIES....299
CHAPTER 20: Convolutional Neural Networks, TensorBoard and Further Reading....306
20.1. CONVOLVING AND POOLING....306
20.2. CNN ON THE MNIST DATASET....309
20.3. TENSORBOARD....311
20.4. FURTHER READING....313
CHAPTER 21: Answers and Hints to Exercises....320
21.1. SECTION 1 SOLUTIONS....320
21.2. SECTION 2 SOLUTIONS....324
21.3. SECTION 3 SOLUTIONS....327
Index....330
Python for Scientific Computing and Artificial Intelligence is split into 3 parts: in Section 1, the reader is introduced to the Python programming language and shown how Python can aid in the understanding of advanced High School Mathematics. In Section 2, the reader is shown how Python can be used to solve real-world problems from a broad range of scientific disciplines. Finally, in Section 3, the reader is introduced to neural networks and shown how TensorFlow (written in Python) can be used to solve a large array of problems in Artificial Intelligence (AI).
This book was developed from a series of national and international workshops that the author has been delivering for over twenty years. The book is beginner friendly and has a strong practical emphasis on programming and computational modelling.