Numerical Methods

Outline

Introduction
- Basics
- Errors
Methodological and roundoff errors

Linear
Equations

Interpolation

Numerical
Solutions

Computer
Measurement

      

Basics

The subject of this lecture on Numerical Methods in Physics is the solution of real physical problems with methods of numerical mathematics. These methods permit to treat problems which are so complex that they can only be solved with the aid of a computer.

For computationally intensive problems in physics, historically Fortran and c were often used. Fortran has the reputation for delivering the fastest execution speeds but with modern compilers the advantage that can be obtained is not very large. For large projects that require many people to collaborate, a structured language like Java is a good choice. Higher level languages like Matlab or Python are often convenient for calculations, plotting, and manipulating data. Since there is no best computer language for all applications, we will provide example code in various computer languages.

One language that is particulary well suited for web-based course notes is JavaScript. JavaScript was designed to be embedded into web pages. For numerical routines, the syntax of JavaScript is very close to c++ or Java. For example, below on the left is a text area that contains some Javascript code that calculates the squares of some integers. To the right of the JavaScript code is an iframe. An iframe is a webpage within a webpage. When the "Execute" button is pressed, the code in the box on the left is loaded into the iframe. Try this now.

You can modify the code on the left and see how it changes the output.

Comments in JavaScript

Comments are an important part of any program. They are used to describe how the program works. Since JavaScript is embedded in a web page, the comments can be in Hypertext Markup Language (HTML). This means the comment can contain images, mathematical symbols, or videos. Below are some buttons that load html examples into the textbox which are then rendered in the iframe.

For more information about html, visit the w3schools HTML tutorial.