[Jprogramming] Takes from a mystery sequence
Kip Murray
km at math.uh.edu
Fri Aug 21 10:03:03 HKT 2009
Still, it doesn't hurt to check with differences. Maybe it IS a polynomial!
And a polynomial may be a good practical fit for a take of the sequence.
Roger Hui wrote:
> Quite often the best "explanation" for a sequence
> is not a low degree polynomial. An example from
> several days ago was s=: [: p: _1 + 2 ^ i.
> s1=: 2^i. would be a even shorter example.
>
>
>
> ----- Original Message -----
> From: Kip Murray <km at math.uh.edu>
> Date: Thursday, August 20, 2009 8:09
> Subject: Re: [Jprogramming] Takes from a mystery sequence
> To: Programming forum <programming at jsoftware.com>
>
>> P.S. Well, any data has an exact polynomial fit, so maybe I
>> should have said
>> "exact low degree polynomial fit". Maybe what I want is a
>> verb whose left
>> argument n requests a fit of degree n or less for the right argument.
>>
>> Kip Murray wrote:
>>> Thank you, Ambrus, I will study your verbs. Of course I
>> would like the lowest
>>> degree that fits the data. I'm assuming data that has an
>> exact polynomial fit.
>>> Kip
>>>
>>> Zsbán Ambrus wrote:
>>>> On Tue, Aug 18, 2009 at 11:27 PM, Kip
>> Murray<km at math.uh.edu> wrote:
>>>>> Have you seen a polynomial-fitting verb for data such as
>> iii0 10 and iii1 10 ?
>>>> Sure, and it's quite simple:
>>>>
>>>> se0=: 1 4 7 10 13
>> 16 19 22 25 28
>>>> se1=: 0 4 20 54 112 200 324 490 704 972
>>>> ]p0 =: (%.[:^/~i.@#) se0
>>>> 1 3 7.97184e_8 _7.964e_8 4.15017e_8 _1.25439e_8 2.27913e_9
>>>> _2.45331e_10 1.44069e_11 _3.55401e_13
>>>> p0 p. i. 10
>>>> 1 4 7 10 13 16 19 22 25 28
>>>> ]p1 =: (%.[:^/~i.@#) se1
>>>> _7.96167e_11 2.1526e_7 3 1 _2.66006e_7 7.83796e_8 _1.39068e_8
>>>> 1.46474e_9 _8.43371e_11 2.04392e_12
>>>> p1 p. i. 10
>>>> _7.96167e_11 4 20 54 112 200 324 490 704 972
>>>> NB. or, if you want lower degree polynomyals
>>>> ]p0d2 =: (%.2^/&i.~#) se0
>>>> 1 3
>>>> p0d2 p. i. 10
>>>> 1 4 7 10 13 16 19 22 25 28
>>>> ]p1d4 =: (%.4^/&i.~#) se1
>>>> 1.3074e_12 _2.50111e_12 3 1
>>>> p1d4 p. i. 10
>>>> 1.3074e_12 4 20 54 112 200 324 490 704 972
>>>>
>>>> Ambrus
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
More information about the Programming
mailing list