-
-
Notifications
You must be signed in to change notification settings - Fork 126
Closed
Description
If I execute
# Half-life of radiocarbon, in thousands of years
c = 5.730 ± 0.040
#Setup
u₀ = 1 ± 0
tspan = (0 ± 0, 1 ± 0)
#Define the problem
radioactivedecay(u,p,t) = -c * u
#Pass to solver
prob = ODEProblem(radioactivedecay, u₀, tspan)
sol = solve(prob, Tsit5())
in Julia 1.0 I get:
MethodError: Measurement{Float64}(::Rational{Int64}) is ambiguous. Candidates:
(::Type{Measurement{T}})(x::S) where {T, S} in Measurements at C:\Users\carsten\.julia\packages\Measurements\57KtG\src\Measurements.jl:61
(::Type{T})(x::Rational{S}) where {S, T<:AbstractFloat} in Base at rational.jl:90
Possible fix, define
(::Type{Measurement{T}})(::Rational{S})
Stacktrace:
[1] #__init#203(::Int64, ::Array{Measurement{Float64},1}, ::Array{Measurement{Float64},1}, ::Array{Measurement{Float64},1}, ::Nothing, ::Bool, ::Nothing, ::Bool, ::Bool, ::Nothing, ::Bool, ::Bool, ::Measurement{Float64}, ::Bool, ::Rational{Int64}, ::Nothing, ::Nothing, ::Int64, ::Rational{Int64}, ::Int64, ::Int64, ::Rational{Int64}, ::Bool, ::Int64, ::Nothing, ::Nothing, ::Int64, ::Measurement{Float64}, ::Float64, ::typeof(DiffEqBase.ODE_DEFAULT_NORM), ::typeof(LinearAlgebra.opnorm), ::typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), ::typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK), ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Int64, ::String, ::typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), ::Nothing, ::Bool, ::Bool, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::typeof(DiffEqBase.__init), ::ODEProblem{Measurement{Float64},Tuple{Measurement{Float64},Measurement{Float64}},false,Nothing,ODEFunction{false,typeof(radioactivedecay),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Nothing,DiffEqBase.StandardODEProblem}, ::Tsit5, ::Array{Any,1}, ::Array{Any,1}, ::Array{Any,1}, ::Type{Val{true}}) at C:\Users\carsten\.julia\packages\OrdinaryDiffEq\nZPqS\src\solve.jl:80
[2] __init(::ODEProblem{Measurement{Float64},Tuple{Measurement{Float64},Measurement{Float64}},false,Nothing,ODEFunction{false,typeof(radioactivedecay),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Nothing,DiffEqBase.StandardODEProblem}, ::Tsit5, ::Array{Any,1}, ::Array{Any,1}, ::Array{Any,1}, ::Type{Val{true}}) at C:\Users\carsten\.julia\packages\OrdinaryDiffEq\nZPqS\src\solve.jl:61
[3] #__solve#202(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::ODEProblem{Measurement{Float64},Tuple{Measurement{Float64},Measurement{Float64}},false,Nothing,ODEFunction{false,typeof(radioactivedecay),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Nothing,DiffEqBase.StandardODEProblem}, ::Tsit5, ::Array{Any,1}, ::Array{Any,1}, ::Array{Any,1}, ::Type{Val{true}}) at C:\Users\carsten\.julia\packages\OrdinaryDiffEq\nZPqS\src\solve.jl:6
[4] __solve(::ODEProblem{Measurement{Float64},Tuple{Measurement{Float64},Measurement{Float64}},false,Nothing,ODEFunction{false,typeof(radioactivedecay),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Nothing,DiffEqBase.StandardODEProblem}, ::Tsit5, ::Array{Any,1}, ::Array{Any,1}, ::Array{Any,1}, ::Type{Val{true}}) at C:\Users\carsten\.julia\packages\OrdinaryDiffEq\nZPqS\src\solve.jl:6 (repeats 5 times)
[5] #solve#429(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::ODEProblem{Measurement{Float64},Tuple{Measurement{Float64},Measurement{Float64}},false,Nothing,ODEFunction{false,typeof(radioactivedecay),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Nothing,DiffEqBase.StandardODEProblem}, ::Tsit5) at C:\Users\carsten\.julia\packages\DiffEqBase\b3iNk\src\solve.jl:29
[6] solve(::ODEProblem{Measurement{Float64},Tuple{Measurement{Float64},Measurement{Float64}},false,Nothing,ODEFunction{false,typeof(radioactivedecay),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Nothing,DiffEqBase.StandardODEProblem}, ::Tsit5) at C:\Users\carsten\.julia\packages\DiffEqBase\b3iNk\src\solve.jl:21
[7] top-level scope at In[6]:13
Metadata
Metadata
Assignees
Labels
No labels