using ApproxFun,RatFun
function mwe()
t = Fun(identity,0..pi)
f = (2-2*cos(t))^2
g = 2-2*cos(t)
r = f//g
display(roots(f-3.5))
display(roots(g-3.5))
display(roots(r-3.5))
end
julia> mwe()
1-element Array{Float64,1}:
1.5061656879014247
1-element Array{Float64,1}:
2.41885840577638
ERROR: MethodError: no method matching -(::RationalFun{Fun{Chebyshev{Interval{:closed,:closed,Float64},Float64},Float64,Array{Float64,1}},Fun{Chebyshev{Interval{:closed,:closed,Float64},Float64},Float64,Array{Float64,1}}}, ::Float64)
Closest candidates are:
-(::Float64, ::Float64) at float.jl:397
-(::Complex{Bool}, ::Real) at complex.jl:298
-(::Missing, ::Number) at missing.jl:93
julia> versioninfo()
Julia Version 1.0.3
Commit 099e826241 (2018-12-18 01:34 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i5-4200U CPU @ 1.60GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-6.0.0 (ORCJIT, haswell)
Can not use
roots()on a rational function.MWE:
Output: