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.

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


--~--~---------~--~----~------------~-------~--~----~
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