Matrix.mul_matrix

raytracing.Matrix.mul_matrix(self, rightSideMatrix: Matrix)

This function is used to combine two elements into a single matrix. The multiplication of two ABCD matrices calculates the total ABCD matrix of the system. Total length of the elements is calculated (z) but apertures are lost. We compute the first and last vertices.

Parameters:

rightSideMatrix (object from Matrix class) – including the ABCD matrix and other properties of an element.

Returns:

  • A matrix with

  • a (float) – Value of the index (1,1) in the ABCD matrix of the combination of the two elements.

  • b (float) – Value of the index (2,1) in the ABCD matrix of the combination of the two elements.

  • c (float) – Value of the index (1,2) in the ABCD matrix of the combination of the two elements.

  • d (float) – Value of the index (2,2) in the ABCD matrix of the combination of the two elements.

  • frontVertex (float) – First interface used for FFL

  • backVertex (float) – Last interface used for BFL

  • physicalLength (float) – Length of the combination of the two elements.

Examples

Consider a Lens (f=3) and a free space (d=2). The equal ABCD matrix of this system can be calculated as the following

>>> from raytracing import *
>>> # M1 is an ABCD matrix of a lens (f=3)
>>> M1= Matrix(A=1,B=0,C=-1/3,D=1,label='Lens')
>>> # M2 is an ABCD matrix of free space (d=2)
>>> M2= Matrix(A=1,B=2,C=0,D=1,label='freeSpace')
>>> print(M1.mul_matrix(M2)) #print the total ABCD matrix
|  1.000    2.000 |
|                 |
| -0.333    0.333 |
f=3.000

Notes

If there is more than two elements, the multplication can be repeated to calculate the total ABCD matrix of the system. When combining matrices, any apertures are lost.