Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*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 2004

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

Search the Archive

Re: Re: NonlinearFit problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg52092] Re: [mg52074] Re: NonlinearFit problem
  • From: DrBob <drbob at bigfoot.com>
  • Date: Wed, 10 Nov 2004 04:45:46 -0500 (EST)
  • References: <cmnabi$7sn$1@smc.vnet.net> <200411090637.BAA22873@smc.vnet.net>
  • Reply-to: drbob at bigfoot.com
  • Sender: owner-wri-mathgroup at wolfram.com

> It is the first data point that is causing the problem. As the error
> message says, the Jacobian
>
> Outer[D, {r^a Exp[-b r]}, {a, b}]

I think that's the gradient, while this is the Jacobian:

First@Outer[D, {r^a Exp[-b r]}, {a, b}, {a, b}]

{{(r^a*Log[r]^2)/E^(b*r),
    (-E^((-b)*r))*r^(1 + a)*
     Log[r]}, {(-E^((-b)*r))*
     r^(1 + a)*Log[r],
    r^(2 + a)/E^(b*r)}}

It does seem as if Mathematica would complain about the gradient before the Jacobian, though.

Bobby

On Tue, 9 Nov 2004 01:37:48 -0500 (EST), Paul Abbott <paul at physics.uwa.edu.au> wrote:

> In article <cmnabi$7sn$1 at smc.vnet.net>,
>  Feng-Yin Chang <fychang at slac.stanford.edu> wrote:
>
>> Hi All,
>>    Could anyone give me any suggestion for the specified  fitting function
>>    f= r^a Exp[-b r]?
>>    My data point was given below,
>>    data={{0, 1.00002}, {2.31507, 26.4522}, {4.32033, 56.8265}, {6.63539,
>>     59.6674}, {8.64066, 39.5536}, {10.9557, 21.6862}, {12.961,
>>     10.1456}, {15.276, 4.39652}}
>>
>>   The following way,
>>    NonlinearFit[data,f,r,{a,b}], gives the error message,
>>    FindFit::njnum:
>>    The Jacobian is not a matrix of numbers at (a,b)={1.,1.}.
>>
>>   How should I do this fitting without the problem?
>
> It is the first data point that is causing the problem. As the error
> message says, the Jacobian
>
>   Outer[D, {r^a Exp[-b r]}, {a, b}]
>
> is not a matrix of numbers at (a,b)={1.,1.}, unless you take the limit
> as r->0.
>
> If you drop the first point, or perturb the x value away from 0, the fit
> proceeds without problem. For example,
>
>  data={{0.0001, 1.00002}, {2.31507, 26.4522}, {4.32033, 56.8265},
>        {6.63539, 59.6674}, {8.64066, 39.5536}, {10.9557, 21.6862},
>        {12.961, 10.1456}, {15.276, 4.39652}}
>
>  FindFit[data, r^a Exp[-b r], {a,b}, r]
>
> Cheers,
> Paul
>



-- 
DrBob at bigfoot.com
www.eclecticdreams.net


  • Prev by Date: Re: Re: Re: MathGroup /: Descriptive headings
  • Next by Date: Re: Converting Dates to Mathematica Format
  • Previous by thread: Re: NonlinearFit problem
  • Next by thread: Re: NonlinearFit problem