finesse.simulations.graph.tools.expression_tuple_to_symbolic¶
- finesse.simulations.graph.tools.expression_tuple_to_symbolic(expr, optical_equations)[source]¶
- Converts an expression tuple to a symbolic expression using the provided optical equations. - Parameters
- exprtuple
- The expression tuple to be converted. 
- optical_equationsdict
- A dictionary containing the optical equations. 
 
- Returns
- finesse.symbols.Symbol
- The simplified symbolic expression. 
 
 - Notes - This function recursively converts an expression tuple into a symbolic expression using the provided optical equations. The expression tuple can contain operators such as ‘+’ and ‘*’, and operands that are either symbols or values. The optical equations dictionary maps symbols to their corresponding symbolic expressions. - Examples - >>> from finesse.symbols import Variable >>> optical_equations = {'a': Variable('a'), 'b': Variable('b')} >>> expr = ('+', ('*', 'a', 2), ('*', 'b', 3)) >>> expression_tuple_to_symbolic(expr, optical_equations) 2*a + 3*b