       Re: FindFit

• To: mathgroup at smc.vnet.net
• Subject: [mg92752] Re: [mg92733] FindFit
• From: danl at wolfram.com
• Date: Sun, 12 Oct 2008 04:33:05 -0400 (EDT)
• References: <200810100835.EAA07169@smc.vnet.net>

```> Dear Mathematica Gurus,
> Who have idea which procedure I can use inspite FindFit in following:
> In: Table[Simplify[Expand[(1/2) ((1 + Sqrt)^(2^n) + (1 -
> Sqrt)^(2^n))]], {n, 1, 6}]
> Out: {14, 248, 102272, 20489142272, 839425017825619607552,
> 1409268686920894404615927074915795024740352}
> In: 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:{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

There might be other methods that give better results but regardless, I
would recommend rescaling. As it is, you will get results weighted much
more heavily towards matching the larger terms. To avoid this problem a
reasonable thing would be to match the logs instead.

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

In:= fit =
FindFit[Log[ftab],
Log[(1/2) ((a + Sqrt[b])^(2^x) + (a - Sqrt[b])^(2^x))], {a, b}, x,
WorkingPrecision -> 100]

Out= {a -> \
-0.9999999999999999999999999999999999999999999999999999999999999999999\
9949814992518344284926007654753938,
b -> 13.0000000000000000000000000000000000000000000000000000000000000\
0000000296782411420663054652545138944}

In general one might need to use Abs[model function] when logarithms are
involved, so as to avoid wandering off the real axis (and thus annoying
the various FindFit deities).

Daniel Lichtblau
Wolfram Research

```

• Prev by Date: Re: error region in parametric plot
• Next by Date: Re: Inconsistent syntax for Row and Column?
• Previous by thread: Re: FindFit
• Next by thread: Re: Unevaluated subtleties