Mike wrote: "I don't see a direct relation to Newton interpolation (say),
though there are some similarities".
No, it is not interpolation, but rather the linear relationship between sums of
powers and elementary symmetrical polynomials.
https://en.wikipedia.org/wiki/Newton%27s_identities
Thanks.
Bo
Den torsdag den 27. august 2020 09.27.36 CEST skrev 'Michael Day' via
Programming <[email protected]>:
Sorry for previous post a few minutes ago - I pressed send before typing!
Yes, true - about wasting the last element. Also, I realise I'd
defined ∆S wrongly
in my attempt at analysing the process, misinterpreting (}. % {. as (}.
% }:) ) .
Apologies for both...
Mike
On 27/08/2020 08:02, 'Bo Jacoby' via Programming wrote:
> Mike wrote: "I don't like losing the last element of s - we're just
>wastingthat calculation."
> The last element of vector s does not enter into the matrix m, but (%.m)s
> needs the last element of s.
> Thanks!
> Bo
>
> Den tirsdag den 25. august 2020 04.07.55 CEST skrev 'Bo Jacoby' via
>Programming <[email protected]>:
>
> Thanks to Mike and Raul!
> Mike asked: "Can you provide a reference for your generalised statistics?" No
> sir, I gave myself the task: "find 3 numbers having the same mean powers as
> those of a given dataset", and I also solved it myself. I appreciate the help
> from the programming forum for cleaning up my smelly code.
>
>
>
>
>
> U=.summary@tomb NB. for brevity
>
>
>
> power=.(^/>:@i.)~
>
>
> mean=.+/%#
> 3 mean@power #~i.5
> 3 10 35.4
> 3 mean@power 3 U #~i.5
> 3 10 35.4
>
>
> 3 U #~i.5 NB. these 3 numbers solve the problem
>
>
>
>
> 1.61014 3.4686 3.92126
>
>
>
> Raul's example:
>
> 3 mean@power a=.0 1 2 3 4 5 6 7 8 9 10 20 20 20 20 20
>
> 9.6875 149.063 2689.06
> 3 U a NB. this answers the question
> 1.92566 7.43347 19.7034
> 3 mean@power 3 U a NB. the same mean powers as a .
>
> 9.6875 149.063 2689.06
> 3 mean@power 4.77812 13.4155 10.8689 NB. not right
> 9.68751 106.98 1269.18
>
>
> 1 U a NB. mean value
> 9.6875
> 4 U a
> 1.90665 3.98091 12.1419 20.7206
> 3 mean@power 4 U a NB. the same mean powers as a .
> 9.6875 149.062 2689.06
>
>
> Thanks.
> Bo.
>
>
> Den mandag den 24. august 2020 20.37.04 CEST skrev 'Michael Day' via
>Programming <[email protected]>:
>
> More particularly - re - Bo Jacoby's original statement on 21/8/20.
> Probably not
> relevant if you haven't followed this branch of the thread.
>
> On the code-smelliness topic - no anosmia here! - I've been nurdling
> away at
> your (Bo's) functions for generalisation of summary stats, even though
> not yet
> understanding what mathematical problem you're solving.
>
> So far I've got: (using fixed font...)
>
> NB. stomb to replace s @ tomb
> stomb =: (% #) * (+/@:(^/) >:@i.)~
>
> NB. Ma to replace m
>
> NB. managing to treat i. as a common element,
>
> NB. albeit needing to modify it for some steps
>
> Ma =: |:@(((_1 ^ [) * (0 - [) |.!.0"0 1 (,"0 1~ >:)~) }:)~ i.@#
>
> cf
>
> m f. NB. original
> |:@(|: |.!.0"0 1~ -@i.@#)@((* (_1 ^ i.@#))"1@(>:@i.@# , }:)@|:@($~ (2 # #)))
>
> [data =. #~ i.5
> 1 2 2 3 3 3 4 4 4 4
> 3 stomb data
> 9 30 106.2
> 3 s @ tomb data
> 9 30 106.2
>
> 3 Ma @ stomb data
> 1 0 0
> 9 _2 0
> 30 _9 3
>
> 3 m @ s @ tomb data
> 1 0 0
> 9 _2 0
> 30 _9 3
> But - I don't like losing the last element of s - we're just wasting
> that calculation.
>
>
> As for the maths - you've got numbers ni associated with indices i e. i.N
> Let Sk = sum over i of ni.i^k for k e. i. m + 1
> Then ∆Sk = m Sk % S[k-1] for k e. 1 + i.m ( ∆ is Delta if the
> formatting fails!)
>
>
> matrix M is [ 1 0 0 0 ...]
>
> [∆S1 -2 0 0 ...]
>
> [∆S2 -∆S1 3 0 ...]
>
> [∆S3 -∆S2 ∆S1 -4 ...]
>
> ............
>
> [..... ..... ...]
>
>
> You then solve for vector b in
>
> ∆S = M matprod b
>
> so we have
>
> ∆S1 = b1
> ∆S2 = b1 ∆S1 - 2 b2
> ∆S3 = b1 ∆S2 - b2 ∆S1 + 3 b3
> ....
>
>
> You then append 1 to b, presumably defining a coefficient, b0 = 1 ,
>
> and then find - and negate - the roots of the polynomial
>
> b0 x^m + b1 x^(m-1) + ... + bm = 0 (I think)
>
>
> Why? I don't see a direct relation to Newton interpolation (say),
> though there
>
> are some similarities. Can you provide a reference for your generalised
> statistics?
>
>
> Thanks,
>
> Mike
>
>
>
> On 23/08/2020 15:58, 'Bo Jacoby' via Programming wrote:
>> Raul wrote: "Generalized how?"
>> The special case n=1 of n&(summary@tomb) is the mean value (+/%#).So the
>> general case n&(summary@tomb) is a generalized mean value.
>> Correctness:
>>
>> 1 summary@tomb a=. (i.11) ,5#20
>>
>>
>> 9.6875
>>
>> (+/%#) a
>> 9.6875
>>
>> 1 summary@tomb 3 summary@tomb a9.6875
>>
>>
>> ((+/%#) 3 summary@tomb a) = (+/%#) a
>>
>> 1
>>
>>
>>
>> 3 summary@tomb a1.92566 7.43347 19.7034
>>
>> (+/%#)1.92566 7.43347 19.70349.68751
>>
>> 1 summary@tomb 1.92566 7.43347 19.7034
>> 9.68751
>>
>> Thanks!
>> Bo
>>
>>
>>
>>
>> Den søndag den 23. august 2020 10.01.24 CEST skrev Raul Miller
>><[email protected]>:
>>
>> For example, consider this crude mechanism:
>>
>> partmean=:4 :0
>> m=. (+/%#) y
>> b=. <.(x%n)*i.#y
>> w=. b (+/%#)/. /:~ y
>> x * m * w%+/w
>> )
>>
>> 3 partmean 0 1 2 3 4 5 6 7 8 9 10 20 20 20 20 20
>> 2.38217 7.62295 19.0574
>>
>> Correct? Incorrect? How would I know?
>>
>> Note that the calculation for b could be replaced, for example:
>>
>> arbmean=:4 :0
>> m=. (+/%#) y
>> b=. ?. (#y) # x
>> w=. b (+/%#)/. y
>> x * m * w%+/w
>> )
>>
>> 3 arbmean 0 1 2 3 4 5 6 7 8 9 10 20 20 20 20 20
>> 4.77812 13.4155 10.8689
>> (+/%#)3 arbmean 0 1 2 3 4 5 6 7 8 9 10 20 20 20 20 20
>> 9.6875
>>
>> Thanks,
>>
--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm