Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work in DifferentialEquations #85

Closed
isentropic opened this issue Jan 11, 2019 · 3 comments
Closed

Doesn't work in DifferentialEquations #85

isentropic opened this issue Jan 11, 2019 · 3 comments

Comments

@isentropic
Copy link

Following the example given here

https://github.com/JuliaDiffEq/DiffEqTutorials.jl/blob/master/ExtraODEFeatures/Solving%20Equations%20in%20With%20Julia-Defined%20Types.ipynb

With
Julia version

   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.0.3 (2018-12-18)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

Julia status

julia> Pkg.status()
    Status `~/.julia/environments/v1.0/Project.toml`
  [7e558dbc] ArbNumerics v0.2.6
  [55939f99] DecFP v0.4.7
  [225cb15b] DiffEqTutorials v0.0.0 #master (https://github.com/JuliaDiffEq/DiffEqTutorials.jl)
  [0c46a032] DifferentialEquations v5.3.1
  [ffa9a821] DocumentFormat v0.2.0
  [7073ff75] IJulia v1.15.2
  [2b0e0bc5] LanguageServer v0.5.0
  [2edaba10] Nemo v0.11.1
  [9b87118b] PackageCompiler v0.5.1
  [91a5bcdd] Plots v0.22.4
  [d330b81b] PyPlot v2.6.3
  [0d4725de] Readables v0.2.0
  [90137ffa] StaticArrays v0.10.2
  [b3cc710f] StaticLint v0.0.2
  [cf896787] SymbolServer v0.1.0
  [1986cc42] Unitful v0.14.0
@stevengj
Copy link
Member

"Doesn't work" is not informative. What is the error? cc @ChrisRackauckas

(Decimal floating point seems to have few advantages for ODE integration, and a huge disadvantage in speed. But it would be good to make it work if only to make sure everything is sufficiently generic.)

@isentropic
Copy link
Author

isentropic commented Jan 11, 2019

Sorry for the ambiguity. That is, if the example code from the notebook is run,

julia> prob_ode_decfplinear = ODEProblem(f,Dec128(1)/Dec128(2),(0.0,1.0))
ODEProblem with uType Dec128 and tType Float64. In-place: false
timespan: (0.0, 1.0)
u0: 0.5

julia> sol =solve(prob_ode_decfplinear,RK4(),dt=1//2^(6))
ERROR: MethodError: Dec128(::Dec128) is ambiguous. Candidates:
  (::Type{T})(x::T) where T<:Number in Core at boot.jl:725
  Dec128(x) in DecFP at /home/zhanibek/.julia/packages/DecFP/XA6lk/src/DecFP.jl:105
Possible fix, define
  Dec128(::Dec128)
Stacktrace:
 [1] oneunit(::Type{Dec128}) at ./number.jl:321
 [2] #__init#205(::Int64, ::Array{Float64,1}, ::Array{Float64,1}, ::Array{Float64,1}, ::Nothing, ::Bool, ::Nothing, ::Bool, ::Bool, ::Bool, ::Nothing, ::Bool, ::Bool, ::Rational{Int64}, ::Bool, ::Rational{Int64}, ::Nothing, ::Nothing, ::Int64, ::Rational{Int64}, ::Int64, ::Int64, ::Rational{Int64}, ::Bool, ::Int64, ::Nothing, ::Nothing, ::Int64, ::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{Dec128,Tuple{Float64,Float64},false,Nothing,ODEFunction{false,getfield(Main, Symbol("##3#4")),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Nothing,DiffEqBase.StandardODEProblem}, ::RK4, ::Array{Any,1}, ::Array{Any,1}, ::Array{Any,1}, ::Type{Val{true}}) at /home/zhanibek/.julia/packages/OrdinaryDiffEq/SXL9q/src/solve.jl:116
 [3] (::getfield(DiffEqBase, Symbol("#kw##__init")))(::NamedTuple{(:dt,),Tuple{Rational{Int64}}}, ::typeof(DiffEqBase.__init), ::ODEProblem{Dec128,Tuple{Float64,Float64},false,Nothing,ODEFunction{false,getfield(Main, Symbol("##3#4")),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Nothing,DiffEqBase.StandardODEProblem}, ::RK4, ::Array{Any,1}, ::Array{Any,1}, ::Array{Any,1}, ::Type{Val{true}}) at ./none:0
 [4] #__solve#204(::Base.Iterators.Pairs{Symbol,Rational{Int64},Tuple{Symbol},NamedTuple{(:dt,),Tuple{Rational{Int64}}}}, ::Function, ::ODEProblem{Dec128,Tuple{Float64,Float64},false,Nothing,ODEFunction{false,getfield(Main, Symbol("##3#4")),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Nothing,DiffEqBase.StandardODEProblem}, ::RK4, ::Array{Any,1}, ::Array{Any,1}, ::Array{Any,1}, ::Type{Val{true}}) at /home/zhanibek/.julia/packages/OrdinaryDiffEq/SXL9q/src/solve.jl:6
 [5] (::getfield(DiffEqBase, Symbol("#kw##__solve")))(::NamedTuple{(:dt,),Tuple{Rational{Int64}}}, ::typeof(DiffEqBase.__solve), ::ODEProblem{Dec128,Tuple{Float64,Float64},false,Nothing,ODEFunction{false,getfield(Main, Symbol("##3#4")),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Nothing,DiffEqBase.StandardODEProblem}, ::RK4, ::Array{Any,1}, ::Array{Any,1}, ::Array{Any,1}, ::Type{Val{true}}) at ./none:0 (repeats 5 times)
 [6] #solve#442(::Base.Iterators.Pairs{Symbol,Rational{Int64},Tuple{Symbol},NamedTuple{(:dt,),Tuple{Rational{Int64}}}}, ::Function, ::ODEProblem{Dec128,Tuple{Float64,Float64},false,Nothing,ODEFunction{false,getfield(Main, Symbol("##3#4")),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Nothing,DiffEqBase.StandardODEProblem}, ::RK4) at /home/zhanibek/.julia/packages/DiffEqBase/8usQ9/src/solve.jl:39
 [7] (::getfield(DiffEqBase, Symbol("#kw##solve")))(::NamedTuple{(:dt,),Tuple{Rational{Int64}}}, ::typeof(solve), ::ODEProblem{Dec128,Tuple{Float64,Float64},false,Nothing,ODEFunction{false,getfield(Main, Symbol("##3#4")),LinearAlgebra.UniformScaling{Bool},Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing},Nothing,DiffEqBase.StandardODEProblem}, ::RK4) at ./none:0
 [8] top-level scope at none:0

Entry [4] in the notebook https://github.com/JuliaDiffEq/DiffEqTutorials.jl/blob/master/ExtraODEFeatures/Solving%20Equations%20in%20With%20Julia-Defined%20Types.ipynb

@stevengj
Copy link
Member

stevengj commented Jan 11, 2019

Thanks, should be fixed now on the master branch.

(In the future, file issues for each specific error message that arises, not for the package where they happen to arise.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants