==========
Devries, Paul L. ; Hasbun, Javier E. A first course in computational physics. Second edition. Jones and Bartlett Publishers:
2011.
============
Computer have changed the way physics is done,
but those changes are only slowly making their way into the typical curriculum.
This book is designed to help speed that transition. Computational physics is
now widely accepted as a third, equally valid complement to traditional
experimental and theoretical physics.
The simple truth is that the computer now permeates our society and has
changed the way we think about many things, including science in general and
physics in particular. It used to be that there was theoretical physics, which
dealt with developing and applying theories, often with an emphasis on
mathematics and "rigor." There was experimental physics, which was
also concerned with theories, and testing their validity in the laboratory: but
was primarily concerned with making observations and quantitative measurements.
Now there is computational physics, in which numerical experiments are
performed in the computer laboratory - an interesting marriage of the
traditional approaches to physics. Canned programs rarely exist for novel,
interesting physics, and so we have to write them ourselves. The capability of
visualizing a numerical solution as it is being generated is a tremendous tool
in understanding both the solution as well as the numerical methods. The
integration of such graphics capabilities into the computing environment is one
of the many strengths of Matlab.
Matlab®
There is a large variety of computer languages
out there that could be ( and are) used in computational physics: BASIC, C,
FORTRAN, and JAVA, each has its ardent supporters. These languages have
supporters because they all have their particular merits, which should not be
lightly dismissed. What sets Matlab apart is its widespread use and acceptance
in the Mathematics and particularly Engineering curriculum. As far as computer
programming is concerned, this text is primarily concerned with how to perform
a scientific calculations, not in how to code a particular statement.
Functions and Roots
A natural place for us to begin our discussion of computational physics
is with a discussion of functions. After all, the formal theory of functions
underlies virtually all of the scientific theory, and their use is fundamental
to any practical method of solving problems. We will discuss some general
properties, but always with an eye toward what is computationally applicable.
In particular, we will discuss the problem of finding the roots of a function
in one dimension. This is important mentioning that Matlab has several built-in
functions for determining the roots of functions.
Finding the roots of a function
Closed-form solutions for the roots exist for quadratic, cubic, and
quartic exquations as well, although they become rather cumbersome to use. But
no general solution exists for polynomials of fifth-order and higher. Many
equations have no analytical solution at all. So what we are really seeking is
a method for solving for the root of a nonlinear equation. What we would like
to have is a reliable numerical method that will provide accurate results with
a minimum of human intervention.
The bisection method is the simplest scheme for roots finding. You just
must:
- Find an interval: this is expected that the
root is inside;
- Half the interval: the internal is divided into
two parts;
- Choose the good half: one of the half must contain the root;
- Reset the extremes: if the root is at the right, the middle is the right extreme value,
otherwise the middle is the left extreme:
- Start again: repeats the process from 1, where the new intervals are
It is extremely important to use functions to
break the code into manageable pieces. This modularity aids immensely in the
clarity and readability of the code - the main program simply becomes a list of
calls to the various functions, so that the overall logic of the program is
nearly transparent.
Recursive algorithm
Matlab allows a function to call other
function. This permits us to break a large programming task into a sequence of
smaller and smaller ones, until we get to a point where it is easy to solve.
Furthermore, a function can call itself. There are problems that naturally lend
themselves to a recursive solutions and the root finding is one of them.
Taylor’s Series
In 1715 Brook Taylor, secretary of the Royal Society, published Methodus incrementorum directa et inversa in
which appears one of the most useful expression in much of mathematics and
certainly numerical analysis. Although previously known to the Scottish
mathematician James Gregory, and probably to Jean Bernoulli as well, we know it
as the Taylor Series.
Interpolation and
approximation
In some case of roots finding, an approximation to
a function is useful to finding roots, even though we had the exact function at
our disposal. A more common circumstance is that we do not know the exact
function, but build our knowledge of it as we acquire more information about
it. Several ways to approximate a function and its derivatives exist. With
interpolation, an approximating polynomial us found that exactly describes the
function being approximated at a set of specified points. Curve fitting approximates
a function in a general sense, without being constrained to agree with the
function at every point.
Nenhum comentário:
Postar um comentário