Skip to content

numerical integral needs an operand for callable symbolic functions #15219

Closed
@kcrisman

Description

@kcrisman

I feel like I've seen this before, so close if appropriate... See this ask.sagemath question.


sage: h(x) = x
sage: numerical_integral(h, 1, 2)
---------------------------------------------------------------------------
/Users/.../sage-5.11.rc0/local/lib/python2.7/site-packages/sage/symbolic/expression_conversions.pyc in fast_float(ex, *vars)
   1264         1.4142135623730951
   1265     """
-> 1266     return FastFloatConverter(ex, *vars)()
   1267 
   1268 #################

/Users/.../sage-5.11.rc0/local/lib/python2.7/site-packages/sage/symbolic/expression_conversions.pyc in __call__(self, ex)
    206         operator = ex.operator()
    207         if operator is None:
--> 208             return self.symbol(ex)
    209 
    210         if operator in arithmetic_operators:

/Users/.../sage-5.11.rc0/local/lib/python2.7/site-packages/sage/symbolic/expression_conversions.pyc in symbol(self, ex)
   1182             return self.ff.fast_float_constant(float(ex))
   1183         except TypeError:
-> 1184             raise ValueError, "free variable: %s" % repr(ex)
   1185 
   1186     def arithmetic(self, ex, operator):

ValueError: free variable: x |--> x

but

sage: numerical_integral(x, 1, 2)
(1.5, 1.6653345369377348e-14)

I think this should be easy to fix by catching this somehow.

Depends on #32234

CC: @eviatarbach @orlitzky @mkoeppe

Component: calculus

Author: Michael Orlitzky

Branch/Commit: d314399

Reviewer: Matthias Koeppe

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions