-
-
Notifications
You must be signed in to change notification settings - Fork 68
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
No div
impl between numbers and polynomials
#93
Labels
Comments
That would be my expectation too. Does 0.5 register as exact now?
…On Tue, Aug 25, 2020 at 1:56 PM Sam Ritchie ***@***.***> wrote:
The following code, in a namespace with the proper imports like
sicmutils.simplify-test:
(sicmutils.simplify/hermetic-simplify-fixture
(fn []
(g/simplify
(g/mul 0.5
(g/div 1 (g/mul 2 'x))))))
Throws:
Execution error (Error) at (<cljs repl>:1).
No method in multimethod 'sicmutils.generic/div' for dispatch value: [#object[Number] :sicmutils.polynomial/polynomial]
Everything works if we use (/ 1 2) to generate a ratio. Do we want to
handle a floating point number here?
Well, of course we do. I guess I would expect here that maybe the
simplifier would do nothing, and return (/ 0.5 (* 2 x)).
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#93>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAB3Y7O4I4B7KGC52ZZS4UDSCQQQRANCNFSM4QLCQ2IA>
.
|
looks like it doesn't. I can try and dig in to where this multiplication is happening, too. possibly notable is that it times out, and only succeeds (with that error) when I wrap it with |
If memory serves the 0.5 should have been converted to a symbol by the
analyzer, so that it would form a rational function when divided by the
polynomial in the denominator. Then the backsubstition pass would replace
the symbol with 0.5 after we're done grinding through the simplification,
so we definitely don't need an implementation of the div.
…On Tue, Aug 25, 2020 at 3:04 PM Sam Ritchie ***@***.***> wrote:
looks like it doesn't. I can try and dig in to where this multiplication
is happening, too. possibly notable is that it times out, and only succeeds
(with that error) when I wrap it with hermetic-simplify-fixture. More
demons to chase!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#93 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAB3Y7LHUWZBWYYN6FCZDJLSCQYNXANCNFSM4QLCQ2IA>
.
|
Okay, I fixed this by adding an explicit implementation of (defmethod g/invert [::p/polynomial] [^Polynomial p]
(make (p/make-constant (.-arity p) 1) p)) |
Adding this to #169 . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The following code, in a namespace with the proper imports like
sicmutils.simplify-test
:Throws:
Everything works if we use
(/ 1 2)
to generate a ratio. Do we want to handle a floating point number here?Well, of course we do. I guess I would expect here that maybe the simplifier would do nothing, and return
(/ 0.5 (* 2 x))
.The text was updated successfully, but these errors were encountered: