-
-
Notifications
You must be signed in to change notification settings - Fork 205
Implement Wolfram's Root builtin #806
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
Conversation
|
Hi @GarkGarcia cool! |
|
@wolfv It looks like all tests are passing, but for some reason the |
|
|
Those are the only tests that fail (besides a bunch of unrelated stuff). |
|
is it possible that another version of root is implemented somewhere else? Did you CTRL+F for it? |
I haven't. Just tried pressing |
|
ah sorry, I meant to search the entire source code for "Root" (CTRL+F on linux is the shortcut to "search-in-page"). |
This is the output of searching for "Root" with In other words, |
|
Just found out what the error was. As one might expect, it's one of those silly errors that are a pain to debug. Apparently the way Mathics patterns are generated from builtin classes is via the docstring of their |
|
Apparently there's only one test that isn't passing (which has nothing to do with this PR). The only thing left to address is that fact that Wolfram's
I don't know how much of slot is implemented in Mathics and how could I convert a regular (univariate) equation to this format. |
|
@weakit Perhaps you could help me understand what slot is all about. |
…ics indeces start from 1" This reverts commit de25906.
Slot is used to represent the arguments of a function. So say you have a function f(x, y) = x² + y + 1, if Root represents the function I remember that mathics did have Slot[], but I don't remember if it worked properly. Try looking for it. This is the way I understand it. It may be a bit off (?) so make sure to go through the documentation once. Try going through these: |
I see. @wolfv How do I appropriately convert between a |
|
The most straightforward way it to encode |
… simple polynomials
Seems a bit hacky but it works well enough 😋️ Alright, I've made it so that |
|
You need to fix the tests though. |
|
@suhr The |
|
great! thanks!! |
This is a follow up to #801, an implementation of Wolfram's
Root. The implementation is pretty simple, it's a wrapper for SymPy'sCRootOf.If SymPy can represent the
CRootOfinstance with radicals thenRootresolves to the radical representation:Otherwise,
Rootresolves to itself:I think a got everything working, but I was not able to test my implementation. I'm not sure how testing works in this project.
Relevant Links:
CRootOf: https://docs.sympy.org/latest/modules/solvers/solvers.html#algebraic-equationsCRootOf: https://stackoverflow.com/a/36847486