I'm really new to Mathematica and I'm facing a problem and would really appreciate some help! Maybe my question is similar to one described in How to fit 3 data sets to a model of 4 differential equations?, but I can not solve it on my own. I'm trying to develop the model for reaction kinetics. The one component F is degrading and polymerizing at the same time. Both rates are dependent on pH (concentration of H+ ions). These H+ ions are generated during the degradation of the compound. So the equations seems to look like

F'[t] == -kd F[t] H[t] - kp F[t] H[t]
H'[t] == kd F[t] H[t]

These ‍‍‍kd‍‍‍‍‍‍ and ‍kp‍ are UNKNOWN and need to be found! I have data in an Excel file where the first column is time (0,1,10,25,35,45,65,85,125 min), the second column is concentration of component F and the third one is concentration of H+ ions at a given time. So I'm doing these steps (may be they are not straightforward but...)

  "F:\\Furfural\\articles\\Kinetic modelling of \
xylose-furfural\\model in Mathematica"];

data = Import["furfural experiments.xlsx"][[1]];

{time, Furfural, Hydrogen} = Transpose[data];

furfin = Furfural[[1]];

Hin = Hydrogen[[1]];

sol = ParametricNDSolveValue[{F'[t] == -kd F[t] H[t] - kp F[t] H[t], 
    F[0] == furfin, H'[t] == kd F[t] H[t], H[0] == Hin}, {F, H}, {t, 
    0, 150}, {kd, kp}];

And here comes my problem - WHAT should I do with my own data to be able to put it to NonlinearModelFit and find fitting simultaneously for F and H? I killed more than week trying to figure it out! I would really appreciate any help! p.s.: You can find data on https://drive.google.com/file/d/0BwH-Q7mzwrpLWE1zMWNDb3d1NEk/view

  • $\begingroup$ Welcome to Mathematica.SE! I suggest that: 1) You take the introductory Tour now! 2) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! 3) As you receive help, try to give it too, by answering questions in your area of expertise. $\endgroup$
    – bbgodfrey
    Commented Apr 12, 2015 at 18:53
  • 1
    $\begingroup$ Very difficult to provide additional help w/o the data. The Q&A you reference should work fine once you make your version of transformedData and remove the 3rd k from model. I also wonder about the omission of the kp term in H'[t]; can you provide the proposed mechanism/chemical equations? $\endgroup$ Commented Apr 12, 2015 at 19:12
  • $\begingroup$ Could you provide a small portion of your data?! $\endgroup$
    – Mahdi
    Commented Apr 12, 2015 at 19:49
  • $\begingroup$ Dear @bobthechemist and Mahdi you can find data on drive.google.com/file/d/0BwH-Q7mzwrpLWE1zMWNDb3d1NEk/…. There are 3 sheets for temperatures 180,200, 220C respectively. H+ is not reacting with Furfural, it is just catalyzing the reactions, and degradation of furfural produces more acid. I found that rate constant depends on H+ (ki=Aiexp(-Eai/RT)*[H+]^ni) but at this moment I just included it into reaction model as kFH more thinking about simplification. $\endgroup$
    – OlgaE
    Commented Apr 12, 2015 at 20:16

1 Answer 1


This is not an answer, but rather one route to explore the feasibility of your model. Once you have the set of equations obtained from ParametricNDSolve you can plot them using Manipulate to see how the values of k affect the shape of the concentration vs. time plots:

enter image description here

This graphic was obtained using the following (data contains the Imported google spreasheet):

sol = ParametricNDSolveValue[{F'[t] == -kd F[t] H[t] - kp F[t] H[t], 
    F[0] == 84.2132, H'[t] == kd F[t] H[t], H[0] == 0.00169824}, {F, 
    H}, {t, 0, 150}, {kd, kp}];
 Plot[Evaluate@Through[sol[kd, kp][t]], {t, 0, 150}, 
  PlotStyle -> {Red, Blue}, 
  Epilog -> {[email protected], Red, Point /@ data[[1, All, {1, 2}]], 
    Blue, Point /@ 
     data[[1, All, {1, 3}]]}], {kd, .0001, .01}, {kp, .0001, .1}]

The data you have collected do not cover a sufficient time frame for you to obtain a reasonable fit given the model you assume. Additionally, it looks as if your model, under certain circumstances, would predict a hydrogen ion concentration that could change dramatically. If this is indeed the case, then (and this is off topic for this site) you need to consider performing the reaction under buffered conditions.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.