MathGroup Archive 2008

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

Search the Archive

Re: FindFit

  • To: mathgroup at smc.vnet.net
  • Subject: [mg92748] Re: [mg92733] FindFit
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Sun, 12 Oct 2008 04:32:21 -0400 (EDT)
  • Reply-to: hanlonr at cox.net

As stated in the documentation: "In the nonlinear case, it finds in general only a locally optimal fit."

data = Table[
   Simplify[Expand[(1/2) ((1 + Sqrt[13])^(2^n) + (1 - Sqrt[13])^(2^n))]], {n, 
    1, 6}];

model = (1/2) ((a + Sqrt[b])^(2^x) + (a - Sqrt[b])^(2^x));

FindFit[data, model, {a, b}, x]

{a->1.79057,b->2.58114}

Add constraints and use NMinimize to look beyond the local minima

FindFit[data, {model, a > 0, b > 10}, {a, b}, x, Method -> NMinimize]

{a->1.05257,b->12.6236}

Fix one parameter and look for best fit to other

FindFit[data, model /. a -> 1, b, x, Method -> NMinimize]

{b->13.}


Bob Hanlon

---- Artur <grafix at csl.pl> wrote: 

=============
Dear Mathematica Gurus,
Who have idea which procedure I can use inspite FindFit in following:
In[1]: Table[Simplify[Expand[(1/2) ((1 + Sqrt[13])^(2^n) + (1 - 
Sqrt[13])^(2^n))]], {n, 1, 6}]
Out[1]: {14, 248, 102272, 20489142272, 839425017825619607552,
1409268686920894404615927074915795024740352}
In[2]: FindFit[{14, 248, 102272, 20489142272, 839425017825619607552,
  1409268686920894404615927074915795024740352}, (1/
    2) ((a + Sqrt[b])^(2^x) + (a - Sqrt[b])^(2^x)), {a, b}, x,
 WorkingPrecision -> 100]
Out[2]:{a -> 2.43785286368448657933626328600,
 b -> 4.95343824602875750402007143975}

Should be: {a -> 1.00000000000000000000,
 b -> 13.000000000000000000}

Who have idea how find (true) a,b when I have sequence
Best wishes
Artur


--

Bob Hanlon



  • Prev by Date: Re: Roots of polynomial equations with complex coefficients
  • Next by Date: Re: Executing external notebook
  • Previous by thread: Bug in Manipulate with Trigger control?
  • Next by thread: naive question