-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Fix issue #879: series of undefined functions. #1888
Conversation
You might also add a test for a subclass of Function, like class TestFunction(Function):
pass
TestFunction(x).series(x) |
@@ -483,7 +478,7 @@ def _eval_nseries(self, x, n, logx): | |||
s = s.removeO() | |||
s = s.subs(v, zi).expand() + C.Order(o.expr.subs(v, zi), x) | |||
return s | |||
if (self.func.nargs == 1 and args0[0]) or self.func.nargs > 1: | |||
if ((self.func.nargs == 1 or isinstance(self.func, UndefinedFunction)) and args0[0]) or self.func.nargs > 1: |
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.
Shouldn't this just go in the UndefinedFunction
class?
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.
UndefinedFunction is actually a metaclass, so I would have to mess with it a bit. OTOH, would it be really better to repeat most of the series logic in a different place? The algorithm as it is looks fine, I have to special-case it just because f(x).nargs == 1
but f.nargs is None
.
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.
I guess AppliedUndef then?
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.
Actually, from what you say, it sounds like what you really should be testing for is the nargs is None
case.
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.
So this seems to be wrong anyway. Try f(x, y).series(x)
.
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.
Yet f(x, y).series(y)
gives the right thing.
By the way, great to have you contributing again! |
Now we can use also >>> class TestF(Function): ... pass >>> TestF(x).series(x)
SymPy Bot Summary: 🔴 Failed after merging renatocoutinho/879b (3e9f0ad) into master (6faba52). |
SymPy Bot Summary: ✳️ Passed after merging renatocoutinho/879b (ca49718) into master (f556486). |
And I was expecting
for example
|
|
|
Can I check the status of this pull request, when do you think it will be added to master? |
SymPy Bot Summary: ❗ There were merge conflicts (could not merge renatocoutinho/879b (ca49718) into master (ec1ac09)); could not test the branch. |
Unless I misunderstand this issue, I think the O Subs thing can be postponed. I tested this branch, and it seems to work for functions of multiple variables. It just needs to be tested. So if someone wants to pick up work here, what needs to be done is to merge the branch with master, and add tests for functions of multiple variables. I think @renatocoutinho is busy, so if you want to pick up the work, just make a new branch based off this one and make a new pull request. |
SymPy Bot Summary: ❗ There were merge conflicts (could not merge renatocoutinho/879b (ca49718) into master (71a8f17)); could not test the branch. |
See #2224. |
No description provided.