Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Scientific Computing in C++
Rating: 4.2 out of 5(70 ratings)
968 students

Scientific Computing in C++

Learn numerical computation techniques by applying C++ to solve distinct mathematical tasks
Created byOkan Koeksal
Last updated 5/2026
English

What you'll learn

  • Learn programming concepts such as loops, arrays (vectors), boolean operator, pointers, dynamic memory allocation, OOP (inheritance, polymorphism, virtual functions), function pointers, array of funtion pointers, enum, struct etc.
  • Apply acquired programming skills in order to understand algorithms and mathematical problems
  • Practice reading in multiple format files for further processing
  • Get familiar with fundamental programming concepts like object-oriented programming as it is the heart of C++
  • Learn numerical computational techniques such as Newton method, Monte-Carlo simulation, Richardson extrapolation, Binomial & Gaussian distribution etc.

Course content

1 section44 lectures18h 0m total length
  • Introduction1:56
  • Linear search algorithm19:56

    Perform a linear search using vector elements

  • Binary search algorithm28:33

    Perform a binary search using vector elements

  • Degree to radian converter9:20

    Converting degree to radian using functions

  • Recursive function (factorial)7:54

    Calculate the factorial of any number using a recursive function

  • Euler's number (recursive vs. for-loop approach)15:32

    Calculate Euler's number (mathematical constant e) using two different approaches

  • Exam scores and switch-statement18:36

    Session deals with switch-statements and the inefficient way of handling the sorting of exam scores

  • Arrays and switch-statements17:34

    Session deals with the handling of switch-statements and a buying list (items) represented in terms of arrays

  • Binary to decimal number converter10:32

    Conversion of a binary number to its decimal equivalent

  • Scratchcard game (do-while-loop / random numbers)14:28

    Playing scratchcard game using random numbers and input validation by employing a do-while loop

  • User vs. computer (multiplication exercise)10:12

    Calculating the product of two randomly generated numbers and play against user until the right answer is given

  • Multiplication (even/odd numbers)13:16

    Session deals with the calculation of the product of even and odd numbers using functions

  • Logical operators (arrays)23:17

    Session shows how to cope with different scenarios using logical operators

  • Sizeof-Operator and variable size of array14:03

    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

  • Letters and patterns (multidimensional array)31:33

    We use letters and patterns as a playground for getting familiar with multidimensional arrays, i.e. 2-dimensional array

  • 2D-array (dynamic memory allocation using pointers)18:09

    This session shows how to deal with dynamically created multidimensional array using pointers

  • Enlarge/duplicate array using pointers20:35

    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

  • Sum of all vector elements of an user-defined matrix of order n*m18:43

    We learn how to read in numbers into a vector of vector of datatype int and calculate the total of all numbers

  • Sum of each row/column of a multidimensional vector (reading in data from file)18:49

    We take up the issue multidimensional vectors for reading in data from a file consisting of double values

  • 2D-array (random numbers)20:11

    In this session we generate 16 distinct random numbers and place these numbers into a two-dimensional array (4x4-grid)

  • Reading a csv-file into a vector of vector (string delimiter)21:29

    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

  • Energy conversion efficiency of different type of lights (OOP, csv file)59:02

    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.

  • Basal metabolic rate "BMR" (OOP)27:43

    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.

  • Hotel guests (OOP, vectors of objects)22:14

    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.

  • Weekly salaries (OOP, inheritance, static member variables)33:08

    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.

  • Linspace-method using arrays in C++19:43

    In this tutorial we create an array of 100 evenly spaced points between within the interval of 0 and 1.

  • Car dealer (virtual function | polymorphism)20:56

    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.

  • Transcript of records (Software Development, global arrays)49:22

    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.

  • Verification technique of algorithms (ancient Egyptian multiplication algorithm)19:09

    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++.

  • Bubble-sort algorithm (function pointer)17:14

    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.

  • Simpson's rule for definite integrals (typedef-construct, function pointer)21:48

    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.

  • Value table of two functions (array of function pointers)13:19

    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.

  • Richardson extrapolation method (function pointers)27:06

    This tutorial deals with the numerical differentiation of two trigonometric functions by employing the extrapolation method by Richardson.

  • Newton method (function pointer, inheritance, virtual function)40:48

    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.

  • Binomial coefficient (recursive vs. for-loop approach)21:30

    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.

  • Heapsort algorithm (make_heap(), sort_heap() and pop_heap() functions)25:11

    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.

  • Binomial distribution (recursive scheme)30:29

    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.

  • Normal (Gaussian) distribution32:18

    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.

  • Area of distinct figures (enum, struct)19:05

    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.

  • Linear and exponential fit using least squares method by Gauss59:05

    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.

  • Monte-Carlo simulation (Metropolis algorithm) of a 2D Ising lattice46:49

    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.

  • Matrix Class (OOP, 2D-array) Part 145:33

    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.

  • Matrix Class (OOP, 2D-array) Part 256:04

    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.

  • Quadratic Equations18:18

    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

Requirements

  • Installed and running version of Visual Studio
  • Basic knowledge in C++ is sufficient to be capable of following the content presented in the tutorials

Description

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!



Who this course is for:

  • Students of natural and engineering sciences