Skip to content

Commit a165060

Browse files
committed
add name property to FunctionSymbol
1 parent a7136d7 commit a165060

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

symengine/lib/symengine_wrapper.in.pyx

+4
Original file line numberDiff line numberDiff line change
@@ -2841,6 +2841,10 @@ class FunctionSymbol(Function):
28412841
name = deref(X).get_name().decode("utf-8")
28422842
return str(name)
28432843

2844+
@property
2845+
def name(Basic self):
2846+
return self.get_name()
2847+
28442848
def _sympy_(self):
28452849
import sympy
28462850
name = self.get_name()

symengine/tests/test_functions.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,15 @@ def test_derivative():
105105

106106
def test_function():
107107
x = Symbol("x")
108-
assert Function("f")(x) == function_symbol("f", x)
108+
fx = Function("f")(x)
109+
assert fx == function_symbol("f", x)
109110

110111
raises(TypeError, lambda: Function("f", "x"))
111112
raises(TypeError, lambda: Function("f", x))
112113
raises(TypeError, lambda: Function())
113114

115+
assert fx.name == "f"
116+
114117

115118
def test_abs():
116119
x = Symbol("x")

0 commit comments

Comments
 (0)