# Help me to resolve this syntax issue

Posted 9 years ago
4706 Views
|
4 Replies
|
0 Total Likes
|
 Hi,I am trying to solve some differential equations, but the file shows error -saying that "NDSolve::ndode: Input is not an ordinary differential equation. "Can anyone please help me in this.I am attaching the file for referenceThanks, Jaydeep Attachments:
4 Replies
Sort By:
Posted 9 years ago
 Thanks for the solution.
Posted 9 years ago
 There are many problems in your data fitting file. First of all you have posted that question over and over again. You should consider only posting the same question once. One of the problems is that in the 18th entry in your Dataimp1 import is different from all the others. It has the form {136., 480, 13, 33} which is different from the three entries that all other data points have. You can fix this by: dataimp = Dataimp1 /. Dataimp1[[18]] -> {136., 480, 13.33} Also you haven't given values for Va and Vb, and you are not estimating them either. This is why it returns that there is a non-numerical value. If you use Dataimp1 = {{195., 1., 452.}, {256., 1., 251.}, {237., 1., 1997.}, {216., 30., 890.}, {260., 30., 893.}, {233., 30., 900.}, {193., 60., 171.}, {224., 60., 2157.}, {206., 60., 2298.}, {179., 120., 4384.}, {222., 120., 7875.}, {210., 120., 6771.}, {171., 240., 9580.}, {219., 240., 12168.}, {197., 240., 11947.}, {134., 480., 7413.}, {180., 480., 9500.}, {136., 480., "13,33"}, {164., 720., 20193.}, {204., 720., 22600.}, {191., 720., 23202.}, {191., 1440., 14014.}, {245., 1440., 16983.}, {214., 1440., 20594.}, {831., 1., 9786.}, {915., 1., 13197.}, {915., 1., 11993.}, {754., 30., 959.}, {831., 30., 2745.}, {880., 30., 1661.}, {694., 60., 4630.}, {854., 60., 5774.}, {814., 60., 11993.}, {766., 120., 22626.}, {807., 120., 12194.}, {817., 120., 17209.}, {701., 240., 24632.}, {817., 240., 32055.}, {804., 240., 30651.}, {593., 480., 18814.}, {639., 480., 21222.}, {638., 480., 19215.}, {720., 720., 27842.}, {811., 720., 37873.}, {785., 720., 34663.}, {800., 1440., 44293.}, {882., 1440., 48907.}, {850., 1440., 51314.}, {4510., 1., 73514.}, {5070., 1., 33390.}, {5230., 1., 84949.}, {4540., 60., 6307.}, {4650., 60., 5103.}, {4220., 120., 32387.}, {4540., 120., 51847.}, {5090., 120., 81137.}, {4460., 240., 25165.}, {4670., 240., 67696.}, {4590., 240., 70103.}, {3380., 480., 9316.}, {3660., 480., 4501.}, {5360., 720., 68498.}, {5440., 720., 76122.}, {4310., 720., 83545.}, {4740., 1440., 122866.}, {4790., 1440., 130890.}, {4810., 1440., 138915.}}; Then correct for the wrong entry: dataimp = Dataimp1 /. Dataimp1[[18]] -> {136., 480, 13.33} Then add the Va and Vb values - which I made up to make it work: ClearAll[Vmax, Km, fit, Cb0, fuc, Pdiff, te, Model30]; Va = 0.1; Vb = \ 0.1; Model30[Vmax_?NumericQ, Km_?NumericQ, fuc_?NumericQ, Pdiff_?NumericQ, Cb0_?NumericQ, te_] := (Model30[Vmax, Km, fuc, Pdiff, Cb0] = Ca[te] /. First[NDSolve[{ Ca'[t] == ((Vmax Cb[t])/(Km + Cb[t]) - Pdiff fuc Ca[t] + Pdiff Cb[t])/Va, Cb'[t] == (Pdiff fuc Ca[t] - Pdiff Cb[t] - (Vmax Cb[t])/(Km + Cb[t]))/Vb, Ca[0] == 0, Cb[0] == Cb0 }, {Ca, Cb}, {t, 0, 1440}, MaxSteps -> 100000, PrecisionGoal -> \[Infinity]]]); and then fit: fit = NonlinearModelFit[dataimp, {Model30[Vmax, Km, fuc, Pdiff, Cb0, te]}, {{Vmax, 0.05}, {Km, 210}, {fuc, 0.05}, {Pdiff, 0.0000031}}, {Cb0, te}, Weights -> (1./#3 &)] You get lots of warnings but it does fit something. It is difficult to tell whether that is close to what you want, because I needed to make numbers up and modified the data. I had looked at the problem before, but it is not quite clear what you want/need. Cheers, M.
Posted 9 years ago
 Thanks, It did work.Can you please also help me in finding the solution for the error in this mathematica file. I have attached the mathematica file Thanks Attachments:
Posted 9 years ago
 There seems to be quite a bit wrong with that. 1) There was no differential equation for E2 so I made one up.2) There was no value given for kin.3) The derivative signs were incorrect. 4) It would be good style not to capitalise Model. 5) Also, you use numerical integration so I gave all variables a finite precision.This will work to some extent: ClearAll["Global*"]; k1 = 600.; k2 = 6000.; k3 = 10.; k4 = 0.5; k5 = 100.; k6 = 100.; ki = 10.; Et = 10.; S0 = 50.; kin = 20.; Model = NDSolve[{Eu'[t] == k2*ES1[t] - k1*Eu[t]*S[t] + k3*ES1[t] + k4*ES1[t] - k6*Eu[t]*S[t] + k5*ES2[t], ES1'[t] == k1*Eu[t]*S[t] - ES1[t]*(k2 + k3 + k4), ES2'[t] == k6*Eu[t]*S[t] - k5*ES2[t] - kin*ES2[t], P1'[t] == k3*ES1[t], P2'[t] == k4*ES1[t], S'[t] == k2*ES1[t] + k5*ES2[t] - k1*Eu[t]*S[t] - k6*Eu[t]*S[t], E2'[t] == -k4, ES2[0] == 0., S[0] == S0, Eu[0] == Et, ES1[0] == 0., P1[0] == 0., P2[0] == 0., E2[0] == 0.}, {Eu, ES1, ES2, P1, P2, S, E2}, {t, 0, 60}, MaxSteps -> 1000000, PrecisionGoal -> \[Infinity]] `You will need to correct the equation that I made up for E2 and fix the parameters. The results can be plotted but look very nasty right now as expected. Cheers, M.