Robert M. M=FCnch wrote:
> On Fri, 23 Nov 2007 17:57:37 +0100, Sunanda <[EMAIL PROTECTED]> wrote=
:=3D
>=20
>=20
>> No time to write the code (so my hand-waving solution is
>> untested), but I'd say:
>>
>> You are clearly 8800 short of the desired target:
>=20
> Hi, that's right.
>=20
>> t: 41695.83
>> s: 6594,14 + 981,75 + 8747,39 + 1457,90 + 15114,65 + 8800
>> =3D3D=3D3D 41695.83
>>
>> So, for *minimal* typos, you need to change an 0-->8 or an 1-->9
>> in the hundreds column and thousands column of one or two of the
>> given numbers. That will affect the minimum digits: ie just two.
>>
>> There are several ways to do that, easily eyeballable, eg:
>> s: 6594,14 + 981,75 + 8747,39 + 9457,90 + 15914,65 + 0000
>> s: 6594,14 + 8981,75 + 8747,39 + 1457,90 + 15914,65 + 0000
>=20
> Here is the typo that caused the error:
>=20
> 6594,14+9781,75+8747,39+1457,9+15114,65
> ans =3D3D 41695,83
>=20
> 9781,75 - 981,75
> ans =3D3D 8800
>=20
> It was an additional 7 inserted into the 981,75 value.
>=20
>> One instance changes two 1's to 9s. The other adds a leading 8 to
>> one of the givens.
>=20
> I think one approach might be to calculate the offset and than look at =
=3D
>=20
> each number step by step to see what needs to be changed to get the off=
s=3D
> et =3D
>=20
> as difference. The assumption in this case is, that there is only one t=
y=3D
> po.
>=20
>> If that had not worked, it gets more interesting: at which point,
>> I'm off out :-)
>=20
> come on ;-)
>=20
>> But, following Tom's comment, perhaps take a look
>> at simetrics.r in the REBOL.org Script library -- it has
>> algorithms that can help rate how close strings are to each other.
>=20
> I thought about this too, but this requires a reference string/sequence=
=3D
> =3D
>=20
> which is not available in our case. Robert
in biology things not exactly the same are compared all the time
say DNA and protein. this requires translation according to biological=20
rules just as your missing reference strings require a rearrangement
according to arithmetic rules.
looking for a single mutation/ single error in one of the givens
given + delta =3D reference
where delta is derived from the 'sum' which is your overall reference
for this problem.
sum: 41695.83
val: [6594.14 981.75 8747.39 1457.90 15114.65]
valsum: 0
forall val [valsum: valsum + first val]
print valsum
print delta: sum - valsum
forall val[
candidate: round/to (delta + first val) .01
edit: difference form first val form candidate
probe reduce[first val candidate edit]
]
using a better discriminator than difference will get you a better edit
but the idea is the same.
if it is not a single edit then it grows quickly but the process is the=20
same. distribute the delta over all possible combinations and look for
cheap edits.
--
To unsubscribe from the list, just send an email to
lists at rebol.com with unsubscribe as the subject.