SCPY204 Computer Programming for Physicists

Instructor: Chaiwoot Boonyasiriwat (
Class Hours: Tuesday (1:00PM - 3:00PM), Thursday (9:00AM-12:00PM)
Classroom: Computer Lab
Objectives: To understand the fundamentals of computer programming and be able to develop computer programs for solving some physics problems.
Grading: Homework 5, Class participation 5, Project 15, Examination 25

Tentative Course Schedule

Week Lecture Date Lecture Notes Notifications
1 1 Jan 12, 2016 Course overview, computer system and architecture
1 2 Jan 12, 2016 Introduction to C programming
Covered topics: Oracle Virtualbox, Ubuntu Linux system, vi, gedit, make
HW1: Write a report describing learned topics (Due Jan 19)
1 3 Jan 14, 2016 Introduction to C programming
Covered topics: program control, flowchart, function
Exercises: geometric series, Taylor's expansion of sin(x), absolute error
HW2: Write programs to compute and compare values of functions: cos(x), exp(x), ln(x), (1+x)^p (Due Jan 21)
Project proposal due Feb 11 in class
3 4 Jan 26, 2016 Introduction to C programming
Covered topics: random number generation, file input/output, computing histogram of probability distribution of function rand() and load data from text file using MATLAB/Octave, Monte Carlo integration, Monte Carlo simulation of atomic orbitals
Resources: random number generator
3 5 Jan 28, 2016 Introduction to C programming
Covered topics: array and pointer, writing programs with multiple source files
Resources: multiple files, complex number, function call
4 6 Feb 2, 2016 Array and pointer (continued)
Resources: Gaussian function
4 7 Feb 2, 2016 Web development using HTML, CSS, and JavaScript, graphics user interface (GUI), numerical methods for ODEs, Processing.js
Resources: Projectile with a linear drag
HW4 (due Feb 9)
  1. Write your own personal web page using HTML and CSS
  2. Write a C program to compute the Mandelbrot fractal and save the result into a PPM file (Header: P2 601 601 16)
  3. Modify the JavaScript code to simulate a projectile motion with a quadratic drag
4 8 Feb 4, 2016 2D coordinate transformation: scaling and translation, introduction to object-oriented programming (comparison between structure and class)
5 9 Feb 9, 2016 Summary, numerical methods HW4 due
5 10 Feb 11, 2016 Project proposal presentation, student-centered learning 1: drawing 2D shapes, mouse-related event handling, introduction to object-oriented programming
6 11 Feb 16, 2016 student-centered learning 2: Euler methods, Client-Server paradigm, download/upload files, set-up web pages
6 12 Feb 18, 2016 student-centered learning 3: basic object-oriented and Java programming
Resource: Java codes
HW5 due
7 13 Feb 23, 2016 student-centered learning 4: Java programming (animation, GUI), dynamic data structures, cellular automata and 2D game of life on a rectangular grid
Resources: Java codes
7 14 Feb 25, 2016 student-centered learning 5: Drawing on a JPanel canvas, a simple Java animation, p-norm and infinity norm for checking if a square is selected, PHP (GET and POST examples), basics of OpenGL
Resources: PHP codes, OpenGL files
HW6 due
8 15 Mar 1, 2016 student-centered learning 6
8 16 Mar 3, 2016 Project presentation Turn in all project files (report, presentation, codes)
9 - Mar 9, 2016 Midterm examination


Copyright © 2013-2018 Mahidol University Center for Scientific Computing. All rights reserved.
272 Rama VI Road, Room P416, Ratchathewee, Bangkok 10400, THAILAND. Tel: +66 (0)2 201 5770-1 Fax: +66 (0)2 354 7159