Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

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

Search the Archive

Bug in NonlinearRegress on NDSolve

  • To: mathgroup at smc.vnet.net
  • Subject: [mg14840] Bug in NonlinearRegress on NDSolve
  • From: Mike Trefry <mike.trefry at per.clw.csiro.au>
  • Date: Fri, 20 Nov 1998 02:16:50 -0500
  • Organization: CSIRO, Western Australia
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

I want to use NonlinearRegress to determine confidence intervals (w.r.t.
measured data) on parameters of pde systems solved via NDSolve, but it
doesn't seem to work. Here's the problem:

This dynamic function solves a 1-parameter (alpha) pde:

mgt[alpha_?NumericQ] := mgt[alpha] = Module[{sol},
sol = First[NDSolve[
         {D[u[x, t], t] == D[u[x, t], x, x] + alpha*x*u[x,t],
         u[x, 0] == 1 - x^2, Derivative[1, 0][u][0, t] == 0,
         u[1, t] == 0}, u, {x, 0, 1}, {t, 0, 1}]]; u /. sol]


Invoking mgt for a given value returns an InterpolatingFunction:

mgt[6]

InterpolatingFunction[{{0,1.},{0.,1.}},<>]

We can use the function to generate some data values perturbed by noise:

data = Flatten[Table[{x, t,
     Random[Real, {-0.01, 0.01}] + mgt[6][x, t]},
    {x, 0.2, 0.8, 0.3}, {t, 0.1, 0.7, 0.2}],1];

and we can successfully use FindMinimum to optimise alpha against data:

leastsquares[alpha_?NumericQ] :=
  Plus @@ Apply[(mgt[alpha][#1, #2] - #3)^2 & , data, {1}]

FindMinimum[leastsquares[alpha], {alpha, -1.5, -2}]

{0.000442707, {alpha->6.0014}}

What about nonlinear regression?

<<Statistics`NonlinearFit`

NonlinearRegress[data, mgt[alpha][x, t], {x, t},{alpha, -2}]

This fails, saying "SingularValues::"svdf": SingularValues has received
a matrix with infinite precision..."

I'd like to know what I am doing wrong!

Cheers,

Mike Trefry
<mike.trefry at per.clw.csiro.au>
Centre for Groundwater Studies
CSIRO Land and Water
Floreat  WA 6014
Australia




  • Prev by Date: Re: Exact value of Cos[Pi/17]
  • Next by Date: better understanding of rules
  • Previous by thread: Re: Evaluation Control
  • Next by thread: better understanding of rules