You are on page 1of 6

PENGANTAR FISIKA KOMPUTASI Lab Fiskom Fisika FMIPA UNEJ 2019

https://homepage.univie.ac.at/Franz.Vesely/cp0102/index.html

Franz J. Vesely:
Computational Physics - An Introduction
Second Edition

Kluwer Academic / Plenum Publishers, New York-London 2001.


ISBN 0-306-46631-7

Amazon.com            Errata            Course material with didactic applets

Preface: What is Computational Physics?


Computational physics is physics done by means of computational methods. Computers do
not enter into this tentative definition. A number of fundamental techniques of our craft were
introduced by Newton, Gauss, Jacobi, and other pioneers who lived quite some time before
the invention of workable calculating machines. To be sure, nobody in his right state of mind
would apply stochastic methods by throwing dice, and the iterative solution of differential
equations is feasible only in conjunction with the high computing speed of electronic
calculators. Nevertheless, computational physics is much more than ``Physics Using
Computers.''

The essential point in computational physics is not the use of machines, but the
systematic application of numerical techniques in place of, and in addition to, analytical
methods, in order to render accessible to computation as large a part of physical reality
as possible.

http://iel.ucdavis.edu/publication/WhyC.html

Ten Reasons to Teach and Learn Computer Programming in C

Harry H. Cheng
Last updated on May-30-2011

Writing computer programs to solve problems is a basic skill all students must master. There
are many popular programming languages. Students nowadays typically get exposure to more
than one language. Which computer programming language should students know so that
they will not miss fundamentals of computing? Which computer programming language
should students learn first to gain computer-aided problem solving skills? I started my
computing career using computers with punch cards and BASIC. Later, I learned FORTRAN
77, Fortran 90, and numerous computer programming languages. Based on my teaching,
research, and industrial experiences, the answer is C for the following reasons.

1. C is one of the foundations for modern information technology (IT) and computer
science (CS).
Many working principles of IT and CS, such as programming languages, computer
architectures, operating systems, network communication, database, graphical user
interface (GUI), graphics, image processing, parallel processing, multi-threads, real-
time systems, device drivers, data acquisition, algorithms, numerical analysis, and
computer game, are based on or reflected in the functionalities and features of C. The
experience in C will help students understand the working principles of these
important concepts in IT and CS. Therefore, C is required for the CS major in almost
all universities.
2. C is the most commonly used programming language in industry.
Academic institutions have a mission to teach technologies that are widely used in the
real world so that students have the skills and knowledge that employers need. More
than 90 percent of the programs running on our desktops, from operating systems and
e-mail clients to Web browsers and word processors, are written in C or its relative,
C++ which has extensions to C. Most games and underlying robot control software
are written in C or C++. With the knowledge of C, students will not only be able to
play games and robots, but also understand their underlying working principles and
potentially develop their own games and robots. The Programming Language
Popularity Web site (www.langpop.com) and Programming Community Index
( www.tiobe.com) are two of the best known and most authoritative statistical
sources. In the Programming Language Popularity Website (dated in June, 2010), C
tops the list, C++ ranks the second, Java is the third as shown in Figure 1.

Figure 1: The popularity of different programming languages.


In the Programming Community Index (dated in June, 2010), C and C++ together are
the dominant number one (27.6%, with C for 17.9% and C++ for 9.7%) with a huge
distance from the number two among all existing programming languages. Java holds
the second spot (18.0%). For comparison, Matlab and Fortran have much lower
market shares. Matlab ranks 15 (0.6%) and Fortran ranks 35 (0.4%)

3. C is the language of choice for programming embedded and mechatronic systems


with hardware interfaces.
C is the language of choice for harware interface. C allows you to access the memory
of a computer or microprocessor to manipulate and play with bits and bytes. Device
drivers of new hardware devices are typically written in C. Often, C is the only choice
and the other alternative is tedious, low-level programming using an assembly
language. Therefore, C is the de facto standard of high-level programming language
for hardware interface. As a hardware interface language, C is used commonly for
data acquisition and real-time control of embedded and mechatronic systems. C is
especially useful for applications such as control of robots. The underlying algorithms
for control robots are always written in C. Often times, users will also have to write C
code to control a robot. For example, programming robots in the FIRST Robotics
Competition is typically accomplished in C. Many hardware and software vendors
even provide libraries of C code for hardware interfaces. C is also the most widely
used language for programming embedded processors, which control everything from
automobiles, industrial machinery, medical equipment, and household appliances to
traffic lights, vending machines, cell phones, and toys. Of the 9 billion
microprocessors manufactured in 2005, 8.8 billion were embedded into products.
Most of them were programmed in C or assembly languages.

4. C is one of the most commonly used programming languages in colleges and


universities.
Computer programming is an essential skill for advanced studies in Science,
Technology, Engineering, and Mathematics (STEM) fields. Like in industry, C is also
one of the most commonly used programming languages in colleges and universities
for teaching and research. Experience indicates that the gateway courses on C or C++
in colleges are often difficult for freshman college students. C or C++ is required by
not only CS major, but also many other majors in colleges and universities. C or C++
is the gatekeeper for the Computer Science major in many universities. With
experience in C, students are well prepared for advanced studies in colleges and
universities.

Note that many embedded systems do not support C++. Therefore, learning to
develop programs using a strict C, without advanced C++ features, is critical for many
applications including interface to hardware. C++ is a superset of C to a certain
degree. However, C++ is a lot more complicated than C. Unfortunately, without a
solid foundation in C, it is impossible to fully master object-oriented and many other
advanced features in C++.

5. C is the base for almost all popular programming languages.


C is the language of choice for system programming. Because of the performance and
portability of C, almost all popular cross-platform programming languages and
scripting languages, such as C++, Java, Python, Objective-C, Perl, Ruby, PHP, Lua,
and Bash, are implemented in C and borrowed syntaxes and functions heavily from C.
They share the similar operators, expressions, repetition statements, control structures,
arrays, input and output, and functions. Furthermore, almost all languages can
interface with C and C++ to take advantage of a large volume of existing C/C++
libraries. Many of their toolkits, modules or packages are written using C or C++. For
example, a scripting language typically uses wrappers around a C or C++ library to
create a toolkit or package. Any emerging popular cross-platform languages will very
likely also be written in C and must be designed to be able to interface with existing
C/C++ libraries.
6. C excels as a model of programming languages.
C does an excellent job of illustrating the underlying working principles of computers,
scientific computing, and disciplined software development. Students gain valuable
knowledge of such fundamental programming concepts as data types, internal data
representations, operators, expressions, loops for repetitions, control structures,
arrays, input and output, functions, debugging, etc. Studying C provides a solid
foundation for students who want to learn advanced programming skills such as
object-oriented programming, event-driven programming, multi-thread programming,
real-time programming, embedded programming, network programming, parallel
programming, other programming languages, and new and emerging computing
paradigms such as grid-computing and cloud computing.
7. Once students have learned C, they can pick up any other languages by themselves.
Certain languages and tools are typically used to solve domain specific problems.
Therefore, the ability to understand and learn new languages is important. All other
modern languages borrowed heavily from C. Once students learned C, it is easy for
them to learn by themselves any other computer languages without much difficulty.
On the other hand, even if students have learned other programming languages or
visual programming, it is generally still quite difficult for them to learn C by
themselves, especially for difficult topics such as pointers and linked lists. Computer
programming in C needs a disciplined approach. Many people believe that if students
start with computer programming using a typeless scripting language first, then they
would have even harder time to learn and master C afterwards.
8. C is a standardized programming language with international standards.
The standardization encourages diverse implementation by different vendors and
organizations. Unlike proprietary languages such as Matlab and Mathematica, a
standardized programming language is not controlled by a single vendor. A
standardized programming language is stable and its evolution is overseen by a
technical standard committee made up of business, academic, and organizational
representatives with a stake in the language. The existing code written in a
standardized language is less likely to break even if compilers or interpreters from
different vendors are updated or developed years later. This means what you learned
and wrote 30 years ago won't be obsolete and are still useful today and in the future.
The first C standard, C89, was released in 1989 by the ANSI X3J11 and ISO
S22/WG14 C Standard Committees. The second (and latest) C standard, C99, was
ratified in 1999 and added many new features, such as complex numbers, variable
length arrays for numerical computing, and support for 64-bit computing. All existing
code conforming to the C89 standard can run in a C compiler or interpreter
conforming to the C99 standard. As a contrary example, there is no standard for
Python. Python 3.0 breaks the code, packages and modules written for the previous
versions of Python.
9. Computer programming is becoming a necessary skill for many professions.
Writing computer programs is essential to solving complex science and engineering
problems. Many principles and concepts in STEM disciplines can be illustrated and
reinforced through writing programs. C and C++ are more widely used in STEM
fields than any other programming languages such as Java, Fortran, or Matlab.

The notion that only future computer scientists or IT professionals need training in
computer programming is no longer true. Outside of the IT industry, knowledge of
computer programming is an essential skills for careers not only in STEM fields, but
also in marketing, advertising, journalism and the creative arts. For example, market
researchers may have to use or write programs to analyze a large set of data.

10. Computer programming can develop student's critical thinking capabilities.


Developing a program to solve a practical problem involves many creative works,
including design, logic reasoning, math, etc. It can help students find practical
applications of many math concepts such as variables in Algebra I and trigonometry.
Debugging a program can also help student improve their reasoning and logical
thinking capabilities. The computer-aided problem solving capabilities can be trained
using C.

Download materi C++

https://www.phys.uconn.edu/~rozman/Courses/P2200_12F/downloads/

http://www.ap.smu.ca/~thacker/teaching/3437/lectures.html

PHYS 3437 - Computational Methods in Physics

Lecture 1 (ppt): Course outline, supplemental information. Computer architecture 101

Lecture 2 (ppt): Storing information digitally. Integer representations, floating point arithmetic.

Lecture 3 (ppt): Short discussion about projects. More on floating point arithmetic and problems you
may encounter.

Lecture 4 (ppt): Introduction to Unix shells and useful commands. 10,000 ft view of programming.

Lecture 5 (ppt): Functions and roots. Roots for polynomials. Bracketing & Bisection, Newton-Raphson,
hybrid NR-bisection, Secant Method.

Lecture 6 (ppt): A global bracket finding strategy. Muller-Brent. Example of root finding from quantum
mechanics.

Lecture 7 (ppt): Introduction to interpolation. Difference between interpolation and fitting to data.
Interpolation polynomials in Lagrange form. Hermite interpolation. Introduction to cubic splines.

Lecture 8 (ppt): Finish cubic splines. Numerical approximations to derivatives. Richardson


Extrapolation.
Lecture 9 (ppt): LU decomposition for solving general matrices. General polynomial least squares
fitting. Least squares function fitting and Hilbert matrices. Orthogonal polynomials and uses in fitting.

Lecture 10 (ppt): Numerical integration. Simple Newton-Cotes formulas (trapezoid & Simpson's Rule).
Romberg Integration. Gaussian quadrature.

Lecture 11 (ppt): Problems that can be encountered in numerical integration. Change of variables,
removal of singularities. Dealing with improper integrals. Multidimensional int egration.

Lecture 12 (ppt): Introduction to ODE solvers. Euler method, including Modified and Improved
variants. Classical Runge-Kutta with adaptive step size from Richardson Extrapolation.

Lecture 13 (ppt): Issues with the adaptive step size procedure. Separating 2nd order ODEs into
coupled first order system. Separating nth order ODEs into n coupled first order systems. Algorithm to
integrate nth order systems.

Lecture 14 (ppt): Introduction to Monte Carlo methods. Numerical integration techniques, rejection
method, importance sampling.

Lecture 15 (ppt): MC methods applied to molecular motion in gases - the random walk. Simulation
method & how to choose points randomly on a sphere. Short overview of random number generators,
advice for quick and dirty generators and what to use if you want really "good" random numbers.

Lecture 16 (ppt): Introduction to parallel programming. Different types of parallel computers. When is
parallel computing useful? Brief introduction to OpenMP.

Lecture 17 (ppt): More details on parallel programming. Dealing with data dependencies and race
conditions. Useful OpenMP commands reviewed.

Lecture 18 (ppt): Introduction to visualization. Preattentive processing of information. How now to


present information. Effectiveness of different colour maps. Getting started with Opendx.

Lecture 19 (ppt): More on Opendx. Loading in data and using the default viewer. Visualization of 3d
volumes, surface rendering versus volume rendering. How transfer functions highlight different parts
of a data volume. Making movies.

https://ww2.odu.edu/~agodunov/teaching/notes/Intr01_basic.pdf

https://homepages.uc.edu/~schreihf/uchenry/post/computational-physics/

You might also like