The functions Assurance_WL(age, i=0.04)
and Annuity_WL(age, i=0.04)
are defined. The functions have attributes Assurance_WL.latex
and Annuity_WL.latex
which return the latex representation of these functions.
Given a string such as:
EL0 = '100000*Assurance_WL(55) - 2000*Annuity_WL(55, 0.065) + (1500 + 3000)/0.95'
I can use the eval function to compute the result.
However, to display these input expressions, I am trying to manipulate the above string to produce something like:
'100000*Assurance_WL.latex - 2000*Annuity_WL.latex + (1500 + 3000)/0.95'
The problem is that I need to remove the parenthesis from the function call which can be of varying lengths. I'm not sure what is the best way to achieve this.