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
Find_root bug #3980
Comments
comment:2
I have a less obscure example of this.
And I have traced down the bug to this:
Since these expressions contain no variables they are deemed constant and since they are not equal to 0 they have no roots. You can fix your example by trying:
Also note that this works:
Although, technically no variables are there to be replaced. I don't know if this is really a bug or not, or how to fix it. |
comment:3
The problem is that find_root is asking the wrong question of its first argument. It asks "what are your variables?" Instead, it should ask "do you return a number when called with one argument?" I will try to code this up when I get a chance. |
comment:4
Here's a patch that avoids asking the function what it's variables are. |
comment:5
Somehow this is now too permissive, since the following should return an error:
|
Attachment: 3980.patch.gz |
comment:6
Good catch mhampton. I modified the patch to throw a NotImplementedError if self.number_of_variables() is greater than 1. This is closer to the old behavior. I added a new test to explicitly check the case you gave above. |
comment:7
OK, this passes tests and it seems OK. One thing I noticed, which I think can be considered beyond the scope of this patch, is that
quickly fails with "ValueError: free variable: x", which is good, but:
tries to plot 400 values and finally gives
and an empty plot. It would be nice to speed up that failure if you know an easy way. |
comment:8
Merged in Sage 3.1.3.alpha3. |
The reciprocal of tangent is not a constant function, but Sage says otherwise.
Component: calculus
Issue created by migration from https://trac.sagemath.org/ticket/3980
The text was updated successfully, but these errors were encountered: