On Tue, 13 Dec 2011 at 06:38PM -0800, kcrisman wrote: > > Proposed bugfix: symbolic integration should reject floats. > > Yikes! So we wouldn't want > > sage: integrate(1.0*x,x,0,2) > 2 > > to work any more? (Pace the error messages below.) > > Could we not instead try to catch this kind of error and recommend to > the user that they use rationals? Or something...
As long as there are informative error messages, I don't think I'd mind too much. In that case, I would also want some kind of rational approximation method for symbolic expressions: something like (1.0*x^2).float_coeffs_to_rational() becoming 1*x^2. This could just run exact_rational() or simplest_rational() on the float coefficients, perhaps with a keyword to select what you want. I would consider defaulting to simplest_rational() because of things like this: sage: (1/3).n().exact_rational() 6004799503160661/18014398509481984 I should mention that this entire thing got started when I took my f() function and tried to use list_plot to see what was happening as you vary the coefficients: I did something like [integrate(f(a, 1, t), (t, 0, 2*pi)) for a in srange(1, 2, .1)] and it failed right away. Dan -- --- Dan Drake ----- http://mathsci.kaist.ac.kr/~drake -------
signature.asc
Description: Digital signature