2009/4/16 Jason Grout <jason-s...@creativetrax.com>:
>
> Ondrej Certik wrote:
>> Hi,
>>
>> I would expect this to work:
>>
>> sage: e = integrate(sqrt(x**3+1), x, 2, 10)
>> sage: e.n()
>> ---------------------------------------------------------------------------
>> TypeError                                 Traceback (most recent call last)
>>
>> /home/ondrej/<ipython console> in <module>()
>>
>> /home/ondrej/ext/sage-3.4.1.alpha0/local/lib/python2.5/site-packages/sage/calculus/calculus.pyc
>> in numerical_approx(self, prec, digits)
>>    1514         except TypeError:
>>    1515             # try to return a complex result
>> -> 1516             approx = self._complex_mpfr_field_(ComplexField(prec))
>>    1517
>>    1518         return approx
>>
>> /home/ondrej/ext/sage-3.4.1.alpha0/local/lib/python2.5/site-packages/sage/calculus/calculus.pyc
>> in _complex_mpfr_field_(self, field)
>>    1748
>>    1749     def _complex_mpfr_field_(self, field):
>> -> 1750         raise TypeError
>>    1751
>>    1752     def _complex_double_(self, C):
>>
>> TypeError:
>>
>>
>>
>> am I doing it the wrong way? With sympy:
>>
>>
>> sage: from sympy import var, integrate
>> sage: var("x")
>> x
>> sage: e = integrate(sqrt(x**3+1), (x, 2, 10))
>> sage: e.n()
>> 124.616199194723
>>
>>
>
>
> You didn't do anything wrong.  It should work.

I wouldn't necessarily say it "should work", since I'm sure nobody
implementing functionality so it should work, and it doesn't work like
this in Maxima (which Sage is just calling for this):


%maxima
integrate(sqrt(x^3+1),x,2,10), float
///
'integrate((x^3+1)^0.5,x,2,10)

It would be very nice to have this feature though!

 -- William

>
> See http://trac.sagemath.org/sage_trac/ticket/3863 for the same error.
> This has also come up in discussion recently (see the end of
> http://groups.google.com/group/sage-support/browse_thread/thread/65e7983e80a983e9/2cdd45aff55425d2?lnk=gst&q=numerical_approx+integral#2cdd45aff55425d2)
>
> Of course, the work around is to use nintegrate.  But I agree that what
> you did should work.  So...does anyone have a patch?
>
> Jason
>
>
> --
> Jason Grout
>
>
> >
>



-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to