course content

Course Content

R Introduction: Part I

Complex NumbersComplex Numbers

Complex numbers have a significant role in various advanced fields such as quantum mechanics, signal processing, and physics, intertwining with calculus.

While this course focuses on the foundational elements of R, it's important to at least acknowledge complex numbers as a numerical type within R's language. A complex number is composed of a real part (denoted as a) and an imaginary part (denoted as b). This forms an expression a+bi, which we call a complex number, where i represents the imaginary unit with the property that i^2 = -1.

To represent a complex number in R, you would use the notation a + bi. For instance, we can create a complex number where the real part is 5 and the imaginary part is -3.

Remember that the arithmetic operations we've learned can be applied to all the types of numbers we've discussed.


  1. Declare an integer number 20 and assign it to the variable num.
  2. Create a complex number with a real part of 10 and an imaginary part of -5 and assign it to the variable compl.
  3. Perform an addition operation between num and compl and assign the result to res.
  4. Determine and display the type of res.

Since adding an integer to a complex number results in a complex number, the type of res is "complex". This is because complex numbers include real numbers and integers within their broader numerical system.

Everything was clear?

Section 2. Chapter 3
toggle bottom row