Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.



Panel
borderColor#dfe1e5
bgColor#eff9ff
borderWidth2
titlePage content

Table of Contents


Determinant

Exercise 1: Complex numbers

Expand
titleExercise 1: Complex numbers

This example is taken from an example exam in TMA4110 - Calculus 3, check out the exam and the solution for hand calculations (only in norwegain). This is task 4.

Comput the determinant


Code Block
languagepy
titleSolution 1: Complex Numbers
collapsetrue
import numpy as np 

# Defining the matrix
# Notice how we can define complex numbers in python by adding the letter "j"
# "j" is used to denote an imaginary unit instead of "i", because Python follows engineering,
# where "i" denotes the electric current as a function of time (especially electrial engineering)
A = np.array([[3, 1-1j, 1j, 4],
            [3, 1, 1-2j, 4+7j],
            [6j, 2+2j, -2, 3j],
            [-3, -1+1j, 1, 3-4j]], dtype=complex)

det = np.linalg.det(A)
print(det)


# Output:
(-15-15j)   # e.i. det(A) = -15-15i





BibTeX Display Table