Computational Technologies

Book description

In this book we describe the basic elements of present computational technologies that use the algorithmic languages C/C++. The emphasis is on GNU compilers and libraries, FOSS for the solution of computational mathematics problems and visualization of the obtained data.

At the beginning, a brief introduction to C is given with emphasis on its easy use in scientific and engineering computations. We describe the basic elements of the language, such as variables, data types, executable statements, functions, arrays, pointers, dynamic memory and file management. After that, we present some observations on the C++ programming language. We discuss the issues of program compiling, linking, and debugging. A quick guide to Eclipse is also presented in the book. The main features for editing, compiling, debugging and application assembling are considered. As examples, we solve the standard problems of computational mathematics: operations with vectors and matrices, linear algebra problems, solution of nonlinear equations, numerical differentiation and integration, interpolation, initial value problems for ODEs and so on. Finally, basic features of computational technologies are illustrated with model problems. All programs are implemented in C/C++ with using the GSL library. Gnuplot is employed to visualize the results of computations.

Table of contents

  1. Title Page
  2. Copyright Page
  3. List of contributors
  4. Table of Contents
  5. Preface
  6. Introduction
  7. 1 An introduction to C
    1. 1.1 Syntax
      1. 1.1.1 Characters
      2. 1.1.2 Comments
      3. 1.1.3 Identifiers
    2. 1.2 Constants and variables
      1. 1.2.1 Data types
      2. 1.2.2 Integer constants
      3. 1.2.3 Floating-point numbers
      4. 1.2.4 Using characters
    3. 1.3 Expressions and operators
      1. 1.3.1 Arithmetic operators
      2. 1.3.2 Relational and logical operators
      3. 1.3.3 Type conversions
    4. 1.4 Statements
      1. 1.4.1 Conditional statements
      2. 1.4.2 Loop statements
      3. 1.4.3 Jump statements
    5. 1.5 Arrays
      1. 1.5.1 One-dimensional arrays
      2. 1.5.2 Character arrays
      3. 1.5.3 Two- and multidimensional arrays
    6. 1.6 Pointers
      1. 1.6.1 Pointer declaration
      2. 1.6.2 Pointer operations
      3. 1.6.3 Pointers and arrays
    7. 1.7 Functions
      1. 1.7.1 Function definition
      2. 1.7.2 Function prototype
      3. 1.7.3 Pointers as function formal parameters
    8. 1.8 Structures
      1. 1.8.1 Structure definition
      2. 1.8.2 Structure variables and their initialization
      3. 1.8.3 Gaining access to structure members
    9. 1.9 Input/output
      1. 1.9.1 Library functions
      2. 1.9.2 Streams
      3. 1.9.3 Work with files
      4. 1.9.4 Formatted data output
      5. 1.9.5 Formatted data input
    10. 1.10 Program structure
      1. 1.10.1 Preprocessing facilities
      2. 1.10.2 File organization of a program
      3. 1.10.3 Program structure
  8. 2 C++ programming basics
    1. 2.1 Enhanced features
      1. 2.1.1 Keywords
      2. 2.1.2 Declaration of variables within blocks
      3. 2.1.3 Scope resolution operator
      4. 2.1.4 Default arguments
      5. 2.1.5 Boolean type
      6. 2.1.6 Dynamic memory
    2. 2.2 Classes
      1. 2.2.1 Creating a class
      2. 2.2.2 Methods
      3. 2.2.3 Objects of a class
      4. 2.2.4 Constructors and destructors
    3. 2.3 Function and operator overloading
      1. 2.3.1 Function overloading
      2. 2.3.2 Operator overloading
      3. 2.3.3 Operator overloading with friend functions
    4. 2.4 Inheritance
      1. 2.4.1 Concept of inheritance
      2. 2.4.2 Protected elements
      3. 2.4.3 Example: a point and circle
      4. 2.4.4 Virtual functions
    5. 2.5 Input/output
      1. 2.5.1 Output to streams
      2. 2.5.2 Input into a stream
      3. 2.5.3 Overloading of input/output operators
      4. 2.5.4 Formatted input/output
      5. 2.5.5 Reading/writing from/into files
    6. 2.6 Standard libraries
      1. 2.6.1 Work with time
      2. 2.6.2 Common functions
      3. 2.6.3 Work with strings
  9. 3 GCC distilled
    1. 3.1 General information
      1. 3.1.1 Supported languages
      2. 3.1.2 Platforms
      3. 3.1.3 Installation on Linux
      4. 3.1.4 Work with GCC on Windows
    2. 3.2 Available documentation
      1. 3.2.1 Documentation on the internet
      2. 3.2.2 Help via –help
      3. 3.2.3 Manual pages
      4. 3.2.4 Use of info
      5. 3.2.5 Tools to visualize help information
      6. 3.2.6 Additional help
    3. 3.3 Compilation workflow
      1. 3.3.1 Up-and-runningwith GCC
      2. 3.3.2 Test program
      3. 3.3.3 Preprocessing
      4. 3.3.4 Object code generation
      5. 3.3.5 Executable file
    4. 3.4 Compiling a C/C++ program
      1. 3.4.1 Input files for compiling
      2. 3.4.2 Options for searching for a directory
      3. 3.4.3 Options for controlling a language
      4. 3.4.4 Options for warnings
      5. 3.4.5 Options for optimization
    5. 3.5 Libraries and linking programs
      1. 3.5.1 Simple linking
      2. 3.5.2 Linking with a static library
      3. 3.5.3 Linking with a shared library
    6. 3.6 Debugging
      1. 3.6.1 Compilation with GDB
      2. 3.6.2 Getting started with GDB
      3. 3.6.3 Source code
      4. 3.6.4 Breakpoints
      5. 3.6.5 Displaying data
      6. 3.6.6 How to step through a program
    7. 3.7 The make utility
      1. 3.7.1 Usage of the utility
      2. 3.7.2 Example
      3. 3.7.3 Simple makefile
      4. 3.7.4 Phony targets
      5. 3.7.5 Variables
  10. 4 The Eclipse IDE in a nutshell
    1. 4.1 The Eclipse architecture and GUI
      1. 4.1.1 Integrated development environments
      2. 4.1.2 Free cross-platform IDEs
      3. 4.1.3 Eclipse
      4. 4.1.4 Installation
      5. 4.1.5 Updating and installing plug-ins
    2. 4.2 Working with projects
      1. 4.2.1 Available tools
      2. 4.2.2 Test project
      3. 4.2.3 Creating a project
      4. 4.2.4 Compiling, linking, and running applications
    3. 4.3 Editing a source code
      1. 4.3.1 Customizing the editor
      2. 4.3.2 Working with text
      3. 4.3.3 Quick insertion
      4. 4.3.4 Searching for text
      5. 4.3.5 Navigation through a code
    4. 4.4 Debugging applications
      1. 4.4.1 Perspective for debugging
      2. 4.4.2 Breakpoints
      3. 4.4.3 Values of variables
  11. 5 The GSL scientific library
    1. 5.1 Preliminaries
    2. 5.2 Functions and constants
      1. 5.2.1 Mathematical and special functions
      2. 5.2.2 Physical constants
      3. 5.2.3 Random number generators
      4. 5.2.4 Statistical functions
    3. 5.3 Combinatorics
      1. 5.3.1 Permutation
      2. 5.3.2 Combinations
      3. 5.3.3 Multisets
    4. 5.4 Linear algebra
      1. 5.4.1 Basic structures
      2. 5.4.2 BLAS support
      3. 5.4.3 Solving linear systems
      4. 5.4.4 Eigenvalues and eigenvectors
    5. 5.5 Numerical differentiation and integration
      1. 5.5.1 Numerical differentiation
      2. 5.5.2 Numerical integration
      3. 5.5.3 Numerical integration of multidimensional functions
    6. 5.6 Cauchy problem for systems of ODEs
      1. 5.6.1 Stepping functions
      2. 5.6.2 Evolution function
      3. 5.6.3 Driver
    7. 5.7 Solution of equations
      1. 5.7.1 Polynomials
      2. 5.7.2 One-dimensional root-finding
      3. 5.7.3 Multidimensional root-finding
      4. 5.7.4 One-dimensional minimization
      5. 5.7.5 Multidimensional minimization
    8. 5.8 Interpolation and approximation of functions
      1. 5.8.1 Interpolation
      2. 5.8.2 Least-squares method
      3. 5.8.3 B-splines
    9. 5.9 Fast Fourier transforms and Chebyshev approximations
      1. 5.9.1 Fast Fourier transform
      2. 5.9.2 Chebyshev approximations
  12. 6 Visualization of computed data
    1. 6.1 Basics
      1. 6.1.1 Essentials of gnuplot
      2. 6.1.2 How to install and run gnuplot
      3. 6.1.3 Simple plot
      4. 6.1.4 Abbreviations
      5. 6.1.5 Scripts
    2. 6.2 Data handling
      1. 6.2.1 Data blocks
      2. 6.2.2 Data selection
      3. 6.2.3 Data changing
    3. 6.3 Data interpolation
      1. 6.3.1 Sorting and averaging data
      2. 6.3.2 Smoothing data
    4. 6.4 Using styles
      1. 6.4.1 Output
      2. 6.4.2 Styles
      3. 6.4.3 Line style
    5. 6.5 Graph decoration
      1. 6.5.1 Legend
      2. 6.5.2 Axes
      3. 6.5.3 Labels
      4. 6.5.4 Font
      5. 6.5.5 Grid
  13. 7 Mathematical modeling
    1. 7.1 Approximation of experimental data
      1. 7.1.1 Problem formulation
      2. 7.1.2 Least squares method
      3. 7.1.3 Program
      4. 7.1.4 Computations
    2. 7.2 Predator-prey system
      1. 7.2.1 Mathematical model
      2. 7.2.2 Stationary state
      3. 7.2.3 Numerical method
      4. 7.2.4 Program
      5. 7.2.5 Specification of the right-hand side
      6. 7.2.6 Visualization script
      7. 7.2.7 The basic variant of input data
      8. 7.2.8 Variation of parameters
    3. 7.3 Water infiltration
      1. 7.3.1 The equation of water transport
      2. 7.3.2 Self-similar solution
      3. 7.3.3 Difference scheme
      4. 7.3.4 Program
      5. 7.3.5 Visualization
      6. 7.3.6 Predictions
    4. 7.4 Torsion of cylindrical bars
      1. 7.4.1 Problem formulation
      2. 7.4.2 Difference problem
      3. 7.4.3 Numerical algorithm and program
      4. 7.4.4 Numerical results
  14. Bibliography
  15. Index

Product information

  • Title: Computational Technologies
  • Author(s): Petr N. Vabishchevich
  • Release date: December 2014
  • Publisher(s): De Gruyter
  • ISBN: 9783110391039