[julia-users] ODE.jl - backwards (negative in time) integration
Hello, I came across this issue (recreated here using example code): julia> using ODE julia> function f(t, y) # Extract the components of the y vector (x, v) = y # Our system of differential equations x_prime = v v_prime = -x # Return the derivatives as a vector [x_prime; v_prime] end; julia> # Initial condtions -- x(0) and x'(0) const start = [0.0; 0.1] WARNING: redefining constant start 2-element Array{Float64,1}: 0.0 0.1 julia> # Time vector going from 0 to 2*PI in 0.01 increments time = 0.:-.1:-4pi; julia> t, y = ode45(f, start, time); This hangs for a long time (I've waited up to a minute before killing it). Is this a bug, or something I'm doing wrong? I do notice that reversing the time vector (-4pi:.1:0.0) yields a result. Thanks, Chris
Re: [julia-users] ODE.jl - backwards (negative in time) integration
This is a bug, could you file an issue? Thanks! Note that some solvers, even some of the Runge-Kutta family work, for instance ode78, ode45_fe, ode21 or ode23s. On Fri, 2016-06-24 at 20:48, Chris <7hunderstr...@gmail.com> wrote: > Hello, > > I came across this issue (recreated here using example code): > > julia> using ODE > > julia> function f(t, y) ># Extract the components of the y vector >(x, v) = y > ># Our system of differential equations >x_prime = v >v_prime = -x > ># Return the derivatives as a vector >[x_prime; v_prime] >end; > > julia> # Initial condtions -- x(0) and x'(0) >const start = [0.0; 0.1] > WARNING: redefining constant start > 2-element Array{Float64,1}: > 0.0 > 0.1 > > julia> # Time vector going from 0 to 2*PI in 0.01 increments >time = 0.:-.1:-4pi; > > julia> t, y = ode45(f, start, time); > > This hangs for a long time (I've waited up to a minute before killing it). > Is this a bug, or something I'm doing wrong? I do notice that reversing the > time vector (-4pi:.1:0.0) yields a result. > > Thanks, > Chris
Re: [julia-users] ODE.jl - backwards (negative in time) integration
Submitted https://github.com/JuliaLang/ODE.jl/issues/104 Thanks. On Friday, June 24, 2016 at 3:50:42 PM UTC-4, Mauro wrote: > > This is a bug, could you file an issue? Thanks! Note that some solvers, > even some of the Runge-Kutta family work, for instance ode78, ode45_fe, > ode21 or ode23s. > > On Fri, 2016-06-24 at 20:48, Chris <7hunde...@gmail.com > > wrote: > > Hello, > > > > I came across this issue (recreated here using example code): > > > > julia> using ODE > > > > julia> function f(t, y) > ># Extract the components of the y vector > >(x, v) = y > > > ># Our system of differential equations > >x_prime = v > >v_prime = -x > > > ># Return the derivatives as a vector > >[x_prime; v_prime] > >end; > > > > julia> # Initial condtions -- x(0) and x'(0) > >const start = [0.0; 0.1] > > WARNING: redefining constant start > > 2-element Array{Float64,1}: > > 0.0 > > 0.1 > > > > julia> # Time vector going from 0 to 2*PI in 0.01 increments > >time = 0.:-.1:-4pi; > > > > julia> t, y = ode45(f, start, time); > > > > This hangs for a long time (I've waited up to a minute before killing > it). > > Is this a bug, or something I'm doing wrong? I do notice that reversing > the > > time vector (-4pi:.1:0.0) yields a result. > > > > Thanks, > > Chris >
Re: [julia-users] ODE.jl - backwards (negative in time) integration
Won't some of the Runge-Kutta solvers be really unstable with a small negative Delta t? What happens when you use a fixed time step method: does it run and diverge? On Friday, June 24, 2016 at 8:50:42 PM UTC+1, Mauro wrote: > > This is a bug, could you file an issue? Thanks! Note that some solvers, > even some of the Runge-Kutta family work, for instance ode78, ode45_fe, > ode21 or ode23s. > > On Fri, 2016-06-24 at 20:48, Chris <7hunde...@gmail.com > > wrote: > > Hello, > > > > I came across this issue (recreated here using example code): > > > > julia> using ODE > > > > julia> function f(t, y) > ># Extract the components of the y vector > >(x, v) = y > > > ># Our system of differential equations > >x_prime = v > >v_prime = -x > > > ># Return the derivatives as a vector > >[x_prime; v_prime] > >end; > > > > julia> # Initial condtions -- x(0) and x'(0) > >const start = [0.0; 0.1] > > WARNING: redefining constant start > > 2-element Array{Float64,1}: > > 0.0 > > 0.1 > > > > julia> # Time vector going from 0 to 2*PI in 0.01 increments > >time = 0.:-.1:-4pi; > > > > julia> t, y = ode45(f, start, time); > > > > This hangs for a long time (I've waited up to a minute before killing > it). > > Is this a bug, or something I'm doing wrong? I do notice that reversing > the > > time vector (-4pi:.1:0.0) yields a result. > > > > Thanks, > > Chris >
Re: [julia-users] ODE.jl - backwards (negative in time) integration
Nevermind, I realize that thought was silly because of how linear stability is defined. Carry on. Though I would still give a fixed timestep method a try to narrow down the bug to adaptive stepping. There may be some issue somewhere, something weird like how it chooses min/max timesteps? On Monday, June 27, 2016 at 6:15:45 AM UTC+1, Chris Rackauckas wrote: > > Won't some of the Runge-Kutta solvers be really unstable with a small > negative Delta t? What happens when you use a fixed time step method: does > it run and diverge? >