I have the mathematical expression |z - (-1)| < 1
, with z
element of Complexes, which is equivalent of a circle of radius 1 centered in (x,y)=(-1,0)
.
What I tried so far:
using ImplicitEquations, Plots
f(a,b) = abs.(a+im*b - (-1))
plot(f<1)
The error I got:
ERROR: MethodError: no method matching isless(::typeof(f), ::Int64)
Closest candidates are:
isless(::Union{StatsBase.PValue, StatsBase.TestStat}, ::Real) at /home/buddhilw/.julia/packages/StatsBase/PGTj8/src/statmodels.jl:514
isless(::AbstractGray{T} where T, ::Real) at /home/buddhilw/.julia/packages/ColorTypes/6m8P7/src/operations.jl:31
isless(::ForwardDiff.Dual{Tx, V, N} where {V, N}, ::Integer) where
Tx at /home/buddhilw/.julia/packages/ForwardDiff/UDrkY/src/dual.jl:144
...
Stacktrace:
[1] <(x::Function, y::Int64)
@ Base ./operators.jl:279
[2] top-level scope
@ REPL[62]:1
There's not a lot of documentation for ImplicitEquations, but something stands out: you're not using the right operators. The package relies on unusual operators to represent math expressions with Julia functions: ≪ (\ll[tab]), ≦ (\leqq[tab]), ⩵ (\Equal[tab]), ≶ (\lessgtr[tab]) or ≷ (\gtrless[tab]), ≧ (\geqq[tab]), ≫ (\leqq[tab]).
So that fix would look like:
using ImplicitEquations, Plots
f(a,b) = sqrt((a+1)^2 + b^2)
plot(f ≪ 1)
Update:
f(a,b) = abs(a + im*b - (-1))
causes a method ambiguity error. f(a, b) = hypot(a+1, b)
, which is what abs
calls, also causes the error. It looks like the issue is that at some point in hypot
, OInterval(x::Ointerval)
is called, but dispatch could not pick between (::Type{T})(x::T) where T<:Number
in boot.jl
or OInterval(a)
in intervals.jl
. Just redefining OInterval(a::Ointerval) = a
won't work either because you run into another MethodError
for decompose(::OInterval)
, which is a method intended for processing floats. Looking at the comments in intervals.jl
, the dispatch seems like a work in progress.