       Re: estimating parameters in a differential equation with mathematica

• To: mathgroup at smc.vnet.net
• Subject: [mg89139] Re: estimating parameters in a differential equation with mathematica
• From: dh <dh at metrohm.ch>
• Date: Mon, 26 May 2008 06:25:29 -0400 (EDT)
• References: <g18hpo\$kh7\$1@smc.vnet.net>

```
Hi Sylvain,

there is a type in the equation: = instead of ==. Further, you need

reasonable start values. E.g.:

FindMinimum[sse[n,k],{n,.5},{k,.5}]

hope this helps, Daniel

> 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}][];

>   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

>

--

Daniel Huber

Metrohm Ltd.

Oberdorfstr. 68

CH-9100 Herisau

Tel. +41 71 353 8585, Fax +41 71 353 8907

E-Mail:<mailto:dh at metrohm.com>

Internet:<http://www.metrohm.com>

```

• Prev by Date: Re: Re: Range of Use of Mathematica
• Next by Date: Re: Re: No Show
• Previous by thread: Re: Re: Re: Integrate vs NIntegrate