Calculus.jl
Calculus.jl copied to clipboard
Simplify(::Expr) failed
in v0.1.5
simplify can not handle Float64(NaN)
check this code
using calculus
simplify(:(1-0/0))
thanks
If you need this working, feel free to submit a PR. It's not really clear what 0/0 should be simplified to though. NaN is a floating-point value, not a symbolic value.
I also happen to run into this problem (more exactly, it seems to get stuck indefinitely). To me it looks like it could be due to the loop
while new_ex != ex
new_ex, ex = simplify(new_ex), new_ex
end
that because of
julia> NaN != NaN
true
should cause an infinite loop. It might be sufficient to change it to a while !(isequal(new_ex, ex)) since
julia> isequal(NaN,NaN)
true
Will try and test this in the next few days and make a PR if it works (unless someone beats me to to it).
That seems reasonable. Please do try that. Such a small change can be made into a PR by just editing the file in GitHub, which will handle everything for you including submitting the PR and running the tests.