2
$\begingroup$

I have a list r = {114.49, 311.876, 538.704} whose elements are multiples of a non-integer value. I want to find the common denominator k satisfying r = k n where each element of n is the sum of squares of three integers that are all even or all odd. But error can be tolerated to some degree as r itself is not exact.

My first attempt

Rationalize[#, 0.01] & /@ (r/First@r)
(* {1, 19/7, 33/7} *)

Changing the tolerance will change the end result but none of them satisfied my criterion.

My second attempt (sort of like the Euclidean algorithm)

Sort@Nest[DeleteDuplicates[
 Join[Abs[Subtract @@ # & /@ Subsets[#, {2}]], #], 
 Abs[#1 - #2] < 5. &] &, r, 4]
{*24.0098, 29.4429, 53.4527, 61.0373, 85.0471, 90.4802, 114.49, \
  136.348, 143.933, 167.943, 175.527, 197.386, 204.97, 226.829, \
  250.838, 258.423, 280.281, 287.866, 311.876, 341.319, 365.328, \
  372.913, 394.771, 402.356, 426.366, 455.809, 479.818, 485.251, \
  509.261, 538.704*}

But I think the error piled up after each subtraction that 24.0098 is not really a common denominator.

So what else can I do?

P.S. I listed the first 50 possible values of n below, just for the reference

{3, 4, 8, 11, 12, 16, 19, 20, 24, 27, 32, 35, 36, 40, 43, 44, 48, 51, \
52, 56, 59, 64, 67, 68, 72, 75, 76, 80, 83, 84, 88, 91, 96, 99, 100, \
104, 107, 108, 115, 116, 120, 123, 128, 131, 132, 136, 139, 140, 144, \
147}
$\endgroup$
2
$\begingroup$

Something like the Millikan experiment:)

r = {114.49, 311.876, 538.704}; 
even = Select[Tr /@ Tuples[Range[0, 100, 2]^2, 3] // Union, 0 < # < 538 &];
odd =  Select[Tr /@ Tuples[Range[1, 100, 2]^2, 3] // Union, # < 538 &];
alleven = Subsets[even, {3}];
allodd  = Subsets[odd, {3}];

Min@(Variance[r/#] & /@ alleven)
(* 7.26497*10^-6 *)

Min@(Variance[r/#] & /@ allodd)
(* 0.0000239237 *)

Then it's an even combination.

or = First@Ordering@(Variance[r/#] & /@ alleven);
alleven[[or]]
(* {100, 272, 472} *)

and

r/alleven[[or]]
(* {1.1449, 1.1466, 1.14132} *)

So we can find your best k as:

Minimize[Norm[k alleven[[or]] - r], k]
(* {1.26427, {k -> 1.14271}} *)
$\endgroup$
  • $\begingroup$ Millikin was using number theory albeit not overtly (simultaneous diophantine approximation), but fortunately did not also have sums of three squares to contend with. $\endgroup$ – Daniel Lichtblau Oct 12 '15 at 22:06
  • $\begingroup$ @DanielLichtblau I remember trying to follow those nasty oil drops on the microscope . No fun nor dophantine problems there :) $\endgroup$ – Dr. belisarius Oct 12 '15 at 23:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.