Skip to content

Have numerical evaluation of unevaluated integrals call numerical integral #3863

@dandrake

Description

@dandrake
----------------------------------------------------------------------
| SAGE Version 3.0.6, Release Date: 2008-07-30                       |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------

sage: x = var('x')
sage: integrate(x^2.7 * e^(-2.4*x), x, 0, 3).n()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

/home/drake/sage-3.0.6.final/<ipython console> in <module>()

/home/was/s/local/lib/python2.5/site-packages/sage/calculus/calculus.py in numerical_approx(self, prec, digits)
   1266         except TypeError:
   1267             # try to return a complex result
-> 1268             approx = self._complex_mpfr_field_(ComplexField(prec))
   1269 
   1270         return approx

/home/was/s/local/lib/python2.5/site-packages/sage/calculus/calculus.py in _complex_mpfr_field_(self, field)
   1419 
   1420     def _complex_mpfr_field_(self, field):
-> 1421         raise TypeError
   1422 
   1423     def _complex_double_(self, C):

TypeError: 
sage: 

Oddly, the plot function has no difficulty, so some part of Sage can numerically evaluate the function:

plot(x^2.7 * e^(-2.4*x), x, 0, 3)

works fine.

Some values for the exponents do work -- it seems like the exponent of x needs to be an integer or half-integer:

(2.7, -2.4): this is the above example
(27/10, -2.4): same error as above
(1.5, -2.4): works
(1.6, -2.4): same error as above
(1.6, -2.0): same error as above
(1.0, -2.4): works
(5.5, -2.4): works

Component: calculus

Keywords: integration integral calculus symbolic numerical

Author: Golam Mortuza Hossain, Burcin Erocal

Reviewer: Dan Drake

Merged: sage-4.4.alpha0

Issue created by migration from https://trac.sagemath.org/ticket/3863

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions