Foreword xiii
Preface xv
Section I AnIntroductiontoPython
Chapter 1 TheIDLEIntegratedDevelopmentLearningEnvironment3
1.1INTRODUCTION....4
1.1.1TutorialOne:UsingPythonasaPowerfulCalculator(30
Minutes)....5
1.1.2 TutorialTwo:Lists(20Minutes)....7
1.2SIMPLEPROGRAMMINGINPYTHON....8
1.2.1TutorialThree:DefiningFunctions(30Minutes)....9
1.2.2TutorialFour:ForandWhileLoops(20Minutes)....11
1.2.3TutorialFive:If,elif,elseconstructs(10Minutes)....11
1.3THETURTLEMODULEANDFRACTALS....11
Chapter 2 Anaconda,SpyderandtheLibrariesNumPy,Matplotliband
SymPy....21
2.1ATUTORIALINTRODUCTIONTONUMPY....23
2.1.1TutorialOne:AnIntroductiontoNumPyandArrays(30
Minutes)....23
2.2A TUTORIALINTRODUCTIONTOMATPLOTLIB....25
2.2.1TutorialTwo:SimplePlotsusingtheSpyderEditorWindow
(30minutes)....25
2.3ATUTORIALINTRODUCTIONTOSYMPY....28
2.3.1TutorialThree:AnIntroductiontoSymPy(30Minutes)28
Chapter 3 JupyterNotebooksandGoogleColab....33
3.1JUPYTERNOTEBOOKS,CELLS,CODEANDMARKDOWN....33
3.2ANIMATIONSANDINTERACTIVEPLOTS....37
3.3GOOGLECOLABANDGITHUB....41
Chapter 4 PythonforAS-Level(HighSchool)Mathematics....45
4.1AS-LEVELMATHEMATICS(PART1)....46
4.2AS-LEVELMATHEMATICS(PART2)....50
Chapter 5 PythonforA-Level(HighSchool)Mathematics....61
5.1A-LEVELMATHEMATICS(PART1)....62
5.2A-LEVELMATHEMATICS(PART2)....68
Section II PythonforScientificComputing
Chapter 6 Biology....81
6.1ASIMPLEPOPULATIONMODEL....81
6.2APREDATOR-PREYMODEL....84
6.3ASIMPLEEPIDEMICMODEL....87
6.4HYSTERESISINSINGLEFIBERMUSCLE....89
Chapter 7 Chemistry....95
7.1BALANCINGCHEMICAL-REACTIONEQUATIONS....95
7.2CHEMICALKINETICS....97
7.3THEBELOUSOV-ZHABOTINSKIREACTION....99
7.4COMMON-IONEFFECTINSOLUBILITY....101
Chapter 8 DataScience....107
8.1INTRODUCTIONTOPANDAS....107
8.2LINEARPROGRAMMING....110
8.3K-MEANSCLUSTERING....115
8.4DECISIONTREES....119
Chapter 9 Economics....125
9.1THECOBB-DOUGLASQUANTITYOFPRODUCTIONMODEL126
9.2THESOLOW-SWANMODELOFECONOMICGROWTH....128
9.3MODERNPORTFOLIOTHEORY(MPT)....130
9.4THEBLACK-SCHOLESMODEL....133
Chapter 10 Engineering....139
10.1LINEARELECTRICALCIRCUITSANDTHEMEMRISTOR....139
10.2CHUA’SNONLINEARELECTRICALCIRCUIT....142
10.3COUPLEDOSCILLATORS:MASS-SPRINGMECHANICAL
SYSTEMS....144
10.4 PERIODICALLYFORCEDMECHANICALSYSTEMS....146
Chapter 11 Fractalsand Multifractals....153
11.1PLOTTINGFRACTALSWITHMATPLOTLIB....153
11.2BOX-COUNTINGBINARYIMAGES....158
11.3THEMULTIFRACTALCANTORSET....160
11.4THEMANDELBROTSET....162
Chapter 12 ImageProcessing....167
12.1IMAGEPROCESSING,ARRAYSANDMATRICES....168
12.2COLORIMAGES....169
12.3STATISTICALANALYSISONANIMAGE....170
12.4IMAGEPROCESSINGONMEDICALIMAGES....172
Chapter 13 NumericalMethodsforOrdinaryandPartialDifferential
Equations....177
13.1EULER’SMETHODTOSOLVEIVPS....178
13.2RUNGEKUTTAMETHOD(RK4)....179
13.3FINITEDIFFERENCEMETHOD:THEHEATEQUATION....181
13.4FINITEDIFFERENCEMETHOD:THEWAVEEQUATION....184
Chapter 14 Physics....191
14.1THEFASTFOURIERTRANSFORM....192
14.2THESIMPLEFIBERRING(SFR)RESONATOR....194
14.3THEJOSEPHSONJUNCTION....196
14.4MOTIONOFPLANETARYBODIES....198
Chapter 15 Statistics....203
15.1LINEARREGRESSION....203
15.2MARKOVCHAINS....207
15.3THESTUDENTT-TEST....210
15.4MONTE-CARLOSIMULATION....214
Section III Artificial Intelligence
Chapter 16 BrainInspiredComputing....223
16.1THEHODGKIN-HUXLEYMODEL....224
16.2THEBINARYOSCILLATORHALF-ADDER....227
16.3THEBINARYOSCILLATORSETRESETFLIP-FLOP....231
16.4REAL-WORLDAPPLICATIONSANDFUTUREWORK....234
Chapter 17 NeuralNetworksandNeurodynamics....241
17.1HISTORYANDTHEORYOFNEURALNETWORKS....241
17.2THEBACKPROPAGATIONALGORITHM....245
17.3MACHINELEARNINGONBOSTONHOUSINGDATA....247
17.4NEURODYNAMICS....250
Chapter 18 TensorFlow andKeras....255
18.1ARTIFICIALINTELLIGENCE....256
18.2LINEARREGRESSIONINTENSORFLOW....257
18.3XORLOGICGATEINTENSORFLOW....259
18.4BOSTONHOUSINGDATAINTENSORFLOWANDKERAS....261
Chapter 19 RecurrentNeuralNetworks....267
19.1THEDISCRETEHOPFIELDRNN....267
19.2THECONTINUOUSHOPFIELDRNN....270
19.3LSTMRNNTOPREDICTCHAOTICTIMESERIES....273
19.4LSTMRNNTOPREDICTFINANCIALTIMESERIES....278
Chapter 20 Convolutional NeuralNetworks,TensorBoardandFurther
Reading....285
20.1CONVOLVINGANDPOOLING....285
20.2CNNONTHEMNISTDATASET....288
20.3TENSORBOARD....290
20.4FURTHERREADING....292
Chapter 21 Answersand HintstoExercises....299
21.1SECTION1SOLUTIONS....299
21.2SECTION2SOLUTIONS....303
21.3SECTION3SOLUTIONS....306
Index....309
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.
No prior experience of programming is required
Online GitHub repository available with codes for readers to practice
Covers applications and examples from biology, chemistry, computer science, data science, electrical and mechanical engineering, economics, mathematics, physics, statistics and binary oscillator computing
Full solutions to exercises are available as Jupyter notebooks on the Web