I have the mathematical expression |z - (-1)| < 1
|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) = abs(a + im*b - (-1))
plot(f ≪ 1)
Update:
The above causes a method ambiguity error, even though you had already refactored a complex function to a 2D Cartesian one. f(a, b) = hypot(a+1, b)
, which is more or less what abs
does, also causes the error. This does work:
f(a, b) = sqrt((a+1)^2 + b^2)
, but we're already way past preserving your original expression's structure.
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
, this seems like a work in progress.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.