Thanks for the explanation. The problem might actually be fixed in newer versions of sage. I am working with v5.0, since it was the only one I found on the couple of mirrors where I looked and I figured what the heck. Anyway, I'll try your solution, thanks again. On Thursday, August 9, 2012 8:14:20 PM UTC+2, Robert Dodier wrote:
> On 2012-08-08, uwe.schilling <uwe.sc...@semikron.com <javascript:>> > wrote: > > > RuntimeError: ECL says: In function ZEROP, the value of the only > argument is > > > > > ((RAT SIMP) -0.064 1.0) > > > > > which is not of the expected type NUMBER > > > > > > > > I already figured out that the problem is the decimal number. If I > replace > > 0.064 by 64, it works fine again. However, I don't understand where the > > problem is coming from. Sage is in general able to handle decimal > numbers. > > Why not in this case? > > Sage calls Maxima to compute non-numerical integrals. The error you see > originates in Maxima. The bug may be fixed in a later version of Maxima > than that packaged in your version of Sage -- while working on your > problem, I haven't bumped into it. > > Maxima prefers to work with integers or rational numbers instead of > floats -- all of its symbolic computation assumes integers or rationals. > So for any symbolic stuff it's best to avoid floats. > > For the record, here's what I get. I found Maxima cannot solve the > integral with explicit numerical values -- it goes off and thinks for a > long time; I suspect it is trying to factor a big expression -- so I > substituted symbols for the numbers. I tried to tell Maxima something > about the relative magnitude of the numerical constants; as it happens, > Maxima's "assume" system isn't very strong. I'm working with the > current development version. > > (%i1) display2d : false $ > > (%i2) e : exp (-a / (-b * x + c)) $ > > (%i3) assume (a > c, c > b, b > 0) $ > > (%i4) integrate (e, x, 0, 120); > > Is %e^(a/(c-120*b))-%e^(a/c) positive, negative, or zero? > > p; > Is %e^(a/(c-120*b))-1 positive, negative, or zero? > > p; > Is c-120*b positive or negative? > > p; > STYLE-WARNING: redefining MAXIMA::SIMP-UNIT-STEP in DEFUN > STYLE-WARNING: redefining MAXIMA::SIMP-POCHHAMMER in DEFUN > Is c-120*b positive or negative? > > p; > (%o4) > -a*(log(a/(c-120*b))-log(-a/(c-120*b))/2+expintegral_ei(-a/(c-120*b)) > +log(-(c-120*b)/a)/2 > -%e^-(a/c)*(a*%e^(a/c)*log(-c/a) > +(2*a*log(a/c)-a*log(-a/c) > > +2*a*expintegral_ei(-a/c)) > *%e^(a/c)+2*c) > /(2*a)+(c-120*b)*%e^-(a/(c-120*b))/a) > /b > (%i5) float (%o4), a = 300, b = 64/1000, c = 14; > > (%o5) -4687.5*(-8.232626698052029e-13*(2.0244652500289204e+9 > *(1838.835087011327 > -300.0 > *(3.141592653589793*%i > +3.064725145040943)) > +6.073395750086762e+11 > *(3.141592653589793*%i > -3.064725145040943)+28.0) > -0.5*(3.141592653589793*%i+3.860063266497435) > > +0.5*(3.141592653589793*%i-3.860063266497435)+3.860063266497435) > (%i6) expand (%); > > (%o6) 4.6287797890697047e-9 > > > If you only need a numerical approximation, you can go straight for > that. Maxima has the QUADPACK functions (Sage does too). > > (%i7) quad_qags (e, x, 0, 120), a = 300, b = 64/1000, c = 14; > > (%o7) [4.6277003981664117e-9,8.034599325134321e-23,21,0] > > > For better or worse, symbolic integration is still a hard problem -- > hard enough, anyway, that the user has to help the computer along. > > All the best, > > Robert Dodier > > -- -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org