# Bring back to life Julia 0.4 code

**URL:** <https://discourse.julialang.org/t/bring-back-to-life-julia-0-4-code/104820>\
**Category:** Numerics\
**Tags:** question\
**Created:** [October 10, 2023, 9:15pm UTC](https://discourse.julialang.org/t/bring-back-to-life-julia-0-4-code/104820 "2023-10-10T21:15:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![berceanu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/berceanu/32/11490_2.png) [@berceanu](https://discourse.julialang.org/u/berceanu)\
**Post date:** [October 10, 2023, 9:15pm UTC](https://discourse.julialang.org/t/bring-back-to-life-julia-0-4-code/104820/1 "2023-10-10T21:15:36Z")

</div>

I am trying to port an older Julia 0.4 code that uses ODE.jl and I find it stumbles on this [line](https://github.com/berceanu/topo-condensate/blob/56ef99b81c5c24dcacec52cf5839047399db025f/runge-kutta.jl#L109)

```julia
tout, aout = ode45((t,a)->F(t,a, N,p,q,m₀,n₀,J,σ,Ω,κ,f), a₀, [0., 10])

```

The code is a single, small file. The error I get is:

```julia
ERROR: LoadError: MethodError: no method matching Array(::Type{ComplexF64}, ::Int64)

Closest candidates are:
  Array(::LinearAlgebra.UniformScaling, ::Integer, ::Integer)
   @ LinearAlgebra ~/.julia/juliaup/julia-1.9.3+0.aarch64.apple.darwin14/share/julia/stdlib/v1.9/LinearAlgebra/src/uniformscaling.jl:513

Stacktrace:
  [1] F(t::Float64, a::Vector{ComplexF64}, N::Int64, p::Int64, q::Int64, m₀::Int64, n₀::Int64, J::Float64, σ::Float64, Ω::Float64, κ::Float64, f::Vector{Float64})
    @ Main ~/Development/topo-condensate/runge-kutta.jl:27
  [2] (::var"#3#4")(t::Float64, a::Vector{ComplexF64})
    @ Main ~/Development/topo-condensate/runge-kutta.jl:110
  [3] hinit(F::var"#3#4", x0::Vector{ComplexF64}, t0::Float64, tend::Float64, p::Int64, reltol::Float64, abstol::Float64)
    @ ODE ~/.julia/packages/ODE/N5yvz/src/ODE.jl:91
  [4] oderk_adapt(fn::var"#3#4", y0::Vector{ComplexF64}, tspan::Vector{Float64}, btab_::ODE.TableauRKExplicit{:dopri, 7, Rational{Int64}}; reltol::Float64, abstol::Float64, norm::Function, minstep::Float64, maxstep::Float64, initstep::Int64, points::Symbol, alias_u0::Bool)
    @ ODE ~/.julia/packages/ODE/N5yvz/src/runge_kutta.jl:292
  [5] oderk_adapt(fn::Function, y0::Vector{ComplexF64}, tspan::Vector{Float64}, btab_::ODE.TableauRKExplicit{:dopri, 7, Rational{Int64}})
    @ ODE ~/.julia/packages/ODE/N5yvz/src/runge_kutta.jl:232
  [6] #ode45_dp#10
    @ ~/.julia/packages/ODE/N5yvz/src/runge_kutta.jl:221 [inlined]
  [7] ode45_dp
    @ ~/.julia/packages/ODE/N5yvz/src/runge_kutta.jl:221 [inlined]
  [8] #ode45#11
    @ ~/.julia/packages/ODE/N5yvz/src/runge_kutta.jl:223 [inlined]
  [9] ode45(fn::Function, y0::Vector{ComplexF64}, tspan::Vector{Float64})
    @ ODE ~/.julia/packages/ODE/N5yvz/src/runge_kutta.jl:223
 [10] top-level scope
    @ ~/Development/topo-condensate/runge-kutta.jl:110
in expression starting at /Users/berceanu/Development/topo-condensate/runge-kutta.jl:110

```

Any ideas on how to get this working with the current version of ODE.jl and Julia 1.9?

Cross posting: [Backwards compatibility · Issue #180 · SciML/ODE.jl · GitHub](https://github.com/SciML/ODE.jl/issues/180)

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [October 10, 2023, 9:24pm UTC](https://discourse.julialang.org/t/bring-back-to-life-julia-0-4-code/104820/2 "2023-10-10T21:24:26Z")

</div>

The problem is in `F`. What happens when you call `F` separately from the ode solve?

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [October 10, 2023, 9:28pm UTC](https://discourse.julialang.org/t/bring-back-to-life-julia-0-4-code/104820/3 "2023-10-10T21:28:30Z")

</div>

The usual recommendation if your code works with Julia 0.4 is to try it with Julia 0.5. If you get deprecation warnings, fix those. Then step up through 0.6, 0.7, 1.0 and fix any warnings you get along they way. Juliaup makes it easy to install the historical versions.

---

<div class="post-metadata">

**Author:** ![berceanu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/berceanu/32/11490_2.png) [@berceanu](https://discourse.julialang.org/u/berceanu)\
**Post date:** [October 11, 2023, 11:23am UTC](https://discourse.julialang.org/t/bring-back-to-life-julia-0-4-code/104820/4 "2023-10-11T11:23:01Z")

</div>

Thanks, I did a few other changes in my file and now everything works on 1.9 ☀
