On Jan 23, 6:06 am, kcrisman <[email protected]> wrote: > Concluding unscientific postscript: > > This brings up a question I have asked before, about when to use > (e.g.) _fast_float_ or polynomial rings or whatever... Is there a > heuristic for when this should be done in *ordinary* code, i.e. not > intended for inclusion in Sage and maybe even written in five minutes > for class? It's clearly not always worth it or it would be > ubiquitous, and I am puzzled as to why I needed it here (only 49 > points, right?).
There's actually a couple of questions here: when is it worth it, and when is it safe? It looks like substitution for maxima-based symbolics is so pathetically slow (calling into maxima) that _fast_float_ would always be worth it. But there's a good reason not to do it automatically, anyway: it wouldn't be safe. _fast_float_ is safe in your example, since you're doing arithmetic with not-huge integers, and floating-point numbers can do arithmetic with not-huge integers exactly. But with a slight variant of your problem that involved division or rational numbers, changing to _fast_float_ could change the answers you get. So, unfortunately, we can't just automatically use it every time you do a symbolic function call. I wonder if the very-slow times here are a bug... it looks like there's code in calculus.py that's supposed to be able to do this sort of thing without calling out to maxima, so I'm not sure why it's using maxima at all. If that is a bug, and the bug were fixed, then it might turn out that _fast_float_ is only worth it if you're evaluating the function a dozen times, or a hundred times, or something. > Let me put it a slightly more pungent way, with respect. Suppose I am > potential educational Sage user X, with not much time or programming > experience but willing to try anything if it might help. I try the > thing in the first email, and it really bites. Since I am only a > potential Sage user, and I am not likely to email the support list > (there are a lot of these, in my anecdotal experience), I just decide > Sage isn't very useful for me and stick with my other options - > whether those are Ms or just not using computers in class, which after > all worked quite well for hundreds of years. Will the pynac symbolics > take away all my problems, or will I still have to add this > (completely incomprehensible to my students) _fast_float_ thing, and > only that if I am persistent enough to find it by searching this > group, the wiki, or the documentation for quite a while (assuming I > didn't know that I was looking for something like this ahead of time)? It's clear that the present situation is not ideal. I doubt if pynac symbolics will fix all your problems (for instance, if your car makes a funny noise whenever you go over 50mph, I don't think pynac symbolics will help). Since I don't know what all your problems are, let me focus on occasionally very slow symbolic computations in Sage. I can see a few possible solutions here: 1) try to educate users to avoid the symbolics subsystem (use polynomial rings, etc., instead) 2) make symbolic computations avoid maxima more (switch to pynac, or fix bugs in calculus.py, if indeed there's a bug there) 3) I'm (still!) rewriting fast_float; one of the goals of the eventual rewrite is to have a mode that uses Sage objects instead of floating- point numbers (of course, this is much, much slower than the floating- point mode, but it's still quite a bit faster than calling out to maxima). If I ever finish the rewrite, then perhaps symbolic functions could use this mode automatically. 4) try to educate users more about _fast_float_ (better documentation, etc.) I don't know; does this answer your question at all? Carl --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---
