MathGroup Archive 2008

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

Search the Archive

estimating parameters in a differential equation with mathematica 6

  • To: mathgroup at smc.vnet.net
  • Subject: [mg89041] estimating parameters in a differential equation with mathematica 6
  • From: sado Sylvain <sadosylvain at hotmail.com>
  • Date: Sat, 24 May 2008 03:55:08 -0400 (EDT)

I need a help
I have bee trying to solve a differential equation to fit experimental data with mathematica, but something is always wrong. can somebody kindly help me!
this is the experiemtal data
data = {{0.0000001, -0.000001}, {1, -1.386}, {2, -1.933}, {4, \
-3.767}, {5, -5.009}, {6, -6.322}, {7, -7.177}, {7.5, -7.679}};
and the formula for least square 
Plus @@ Apply[(f[#1] - #2)^2 &, data, {1}]
then the differential equation is as follow
{f'[t] = -n Log[
    1 + \[ExponentialE]^(
     k (-22.46` + x/(0.00225`+ 0.04` x)))] (-f[t]/
      Log[1 + \[ExponentialE]^(
        k (-22.46` + x/(0.00225`+ 0.04` x)))])^(-1 + n)/n}
where "n" and "k" are to be estimated by the FindMinimum operation. so the expression I have used is this one
sse[n_?NumberQ, k_?NumberQ] := 
 Block[{sol, f}, 
  sol = NDSolve[{f'[
        x] = -n Log[
         1 + \[ExponentialE]^(
          k (-22.46` + x/(0.00225`+ 0.04` x)))] (-f[x]/
           Log[1 + \[ExponentialE]^(
             k (-22.46` + x/(0.00225`+ 0.04` x)))])^(((-1) + n)/n), 
      f[0.0000001] == -0.000001}, f, {x, 0.00000001, 7.5}][[1]]; 
  Plus @@ Apply[(f[#1] - #2)^2 &, data, {1}] /.sol]
followed by this:
FindMinimum[sse[n, k], {n, 0.00001, 100}, {k, 0.00001, 100}]

but i can get any solution.this one of the comments i receive
ReplaceAll::reps: {-(0.00001 \
Log[1.+<<18>>^(0.00001<<1>><<1>>)])/(-(1. \
<<1>>)/(Log<<1>><<1>>]))^99999.,f[1.*10^-7]==-1.*10^-6} is neither a \
list of replacement rules nor a valid dispatch table, and so cannot \
be used for replacing. >>

NDSolve::deqn: Equation or list of equations expected instead of \
-(0.00001 Log[1+\[ExponentialE]^(0.00001 \
<<1>>)])/(-f[x]/Log[<<1>>])^99999. in the first argument {-(0.00001 \
Log[1+\[ExponentialE]^(0.00001 \
<<1>>)])/(-f[x]/(Log<<1>><<1>>]))^99999.,f[1.*10^-7]==-1.*10^-6}. >>

it seems there is a syntax problem somewhere. 
Thanks in advance for any help,
Sylvain


  • Prev by Date: Re: Problems with ListPlot
  • Next by Date: Re: Integrating Interpolation functions
  • Previous by thread: Re: Caution! Reuse of variables within Manipulate
  • Next by thread: Symbols in expression