*ODE IV Control and Variable Scale@ 2010-03-18 18:28 Kevin H. Hobbs2010-03-20 19:18 ` Tuomo Keskitalo 0 siblings, 1 reply; 4+ messages in thread From: Kevin H. Hobbs @ 2010-03-18 18:28 UTC (permalink / raw) To: gsl-discuss [-- Attachment #1: Type: text/plain, Size: 1021 bytes --] I'm trying make sure that I am using the gsl_odeiv_control functions correctly. I'm modelling neurons and my variables have different scales. Voltage is usually between -100 and 50 mV. The membrane current gating variables stay between 0 and 1. Internal calcium concentration is usually between 0 and a few hundred micro molar. Each time I read the descriptions of the gsl_odeiv_control functions I become more convinced that the parameters eps_rel, a_y, and a_dydt are there to excuse some error in variables and derivatives that are far from zero. Is that correct? Since I have no reason to care more about values close to zero (unless I do some complicated remapping of the variable values) should I set eps_rel, a_y, and a_dydt to 0? Since my variables have different ranges should I use gsl_odeiv_control_scaled_new with an appropriate eps_abs and scale_abs set with something like 1 for internal calcium concentration, 0.3 for membrane voltage, and 0.001 for all of the gating variables? [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 252 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread

*Re: ODE IV Control and Variable Scale2010-03-18 18:28 ODE IV Control and Variable Scale Kevin H. Hobbs@ 2010-03-20 19:18 ` Tuomo Keskitalo2010-03-22 14:49 ` Kevin H. Hobbs 0 siblings, 1 reply; 4+ messages in thread From: Tuomo Keskitalo @ 2010-03-20 19:18 UTC (permalink / raw) To: Kevin H. Hobbs;+Cc:gsl-discuss, help-gsl Hi, about ODE solver error tolerances: you _never_ want to set eps_rel to zero. It would mean that you allow no error for the ODE solver, which is something no numerical method can give you. As an example: gsl_odeiv_control_y_new (1e-12, 1e-8) means that if the absolute value of a variable drops below 1e-12, you don't really care of it's value any more (it is essentially zero for you). eps_rel = 1e-8 means that you want at least 7 decimals of each variable to be accurate on each ODE solver step. If you need to control the level of error with more detail, then you can use a_y, a_dydt and scale_abs. A practical way to choose tolerances is to make a test and compare results calculated with "strict" and "loose" eps_abs and eps_rel (order of magnitude difference between strict and loose). If you get nearly same values as result, you are probably safe to use your loose tolerances. Of course, this depends on your problem, so be sure to test it with your final computation case again. If you are not interested in optimizing the performance, I'd suggest you simply try to use control_y_new and see how it works for you. Regards, Tuomo On 03/18/2010 08:27 PM, Kevin H. Hobbs wrote: > I'm trying make sure that I am using the gsl_odeiv_control functions > correctly. > > I'm modelling neurons and my variables have different scales. Voltage is > usually between -100 and 50 mV. The membrane current gating variables > stay between 0 and 1. Internal calcium concentration is usually between > 0 and a few hundred micro molar. > > Each time I read the descriptions of the gsl_odeiv_control functions I > become more convinced that the parameters eps_rel, a_y, and a_dydt are > there to excuse some error in variables and derivatives that are far > from zero. Is that correct? > > Since I have no reason to care more about values close to zero (unless I > do some complicated remapping of the variable values) should I set > eps_rel, a_y, and a_dydt to 0? > > Since my variables have different ranges should I use > gsl_odeiv_control_scaled_new with an appropriate eps_abs and scale_abs > set with something like 1 for internal calcium concentration, 0.3 for > membrane voltage, and 0.001 for all of the gating variables? > -- Tuomo.Keskitalo@iki.fi http://iki.fi/tuomo.keskitalo ^ permalink raw reply [flat|nested] 4+ messages in thread

*Re: ODE IV Control and Variable Scale2010-03-20 19:18 ` Tuomo Keskitalo@ 2010-03-22 14:49 ` Kevin H. Hobbs2010-03-22 17:26 ` Tuomo Keskitalo 0 siblings, 1 reply; 4+ messages in thread From: Kevin H. Hobbs @ 2010-03-22 14:49 UTC (permalink / raw) To: Tuomo Keskitalo;+Cc:gsl-discuss, help-gsl [-- Attachment #1: Type: text/plain, Size: 2537 bytes --] On 03/20/2010 03:18 PM, Tuomo Keskitalo wrote: > Hi, > > about ODE solver error tolerances: you _never_ want to set eps_rel to > zero. It would mean that you allow no error for the ODE solver, which is > something no numerical method can give you. The ODE example program sets eps_rel to 0.0. > > As an example: gsl_odeiv_control_y_new (1e-12, 1e-8) means that if the > absolute value of a variable drops below 1e-12, you don't really care of > it's value any more (it is essentially zero for you). Right now I'm setting eps_abs to something like 1.0e-3. As far as I can tell from the documentation there's nothing special about a variable value of 0.0 when eps_rel is 0.0. 1.0e-3 is the same as 0.0 and 100 + 1.0e-3 is the same as 100. I want a constant error across the range of the variables. eps_rel = 1e-8 > means that you want at least 7 decimals of each variable to be accurate > on each ODE solver step. If you need to control the level of error with > more detail, then you can use a_y, a_dydt and scale_abs. The trouble I have with these parameters is they depend on 0.0 being a special value, but in my model there is nothing special about 0.0 for most of the variables. Voltage is the major example. Membrane voltage ranges from the reversal potential for potassium E_K = -80 mV to the reversal potential of sodium E_Na = 50 mV. The values of membrane voltage where the various membrane currents turn on and off are the critical values, but there are many of them and they are spread across the voltage range. > > A practical way to choose tolerances is to make a test and compare > results calculated with "strict" and "loose" eps_abs and eps_rel (order > of magnitude difference between strict and loose). If you get nearly > same values as result, you are probably safe to use your loose > tolerances. Of course, this depends on your problem, so be sure to test > it with your final computation case again. We have a whole graduate student devoted to this testing right now. > > If you are not interested in optimizing the performance, I'd suggest you > simply try to use control_y_new and see how it works for you. > We are very much interested in performance since we're trying to evaluate millions of models per day. It appears that by using gsl_odeiv_control_scaled_new with scales proportional to the range of each variable, eps_rel = 0.0, a_y = 0.0, and a_dydt = 0.0 we can relax eps_abs and evaluate more models with greater accuracy. [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 252 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread

*2010-03-22 14:49 ` Kevin H. HobbsRe: ODE IV Control and Variable Scale@ 2010-03-22 17:26 ` Tuomo Keskitalo0 siblings, 0 replies; 4+ messages in thread From: Tuomo Keskitalo @ 2010-03-22 17:26 UTC (permalink / raw) To: Kevin H. Hobbs;+Cc:gsl-discuss, help-gsl Hi, sorry, I did not understand your case correctly the first time. I often want to make sure that (fast) changes in variable values are followed precisely (my problems tend to be stiff) and therefore use eps_rel dominantly. You are right that eps_rel may well be 0. Depends on your problem. On 03/22/2010 04:48 PM, Kevin H. Hobbs wrote: > On 03/20/2010 03:18 PM, Tuomo Keskitalo wrote: >> Hi, >> >> about ODE solver error tolerances: you _never_ want to set eps_rel to >> zero. It would mean that you allow no error for the ODE solver, which is >> something no numerical method can give you. > > The ODE example program sets eps_rel to 0.0. > >> As an example: gsl_odeiv_control_y_new (1e-12, 1e-8) means that if the >> absolute value of a variable drops below 1e-12, you don't really care of >> it's value any more (it is essentially zero for you). > > Right now I'm setting eps_abs to something like 1.0e-3. > > As far as I can tell from the documentation there's nothing special > about a variable value of 0.0 when eps_rel is 0.0. 1.0e-3 is the same as > 0.0 and 100 + 1.0e-3 is the same as 100. > > I want a constant error across the range of the variables. > > eps_rel = 1e-8 >> means that you want at least 7 decimals of each variable to be accurate >> on each ODE solver step. If you need to control the level of error with >> more detail, then you can use a_y, a_dydt and scale_abs. > > The trouble I have with these parameters is they depend on 0.0 being a > special value, but in my model there is nothing special about 0.0 for > most of the variables. > > Voltage is the major example. Membrane voltage ranges from the reversal > potential for potassium E_K = -80 mV to the reversal potential of sodium > E_Na = 50 mV. The values of membrane voltage where the various membrane > currents turn on and off are the critical values, but there are many of > them and they are spread across the voltage range. > >> A practical way to choose tolerances is to make a test and compare >> results calculated with "strict" and "loose" eps_abs and eps_rel (order >> of magnitude difference between strict and loose). If you get nearly >> same values as result, you are probably safe to use your loose >> tolerances. Of course, this depends on your problem, so be sure to test >> it with your final computation case again. > > We have a whole graduate student devoted to this testing right now. > >> If you are not interested in optimizing the performance, I'd suggest you >> simply try to use control_y_new and see how it works for you. >> > > We are very much interested in performance since we're trying to > evaluate millions of models per day. > > It appears that by using gsl_odeiv_control_scaled_new with scales > proportional to the range of each variable, eps_rel = 0.0, a_y = 0.0, > and a_dydt = 0.0 we can relax eps_abs and evaluate more models with > greater accuracy. > -- Tuomo.Keskitalo@iki.fi http://iki.fi/tuomo.keskitalo ^ permalink raw reply [flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-03-22 17:26 UTC | newest]Thread overview:4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2010-03-18 18:28 ODE IV Control and Variable Scale Kevin H. Hobbs 2010-03-20 19:18 ` Tuomo Keskitalo 2010-03-22 14:49 ` Kevin H. Hobbs 2010-03-22 17:26 ` Tuomo Keskitalo

This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).