Phys 2102 / ACS 2102
Scientific Computing
HOME Course Outline Submit Assignment Assignments Week1 Week2 Week3 Week4 Week5 Week6 Week7 Week8 Week9 Week10 Week11 Week12 Chess! Practice Final

Many problems arising in science are too difficult to solve analytically, and thus require analysis of some form by a computer. Using the language of c/ C ++ , this course introduces the most common programming constructs used in scientific computing. The critical importance of data structures to represent information is emphasized, which naturally leads to an object-oriented approach to problem solving. The use of external libraries, such as those for numerical analysis, to solve more advanced problems are explored, with attention paid to checks that can be made on the reliability of the results.

Tools to write the source code and compile it

The computers in 2L14 are available for use, and have all of the tools you will need to complete and hand in the assignments for this course.

Text editor for windows

You will need a text editor to make text files containing the source code. A simple editor that can be used is notepad++, which can be downloaded from this link.

Text editor / IDE for Mac

If you are using a mac, install xcode . This comes with the g++ compiler. In order to do makefile based projects in xcode, these slides might help: XCode_and_makefile.pdf . It is recommended however to use the terminal and g++ compiler directly from the terminal command line. For reference see mac command line . To make the files containing the source code any text editor should work (emacs, vim, komodo). Try komodo, it is quite nice.

Compiler for Windows

The computers in 2L14 are using the MinGW (minamilist GNU for Windows) package for compiling our C++ code. One option is to download a tarball that includes the MinGW compiler, fltk library, and course notes (from last year) here . Note that these will work for Win7/10 based computers. This zip file is the same as a USB stick at the beginning of the year. Course notes will be updated on the course website during the year to make them more current. If you unpack this onto a usb stick that comes up as drive "E:", then add to the environment variable PATH "E:\MinGW\bin\" and "E:\MinGW\msys\1.0\bin\". There are note in the week1 slides on how to edit your path. Alternatively you can download and install the tools using the instructions which follow.

Alternate method of getting MinGW from original source

You can get a copy of MinGW by navigating the MinGW website. It is best to go to the downloads page, and select the mingw-get-setup.exe , that will start an installer program to select which options you want to install.

Save the installer, and run it. Inside the installer, push the install button, and then continue button. You will then be presented with a number of options to select from. Check off the boxes for mingw-developer-tool..., mingw-base, and mingw-gcc-g++. Then from the menu pick Installation -> Apply Changes, and then press the Apply button. It will take some time for the package to download and install.

Once the package is installed, you will need to set the system path to be able to find the commands g++ and make. (On Windows 10) Search for "system path" in the windows search. Pick "Edit system environment variable", and then push the button "Environment Variables". Pick path, then push the edit button. Select new, and enter the path "C:\MinGW\bin\" (or the path you have installed MingGW in). Also add "C:\MinGW\msys\1.0\bin\" to the path.

Now if you start a command line terminal (search for cmd), you can test if g++ and make are installed.

Getting fltk libraries for 2L14 computers

For lab assingments later in the term, and for the final project we will be using the "Full tick" (fltk) libraries for graphics ( These libraries are available in the week 8 examples folder that is on the course USB stick. The fltk libraries are not installed on the 2L14 computers so you will use the copy of the pre-compiled libraries that are on the usb stick. from my website, and put them in the directory with the code you are trying to compile. These files can be download from here. Unpack the files into the directory where you are putting your source code that uses fltk. You can use this at home as well if you are using Win7/10.

Installing fltk libraries on your Windows machine

To install the fltk libraries into your existing MinGW installation from scratch (if you don't just copy the libraries from the zip file above) do the following:
  • Make sure you have in your system path: "C:\MinGW\bin\" and "C:\MinGW\msys\1.0\bin\"
  • Get a copy of the fltk libraries from here .
  • Unpack the contents into C:\fltk-1.3.3 using your favorite tool to unpack tarballs (.tgz or .tar.gz files). If you don't have one installed already try 7-zip.
  • Now compile and install the libraries in a comand line (cmd):
    	C:\> bash
    	bash-3.1$ cd /c/fltk-1.3.3
    	bash-3.1$ ./configure --enable-threads --enable-localjpeg --enable-localzlib --enable-localpng
    	bash-3.1$ make
    	bash-3.1$ make install
    	bash-3.1$ test/demo
    	bash-3.1$ exit
  • Congratulations ... the library is now installed.

Getting fltk libraries for mac

The easiest way to get the fltk libraries for mac is to install them from "Homebrew". First install "Homebrew" by typing in a terminal:
    /usr/bin/ruby -e "$(curl -fsSL"
Then in the same terminal you can install fltk:
    brew install fltk
You can find where fltk is installed then using :
    export FLTK_DIR=$(brew --prefix fltk)
    echo ${FLTK_DIR}

Blair A. Jamieson
Associate Professor
Department of Physics
Lockhart Hall (3L24)
University of Winnipeg
515 Portage Avenue
Winnipeg, MB R3B 2E9
Email. bl.jamieson (at)
Tel. +1 (204) 786-9216
Fax. +1 (204) 774-4134