MathGroup Archive 2003

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

Search the Archive

Re: upper and lower bound for the unknowns

  • To: mathgroup at smc.vnet.net
  • Subject: [mg42399] Re: upper and lower bound for the unknowns
  • From: Bill Rowe <listuser at earthlink.net>
  • Date: Fri, 4 Jul 2003 01:33:16 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On 7/3/03 at 6:10 AM, ce.choa.phen.kee at philips.com wrote:

> Anyone has any idea of giving a range for the A and B values as follows??

> NonlinearFit [data , (A*Exp[1/(wx)]) / (B-x)^2 , {x,1/(wx)} , {{A,3} , 
> {B,600}}]

> I tried putting upper and lower bound inside the function i.e {{A , 0 , 4} 
> , {B , 55 , 180}} but it gave me error message. May I know what has gone 
> wrong??

It is difficult to know how to answer for several reasons. First, you have not stated what the error message was. Second, it isn't really clear what you are trying to achieve.

It appears you may be trying to find the best fit parameters within a pre-specified range. That is you want a value for A between 0 and 4 that gives the minium least squares result even though there may be a value outside this range that gives a lower least squares sum. If so, you should be aware the functions in the package Statistics`NonlinearFit` don't do this.

For example, consider the following:

In[1]:=
data = Table[{x, Exp[2*x]}, {x, 0, 2, 0.1}]; 

In[2]:=
<< "Statistics`"

In[3]:=
NonlinearFit[data, Exp[b*x], {x}, {b, 5, 6}]

Out[3]=
E^(2.*x)

Clearly, NonlinearFit found the correct value for b even though directred to search in a range that did not include the correct value.

If you want to restrict possible values to a pre-specificed range you will need to use something other than NonlinearFit. You could write your own function for computing the sum of squares and use NMinimize to search for the minium.


  • Prev by Date: NestWhile and FindRoot[Integrate]
  • Next by Date: programming in mathematica
  • Previous by thread: Re: upper and lower bound for the unknowns
  • Next by thread: Re: Mathematica fonts are not properly installed version=2.55