       Re: Rationalized Fitting

• To: mathgroup at smc.vnet.net
• Subject: [mg125437] Re: Rationalized Fitting
• From: Darren Glosemeyer <darreng at wolfram.com>
• Date: Wed, 14 Mar 2012 00:35:52 -0500 (EST)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com
• References: <jhienb\$b3o\$1@smc.vnet.net> <201203130801.DAA12723@smc.vnet.net>

```On 3/13/2012 3:01 AM, Antonio Alvaro Ranha Neves wrote:
> No reply? Guess it's harder than it looks.
>
>
> On Thursday, February 16, 2012 9:28:27 AM UTC+1, Antonio Alvaro Ranha Neves wrote:
>> Hello group members and advanced users,
>>
>> Recently, I was trying to obtain the best fitting function with rational parameters, without success. I tried something like,
>>
>> NoisyParabola =
>>   Table[{x, (Prime/Prime + x Prime/Prime +
>>        Prime/Prime x^2)*RandomReal[{.95, 1.05}]}, {x, 1, 10,
>>     1/4}]
>> NLMFit = NonlinearModelFit[NoisyParabola,
>>    Rationalize[a, 10^-6] + x Rationalize[b, 10^-6] +
>>     Rationalize[c, 10^-6] x^2, {a, b, c}, x]
>> NLMFit["ParameterTable"]
>>
>> The main idea is to obtain the fitting coefficients (a,b,c) whose standard deviation (da,db,dc), would yield a fitting result of a best fit rational Rationalize[a,da]. But I fail to see how I can get this interactively.
>>
>> Hope I made myself clear,
>> Thanks,
>> Antonio
>

You could rationalize the end result, e.g.

Rationalize[NLMFit["ParameterTable"], 10^-6]

a, b and c in the model are inexact numbers which get rationalized in
the formula. Since the model is actually linear in the parameters, you
could use LinearModelFit with WorkingPrecision->Infinity to get an exact
result but that will include huge Root object expressions, so you would
still need to rationalize an inexact numeric approximation of the result
like in the following to get rationals.

lm = LinearModelFit[NoisyParabola, {x, x^2}, x,
WorkingPrecision -> Infinity];
Rationalize[N[lm["ParameterTable"], 20], 10^-6]

Darren Glosemeyer
Wolfram Research

```

• Prev by Date: Re: Map onto a column
• Next by Date: Mathematica and square roots
• Previous by thread: Re: Rationalized Fitting
• Next by thread: Re: Rationalized Fitting