2
1 T h e F i r s t F e w S t e p s
Nevertheless, programs often make us frustrated when they cannot do what
we wish. One typical situation might be the following. Say you have some
measurements from a device, and the data are stored in a file with a specific format.
You may want to analyze these data in Excel and make some graphics out of it.
However, assume there is no menu in Excel that allows you to import data in this
specific format. Excel can work with many different data formats, but not this one.
You start searching for alternatives to Excel that can do the same and read this type
of data files. Maybe you cannot find any ready-made program directly applicable.
You have reached the point where knowing how to write programs on your own
would be of great help to you! With some programming skills, you may write your
own little program which can translate one data format to another. With that little
piece of tailored code, your data may be read and analyzed, perhaps in Excel, or
perhaps by a new program tailored to the computations that the measurement data
demand.
Programming The real power of computers can only be utilized if you can
program them, i.e., write the programs yourself. With programming, you can tell
the computer what you want it to do, which is great, since it frees you from possible
limitations that come with programs written by others! Thus, with this skill, you get
an important extra option for problem solving that goes beyond what ready-made
programs offer.
A program that you write, will be a set of instructions that you store in a file.
These instructions must be written (according to certain rules) in a very specialized
language that has adopted words and expressions from English. Such languages
are known as programming (or computer) languages. When you have written your
instructions (your program), you may ask the programming language to read your
program and carry out the instructions. The programming language will then (if
there are no errors) translate the meaning of your instructions into real actions inside
the computer.
To write a program that solves a computing problem, you need to have a thorough
understanding of the given problem. That understanding may have to be developed
along the way and will obviously guide the way you write your solution program.
Typically, you need to write, test and re-write your program several times until you
get it right. Thus, what starts out with a computing problem and ends with a sensible
computer program for its solution, is a process that may take some time. By the term
programming, we will mean the whole of this process.
The purpose of this book is to teach you how to develop computer programs dedicated to solve mathematical and engineering problems by fundamental numerical
methods.
Programming Languages There are numerous computer languages for different
purposes. Within the engineering area, the most widely used ones are Python,
MATLAB, Octave, Fortran, C, C++, and to some extent, Maple and Mathematica.
The rules for how to write the instructions (i.e. the syntax) differ between the
languages. Let us use an analogy.
Assume you are an international kind of person, having friends abroad in
England, Russia and China. They want to try your favorite cake. What can you
1 T h e F i r s t F e w S t e p s
Nevertheless, programs often make us frustrated when they cannot do what
we wish. One typical situation might be the following. Say you have some
measurements from a device, and the data are stored in a file with a specific format.
You may want to analyze these data in Excel and make some graphics out of it.
However, assume there is no menu in Excel that allows you to import data in this
specific format. Excel can work with many different data formats, but not this one.
You start searching for alternatives to Excel that can do the same and read this type
of data files. Maybe you cannot find any ready-made program directly applicable.
You have reached the point where knowing how to write programs on your own
would be of great help to you! With some programming skills, you may write your
own little program which can translate one data format to another. With that little
piece of tailored code, your data may be read and analyzed, perhaps in Excel, or
perhaps by a new program tailored to the computations that the measurement data
demand.
Programming The real power of computers can only be utilized if you can
program them, i.e., write the programs yourself. With programming, you can tell
the computer what you want it to do, which is great, since it frees you from possible
limitations that come with programs written by others! Thus, with this skill, you get
an important extra option for problem solving that goes beyond what ready-made
programs offer.
A program that you write, will be a set of instructions that you store in a file.
These instructions must be written (according to certain rules) in a very specialized
language that has adopted words and expressions from English. Such languages
are known as programming (or computer) languages. When you have written your
instructions (your program), you may ask the programming language to read your
program and carry out the instructions. The programming language will then (if
there are no errors) translate the meaning of your instructions into real actions inside
the computer.
To write a program that solves a computing problem, you need to have a thorough
understanding of the given problem. That understanding may have to be developed
along the way and will obviously guide the way you write your solution program.
Typically, you need to write, test and re-write your program several times until you
get it right. Thus, what starts out with a computing problem and ends with a sensible
computer program for its solution, is a process that may take some time. By the term
programming, we will mean the whole of this process.
The purpose of this book is to teach you how to develop computer programs dedicated to solve mathematical and engineering problems by fundamental numerical
methods.
Programming Languages There are numerous computer languages for different
purposes. Within the engineering area, the most widely used ones are Python,
MATLAB, Octave, Fortran, C, C++, and to some extent, Maple and Mathematica.
The rules for how to write the instructions (i.e. the syntax) differ between the
languages. Let us use an analogy.
Assume you are an international kind of person, having friends abroad in
England, Russia and China. They want to try your favorite cake. What can you
