mjg211 / phaseR

Development version of phaseR, an R package for phase plane analysis of one- and two-dimensional autonomous ODE systems
https://doi.org/10.32614/RJ-2014-023
Other
15 stars 3 forks source link

Trajectory 1D system starts at t = 0, instead of (t, y) clicked #5

Open burgerga opened 5 years ago

burgerga commented 5 years ago

Came across this when using the phasePlaneAnalysis on a 1D function. It's not really a problem, but it might not be what you expect to happen.

mjg211 commented 5 years ago

Yeah it probably shouldn’t work like that - good spot!

From: Gerhard Burger notifications@github.com Reply-To: mjg211/phaseR reply@reply.github.com Date: Sunday, 26 August 2018 at 12:52 To: mjg211/phaseR phaseR@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [mjg211/phaseR] Trajectory 1D system starts at t = 0, instead of (t, y) clicked (#5)

Came across this when using the phasePlaneAnalysis on a 1D function. It's not really a problem, but it might not be what you expect to happen.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/mjg211/phaseR/issues/5, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AEVpA_i4mgWpvh-FhwhvPGPsU9wjvn-hks5uUovggaJpZM4WMwG5.

mjg211 commented 5 years ago

Still unsure on the best way to resolve this, as at present trajectory() returns a single numeric vector t, given that tlim and tstep define t for ALL initial conditions.

If trajectories can be plotting in the 1D case with different initial values of t, should it just calculate the numerical solution back to 0 so a single t can be retained, but then plot from only the chosen initial t?

burgerga commented 5 years ago

Hmm, I see the problem... tlim is also xlim in the 1D case. I will think about possible solutions and try some stuff

burgerga commented 5 years ago

It might be weird for 2D systems as well, if you do

trajectory(simplePendulum,
                                        y0         = y0,
                                        tlim       = c(0, 10),
                                        parameters = 5)
trajectory(simplePendulum,
                                        y0         = y0,
                                        tlim       = c(5, 10),
                                        parameters = 5)

do you expect the same starting point?

mjg211 commented 5 years ago

Very true; it should probably always be computing the trajectory from t=0, and then just plotting based on tlim.