MathGroup Archive 2013

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: combining FindFit and ParametricNDSolve?

So it turns out that my institution has a certain amount of Mathematica technical support included in their license.  I posed this question to the good people at Wolfram and this was their response:

"I've attached a notebook containing examples of how you might
successfully use FindFit with your parametric differential equation

The notebook doesn't contain the results of the FindFit evaluations,
as they seemed to be taking a bit of time to evaluate. However, the
syntax and usage of all expressions in the notebook is correct as far
as I have tested and should give you a fit to your model."

The relevant contents of the notebook are:

    solutions =
       {Derivative[1, 0][MG][t, DNA] ==
         a*DNA*NTP[t, DNA]/(Km1 + NTP[t, DNA]) - b*MG[t, DNA],
        Derivative[1, 0][NTP][t, DNA] ==
         -f*a*DNA*NTP[t, DNA]/(Km1 + NTP[t, DNA]) -
     d*MG[t, DNA] NTP[t, DNA]/(Km2 + NTP[t, DNA]) -
     c*NTP[t, DNA]/(Km3 + NTP[t, DNA]),
        Derivative[1, 0][GFP][t, DNA] ==
    g*d*MG[t, DNA] NTP[t, DNA]/(Km2 + NTP[t, DNA]),
        NTP[0, DNA] == NTP0,
        MG[0, DNA] == 0,
        GFP[0, DNA] == 0},
       {MG, NTP, GFP},
       {t, 0, 800},
       {DNA, 5, 10},(*
       chosen as example domain *)
       {a, b, c, d, f, g, Km1, Km2, Km3,
       Method -> "StiffnessSwitching"

    model = MG /. solutions;

    parameters = {a, b, c, d, f, g, Km1, Km2, Km3, NTP0};

    startingValues = {6.8`, 0.012`, 247, 1.54`, 19.6`, 22.2`, 352200, 127882,
       5134.5`, 611628};

    (* quick test *)
    model @@ startingValues
    %[100, 7]

    fit =
      {model[a, b, c, d, f, g, Km1, Km2, Km3, NTP0][t, DNA],
       {a > 0, b > 0, c > 0,
        d > 0, f > 0, g > 0,
        Km1 > 1000, Km2 > 1000, Km3 > 1000,
        NTP0 > 100000}},
      Thread@{parameters, startingValues},
      {t, DNA}

On Friday, September 20, 2013 4:06:52 AM UTC-7, dantimatter wrote:
> Hello All,
> I'd like to use FindFit to find best fit parameter values for a system of differential equations, but instead of  using NDSolve (as is shown in the Help example), I think I need to use ParametricNDSolve to simultaneously fit to multiple datasets that resulted from varying just a single model parameter.  The data is in the form of
> {{t1_dataset1, param1, y1_dataset1}, {t2_dataset1, param1_dataset1, y2_dataset1}, ...
> {t1_dataset2, param2, y1_dataset2}, {t2_dataset2, param2, y2_dataset2}, .  ..
> {t1_dataset3, param3, y1_dataset3}, {t2_dataset3, param3, y2_dataset3}, .  .. };
> I'm getting very lost in the syntax.  Can anyone give a simple example of how this might be done?
> Thanks

  • Prev by Date: Re: FindFit for a differential equation model with multiple variables
  • Next by Date: Create a Nasty Password with MATHEMATICA
  • Previous by thread: combining FindFit and ParametricNDSolve?
  • Next by thread: Import CSV can not understand string correctly