This script will match twiss functions and magnetic elements for designing lattices. It uses linear matrix transport of Courant-Snyder parameters(3x3) linear matrix for matching drift lengths, quadrupole focusing strengths, solenoid focusing strengths as well as find the optimal twiss functions. It uses the following formalism:
The transformation of optic functions are given as:
Where,
Where,