-
Notifications
You must be signed in to change notification settings - Fork 67
Make Basic.has behave more like SymPy, use new visitor #521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
3a85f67
e58bb98
6f30caa
e2e4899
a9389cd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1187,8 +1187,11 @@ cdef class Basic(object): | |
cdef Basic _n = sympify(n) | ||
return c2py(symengine.coeff(deref(self.thisptr), deref(_x.thisptr), deref(_n.thisptr))) | ||
|
||
def has(self, *symbols): | ||
return any([has_symbol(self, symbol) for symbol in symbols]) | ||
def has(self, *args): | ||
for arg in args: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The loop here begs the question: |
||
if has_basic(self, arg): | ||
return True | ||
return False | ||
|
||
def args_as_sage(Basic self): | ||
cdef symengine.vec_basic Y = deref(self.thisptr).get_args() | ||
|
@@ -4945,6 +4948,11 @@ def powermod_list(a, b, m): | |
s.append(c2py(<rcp_const_basic>(v[i]))) | ||
return s | ||
|
||
def has_basic(obj, looking_for=None): | ||
cdef Basic b = _sympify(obj) | ||
cdef Basic s = _sympify(looking_for) | ||
return symengine.has_basic(deref(b.thisptr), deref(s.thisptr)) | ||
|
||
def has_symbol(obj, symbol=None): | ||
cdef Basic b = _sympify(obj) | ||
cdef Basic s = _sympify(symbol) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
c9510fb4b5c30b84adb993573a51f2a9a38a4cfe | ||
10d3591214e3f5906106f35ed19b6428b3fd86a3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not export
has_basic
and use.has