Numerical Methods | |
|
BasicsThe 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. |