Hacker News new | ask | show | jobs
by teraflop 3730 days ago
Awesome!

Not knowing much about how a CAS is implemented, I'm curious -- what is it that causes the integration demo to take so much longer than the other examples? Does it have to do some kind of search to find the correct sequence of manipulations?

2 comments

I'm not sure what method this system uses for definite integration, but it is likely one of Simpsons, Gaussian, and Clenshaw-Curtis. These are numerical methods that, for the best accuracy, require lots of steps of evaluation. Depending on the error bounds you want, it could take a while.

Edit: also the nonlinear square root term may cause difficulty.

People might find this interesting: Maple uses Clenshaw Curtis as the default, but will switch dynamically to Gaussian if singularities are detected.

This would be relevant to numerical integration.

However, as it gives as answer some multiple of pi, it must've performed symbolic integration, which also suits the general design of the library better. There are some methods for performing symbolic integration but often trial and error with lookup tables and tricks (substitution etc) is faster.

Yeah, actually using the Risch algorithm is usually a last resort in a lot of CAS' because it's fairly intensive and also will often produce answers in a form very different from what a human would give. It's also famously difficult to implement, so if this library is using it without a thick layer of tricks and heuristics then that's probably where the slowness comes from.
The one that takes the longest is a double integral. That's the volume under a surface rather than the area under a curve. Frankly I don't know if that's any sort of explanation...