simple integrals
- To: mathgroup at yoda.physics.unc.edu
- Subject: simple integrals
- From: Pekka.Janhunen at fmi.fi
- Date: Mon, 19 Apr 1993 11:57:28 -0800
Referring to the discussion about why Mma is slow in pulling out the constant of some simple integrals like Integrate[ c z^-(1/2), dz]. The same problem has to do with Solve and similar functions also. Dave Withoff wrote "...There is a tradeoff between general algorithms that can handle constants no matter where they appear, and fast special case code to handle situations in the constants can be handled very crudely (knowing nothing more than that they are constant)." Wouldn't it be feasible to write a preprocessor that replaces every subexpression not depending on the integration (or solved-for) variables by a temporary symbol (constant). This preprocessor could then be called by Integrate and Solve prior they do anything else. The resulting variable bindings must be saved, and after integration or equation solving, the reverse substitutions have to be made. Perhaps the preprocessor would avoid replacing very simple subexpressions such as a^2. I once implemented such a scheme, and it indeed worked and speeded things up in cases like above. But as I didn't want to modify the definitions of Integrate and Solve, the preprocessor had to be called explicitly, making its use inconvenient. The possible drawback with such a strategy is that by giving subexpressions new names, information about the sign etc. may disappear. But Mma is presently not good at using this kind of information anyway, and surely the preprocessor could also be programmed to overcome this problem in many cases. I think that implementing some kind of strategy of this kind would greatly enhance Mma's usefulness in the area it is best suited for, namely 'bookkeeping' of variables and handling large expressions. Pekka Janhunen