I have had good results doing bidirectional programming in Tex <=> Python.
Can you give more details? I'm curious
Give it a try, have it teach you tex for the summation notation, have it write the code, modify the code, have it translate back to tex. Repeat.
You can do a quick test to see which models have been trained on tex.
Keep a tex visualizer handy.