4 ms·
Interesting approach. The use of a numerical solver for the indeterminate coefficients is clever, but also not without dangers. One major drawback is that it te
by mppm 5y ago
Interesting approach. The use of a numerical solver for the indeterminate coefficients is clever, but also not without dangers. One major drawback is that it tends to destroy the symbolic form of the coefficients. E.g., integrate(x^pi) will give 0.24145300700522387(x^4.141592653589793) rather than (x^(pi+1))/(pi+1). Another, more damaging, problem is that incorrect integrals can be found within the given tolerance. Trying a couple of examples from the Readme, I quickly ran into this: integrate(x^2/(16 + x^2)) with the default tolerance gives
0.0032(x^3) + 0.08374(x^2)*atan((-1//4)*x) + 0.61083x*log(16 + x^2) - 1.68734x - 0.09989x*((16 + x^2)^-1)
Only after manually setting a tighter tolerance is the correct result reported: x - 4 atan(x/4). The difference is not just cosmetic. Near zero both results are within tolerance, but the first result is very badly wrong for large x (try x=20).
- ChrisRackauckas 5y agoYes, the coefficient part is not great, though main thing though is getting candidates of the function form, from that using differentiation could be useful in re-deriving the coefficients. The fact that a tolerance is introduced into a symbolic method is a major downside to this approach. Using some alternative symbolic regression methods (i.e. https://datadriven.sciml.ai/dev/solvers/symbolic_regression/ https://datadriven.sciml.ai/dev/solvers/symbolic_regression/) could decrease this issue, though sparse regression finding the sparsest possible result is in general a hard problem. But note that our plan is not to use this in isolation. I think the final solution will make use of a polyalgorithm. Sparse regression is in the low-medium cost of cheapness, so a polyalgorithm that does simple rules, then if that fails this sparse regression, then if that fails a larger rule set (maybe through e-graphs), then if that fails use the Risch algorithm. That could be a robust algorithm that attempts to take some fast outs before progressively falling back to the slowest form. Tests just require differentiation and checking equality.
- mppm 5y ago> Tests just require differentiation and checking equality. Is that not implemented yet? I was wondering how a result with such an obviously incommensurate functional form could be produced.
- ChrisRackauckas 5y agoDifferentiation and equality checking through e-graphs/simplification is already supported. But it's not done automatically with the symbolic-numeric integration: you'd have to call it after the integration to check which terms are necessary. We could probably improve the algorithm by doing this automatically and then doing more trimming of some sort.