Search⌘ K
AI Features

Solution Review: Setting Up an Optical System

Explore how to define and multiply system matrices for optical setups and solve associated linear equations using NumPy's linear algebra tools. Understand how eigenvalues and eigenvectors apply to optical systems. This lesson prepares you for further study on transfer functions.

Solution 1 #

Python 3.5
import numpy as np
C1 = np.array([[1, -1],[1, 0]])
C2 = np.array([[1, 1],[1, 0]])
C3 = np.array([[1, -1],[1, 1]])
C4 = np.array([[1, 0],[0, 1]])
C5 = np.array([[0, 1],[1, 1]])
C6 = np.array([[1, 0],[0, 1]])
arrs = [C1, C2, C3, C4, C5, C6]
system = np.array([[1, 0],[0, 1]]) # unit martrix
for i in range(len(arrs)):
system = np.dot(system, arrs[i])
print(system)

Explanation

  • In lines 3 - 8, we have defined the matrices C1C6C_1 - C_6 ...