
Perform a linear search using vector elements
Perform a binary search using vector elements
Converting degree to radian using functions
Calculate the factorial of any number using a recursive function
Calculate Euler's number (mathematical constant e) using two different approaches
Session deals with switch-statements and the inefficient way of handling the sorting of exam scores
Session deals with the handling of switch-statements and a buying list (items) represented in terms of arrays
Conversion of a binary number to its decimal equivalent
Playing scratchcard game using random numbers and input validation by employing a do-while loop
Calculating the product of two randomly generated numbers and play against user until the right answer is given
Session deals with the calculation of the product of even and odd numbers using functions
Session shows how to cope with different scenarios using logical operators
Session investigates how to exploit the sizeof-operator for getting the array size in order to have an array of variable size instead of hardcoding or adjusting the size manually
We use letters and patterns as a playground for getting familiar with multidimensional arrays, i.e. 2-dimensional array
This session shows how to deal with dynamically created multidimensional array using pointers
Session deals with the technique of enlarging an array using pointers and populating the original array as well as the enlarged one with distinct numbers
We learn how to read in numbers into a vector of vector of datatype int and calculate the total of all numbers
We take up the issue multidimensional vectors for reading in data from a file consisting of double values
In this session we generate 16 distinct random numbers and place these numbers into a two-dimensional array (4x4-grid)
In this session we learn how to read in values from a csv-file into a vector of vector of datatype double using two string delimiters
This tutorial deals with object-oriented programming in which we read in values from a csv-file and store them as a vector of object. The different type of lights represent the individual objects for which the energy conversion efficiency is calculated.
This tutorial deals with object-oriented programming in which we create a class "BMR" of two different objects (male, female). The corresponding BMRs are calculated with the aid of Harris-Benedicts formula.
In this tutorial we take up the issue object-oriented programming in which we create a class dealing with the invoice of hotel guests by storing each guest as a vector of object.
This tutorial introduces the concept of inheritance using object-oriented programming by calculating the weekly salaries of blue collar and white collar workers. A static member variable is also considered for monitoring the company balance.
In this tutorial we create an array of 100 evenly spaced points between within the interval of 0 and 1.
In this tutorial we will get to learn virtual functions and elucidate polymorphism with the help of a "car dealer" example. A static member variable is also considered for monitoring the sum of all ordered cars.
In this tutorial we develop a small Software by utilizing global arrays. The global arrays allow to hold the transcript of records of specific number of students and information such as "student's name, subject and score" which are stored in these arrays.
In this tutorial we implement the ancient Egyptian multiplication algorithm and introduce the concept of verifying algorithms by employing the built-in assert()-macro in C++.
For sorting the elements in the list in an ascending or descending order we employ the well-known bubble-sort algorithm. Via a function pointer we control which sorting function should be invoked.
For the evaluation of two definite integrals we employ the Simpson's rule approximation known from numerical analysis. The calling and computing of the two definite integrals is done via a function pointer.
In this session we'll learn how to use an array of function pointers for creating a value table of two common functions (root and exponential function) within a specific interval.
This tutorial deals with the numerical differentiation of two trigonometric functions by employing the extrapolation method by Richardson.
In this session we'll employ Newton's interpolation formula to find the root of two polynomial functions. Convergence problems are illustrated with the aid of a bad starting point for one of the polynomial function which consequently enters an infinite cycle.
This tutorial deals with the numerical calculation of the binomial coefficient of any number of k-element subset of an n-element set by employing both the recursive formula and multiplicative one for the iterative method.
In this session we'll gain an insight into the heapsort algorithm by transforming a sequence of vector elements into a max heap. The elements are subsequently sorted and max./min. elements are extracted. Ultimately, the heap is reduced by 1 via deletion of the top element. Additionally, for printing the elements an iterator is employed by overloading the ostream-operator for the vector class.
In this session we'll learn how to calculate the single probability and to create a binomial table for a range of n-trials by employing the recursion formula. In addition, the expected value is computed for each example.
In this tutorial we'll learn how to implement the normal distribution based on Hastings approximation using a fifth degree polynomial. The polynomial approximation is solved by Horner's method in terms of a continuous factorisation.
In this tutorial we'll learn how to use enum and struct for calculating the area of two distinct figures, i.e. a rectangle and a right triangle.
In this tutorial we employ the least squares method by Gauss for a linear and non-linear regression and determine the coefficients a, b polymorphically. This is achieved by using STL functions such as accumulate() and inner_product() functions. Lastly, we calculate the correlation coefficient according to Pearson's formula.
In this tutorial we investigate the MC-simulation of a 2D Ising system by employing the Metropolis algorithm. The simulation is performed for 10.000 cycles in order to calculate the average magnetization as well as average energy per spin. Lastly, the temperature is varied from 1.0 up to 5.0 for demonstrating that the spontaneous magnetization of the ferromagnetic material is lost on heating (above the Curie temperature) and becoming paramagnetic.
We read the values of datatype float from file and store the matrix values in a 2D-array. Hence, we create a Matrix class and use getters in order to access each element of the 10x10 Matrix on the 2D-grid.
In the first part of this tutorial, we only deal with the determination of number of columns.
Exercise: write three additional void-functions in order to print all float values and calculate the sum over each column and row.
We read the values of datatype float from file and store the matrix values in a 2D-array. Hence, we create a Matrix class and use getters in order to access each element of the 10x10 Matrix on the 2D-grid.
In this second part, we proceed with the determination of number of rows and parsing of the float values in terms of the 10x10 matrix.
Exercise: write three additional void-functions in order to print all float values and calculate the sum over each column and row.
Session deals with the solution of quadratic equations by employing the template class complex.
Exercise: rewrite the code and evaluate the three quadratic equations by making use of function pointers
C++ is an excellent programming language which is extremely well-suited for scientific computing. I do not start from scratch, so it is good if you have some experience with C++. However, I'll try to introduce fundamental programming concepts (vector & boolean functions, arrays etc.) which are needed to understand and solve the discussed coding problems. In particular, concepts needed to understand object-oriented programming like inheritance, static members, virtual functions and polymorphism will be explained in detail. So don't panic :-).
As a starter, we'll take a look at some basic algorithms such as linear & binary search. Couple tutorials down the road, we'll take a look at more advanced sorting algorithms like bubble & heapsort algorithms. Before heading towards the heart of C++, we start with coding some small programs such as degree to radian and binary to decimal number converter in order to internalize the required programming concepts.
Moreover, we elaborate on recursive functions vs. for-loops with regard to advantages and disadvantages. More programming concepts involve switch functions, pointers and function pointers, typedef-constructs, enum & struct type, dynamical arrays using memory allocation and much more. Furthermore, we will learn how to parse multiple format files for post-processing.
After acquiring the required knowledge, we focus more detailed on numerical methods in terms of scientific computing such as Monte-Carlo simulation of a 2D Ising magnet, integration method according to Simpson's rule, binomial distribution/coefficients, numerical differentiation using extrapolation technique by Richardson, Newton-method for finding roots, Gaussian/Normal distribution, linear/exponential regression using least square method by Gauss and so forth.
So, if you want to learn numerical computation techniques in detail, you are absolutely at the right place! In this sense, I hope to see you in the course and let's start coding!