Introduction to Scientific Computing#

https://oist.github.io/iSciComp/

Kenji Doya
August 2023 in Paris

Aim of this Book#

This book aims to provide students from non-computational backgrounds with the basic knowledge and practical skills of computing that are required in almost all fields of science today.

It also tries help students’ intuitive understanding of basic mathematical concepts like eigenvalues and stability through computation and visualization.

Python is used as the standard programming language, but the concepts covered can be helpful also in using other computing tools for data analysis and simulation.

Jupyter Book#

This book is made by Jupyter Book (https://jupyterbook.org). An important feature is that you can download the source codes as Jupyter Notebook by the Download icon on the top right corner of each chapter.

Rather than just reading the html or pdf text, please run the codes, change parameters, apply your own data, and modify the codes to see how the algorithms really work (or fails).

Book Contents#

Chapter

Topic

Items covered

1

Introduction to Python

python, jupyter; data types, for loop

2

Visualization

matplotlib

3

Functions and classes

name space, object oriented programming

4

Vectors and matrices

numpy; eigenvalue/vector

5

Iterative computation

Newton method, discrete-time dynamics

6

Ordinary differential equation

scipy; Euler method, stability

7

Partial differential equation

finite-difference method

8

Optimization

gradient descent, Gauss-Newton method

9

Sampling methods

Monte Carlo methods, evolutionary algorithms

10

Software management

version control system, GitHub

Why Computation?#

  • Theoretical analysis often requires simplifying assumptions.

  • Thought experiment is limited/biased by the experimenter’s thinking.

  • Huge data set is impossible to comprehend withtout numerical processing.

Which Tools to Use#

There are a bunch to programming languages and tools to choose from.

General programming languages#

  • Fortran

  • C

  • C++

  • Java

  • MATLAB

  • Python

Special purpose tools#

  • Statistics: SPSS, S, R,…

  • Genomics: BLAST,…

  • MRI: SPM, VBM,…

  • Neuroscience: NEURON, NEST,…

How to select?#

  • Satifsy your present need?

  • Future usability

  • User community

How to Learn?#

  • Textbooks

  • Online documents

  • Online courses

  • Read experts’ codes!

  • Modify for your needs

  • Try coding from scratch

Use of AI Tools#

In the last couple of years, the performance of large language models (LLMx) in programming, or Coding Agents has advanced enormously. Some may think that we don’t need to learn programming anymore. But there are good reasons to follow the lines of sample programs and to create a program by yourself.

  • The aim of this book is not to just give you a recipe of data processing, but to let you understand the mathematical basis and how to bring that into an algorithm. Through programming you will clearly see where is the bottleneck and may realize a way to overcome that.

  • Programming demands you to think what steps are necessary to achieve your goal and by conding and trying, you will clearly find what is missing. Programing can be a great training for systematic thinking.

Excercises#

You may be able to just ask an AI agent to come up with a solution to the exercise. That can be a helpful example if you have no idea how to address the problem. There are even sample solutions at the end of this book.

But don’t just copy and paste them. Appreciate what each line of code does and rewrite in the way that is easy for you to understand, and possibly come up with an alternative implementation.

References#

Python#

Scientific Computing#

Math#

Table of Contents#