Yes, I think we have a misunderstanding. I use Maxima actively, but I do not want to include its calculations in my document. Really, what I'd like specifically is:
1. LaTeX document
2. Ability to define macros locally and more easily. For me, a macro is most of the time just easy textual substitution. However, there are times when I want to generate a piece of text repeatedly with some mild variations.
And, look, LaTeX does most of these things, but there's a huge amount of redundancy when writing up a math document. We sort of get away with things by labeling equations with numbers and referring back to them, but this is largely a remnant from the physical typesetting days when repeatedly typesetting the same expression was laborious and error prone. When we build up a completed theorem from a discussion, I don't want to refer back to old expressions, I want to repeat everything I have there. It creates a contained presentation for the reader. It's easier for everyone, including me, to refer back to later. I should not have to retype everything to do this. TeX is basically a programming language. I should be able to locally define functions and call them when I need them. My complaint with TeX is that it doesn't make this usage all that easy to accomplish and it's, frankly, not all that much to ask for.
---
Edit 1
---
One concrete example that I'm typing up now: I'm currently typing up some circuit equations from some project. We have a three-phase inverter, so we used a dq0 transformation to simplify things. The equations been the d and q axis are basically the same except for some differences in the subscripts (some are d, some are q, sometimes we reverse things.) In a reasonable programming language, I could just write a function to swap back and forth and code the equations once. When I implement things, that's what I do. When I type them in LaTeX, I type them twice. I shouldn't have to.
If I understand you correctly, you can in LaTeX. \newcommand can be used before \begin{document}, sure, but it really can be used everywhere. The only catch is that the resulting definitions are global, and I know (as a programmer and mathematician) that this is all sorts of bad, but it's workable. It's definitely not an excuse to repeat yourself everywhere. ;)
Ha! I actually didn't know they could be defined locally, so that does help. Thanks! There really are a bunch of little things like this, like looping over subscripts, that would be nice as well. LuaTeX may make these easy, but, again, I've not had experience with it, so I'm not sure.
1. LaTeX document
2. Ability to define macros locally and more easily. For me, a macro is most of the time just easy textual substitution. However, there are times when I want to generate a piece of text repeatedly with some mild variations.
And, look, LaTeX does most of these things, but there's a huge amount of redundancy when writing up a math document. We sort of get away with things by labeling equations with numbers and referring back to them, but this is largely a remnant from the physical typesetting days when repeatedly typesetting the same expression was laborious and error prone. When we build up a completed theorem from a discussion, I don't want to refer back to old expressions, I want to repeat everything I have there. It creates a contained presentation for the reader. It's easier for everyone, including me, to refer back to later. I should not have to retype everything to do this. TeX is basically a programming language. I should be able to locally define functions and call them when I need them. My complaint with TeX is that it doesn't make this usage all that easy to accomplish and it's, frankly, not all that much to ask for.
--- Edit 1 ---
One concrete example that I'm typing up now: I'm currently typing up some circuit equations from some project. We have a three-phase inverter, so we used a dq0 transformation to simplify things. The equations been the d and q axis are basically the same except for some differences in the subscripts (some are d, some are q, sometimes we reverse things.) In a reasonable programming language, I could just write a function to swap back and forth and code the equations once. When I implement things, that's what I do. When I type them in LaTeX, I type them twice. I shouldn't have to.