[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
finding approximate 'least common factor'
From: |
Przemek Klosowski |
Subject: |
finding approximate 'least common factor' |
Date: |
Tue, 24 May 2011 11:41:05 -0400 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b2 Thunderbird/3.1.10 |
I have numbers which are approximately (but not exactly) an integer
number of some basic quantity. How would you estimate that basic
quantum? For instance, if the data is:
a= [5500 3800 3300 3800 4000 5500 2600 3800 5500 2500 4000 6000 4000 450
1550 1000 3800 5300 5300 1800 3800 1550 2500 3300 1300 2500 3300 2500
1550 5500 2200 3500 3300 2200 1300 800 2200 1000 2500 5300 3000 2200
2200 2200 4000 2400 2200 5500 4000 800 2200 2600 450 450 ]
All I could come up with is to look at all the candidates (s) and plot
the sum of squares (d) of the integer quotient residuals (c) against the
value of the candidates:
s=50:50:2400; for i=1:length(s); c=a./s(i); d(i)=sumsq(c-round(c)); end
plot(s,d)
the minima on this plot show values that fit in mostly integer multiples
into the numbers in a(), so I am eyeballing the underlying quantum to be
650---but this is very qualitative.
Can anyone think of a more precise numerical algorithm?
- finding approximate 'least common factor',
Przemek Klosowski <=