Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit ff8c672

Browse files
committed
24832: Extend function domain with some symbolic function calls
1 parent 93020a4 commit ff8c672

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/sage/symbolic/function.pyx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,13 @@ cdef class Function(SageObject):
469469
# [e^x 0]
470470
# [ 0 -1]
471471
if len(args) == 1:
472-
method = getattr(args[0], self._name, None)
472+
arg = args[0]
473+
try:
474+
if self.extend_for(arg):
475+
arg = parent(arg).complex_field()(arg)
476+
except AttributeError:
477+
pass
478+
method = getattr(arg, self._name, None)
473479
if callable(method):
474480
return method()
475481
raise TypeError("cannot coerce arguments: %s" % (err))
@@ -982,6 +988,11 @@ cdef class BuiltinFunction(Function):
982988
# then try to see whether there exists a method on the object with
983989
# the given name
984990
arg = py_scalar_to_element(args[0])
991+
try:
992+
if self.extend_for(arg):
993+
arg = parent(arg).complex_field()(arg)
994+
except AttributeError:
995+
pass
985996
method = getattr(arg, self._name, None)
986997
if method is None and self._alt_name is not None:
987998
method = getattr(arg, self._alt_name, None)

0 commit comments

Comments
 (0)