I need a 4-component vector with components other than 1.0 that sums to an integer or regular magnitude

28 Views Asked by At

I need a 4-component linear algebra vector, with no more than 1 component equal to 1.0, that sums to an integer or regular magnitude/length. By "regular", I mean finite and non-repeating; any decimal ending also needs to be some order of powers of 2. In addition, and to cover all cases, no component should be equal to zero.

The purpose is to ensure that my program is correct, as computers do not always calculate decimal square roots correctly. However, the question itself seems more mathematical than code-related, so I put it here. My apologies if that was incorrect.

1

There are 1 best solutions below

0
On BEST ANSWER

The vector $(3,4,12,84)$ has Euclidean length $\sqrt{3^{2}+4^{2}+12^{2}+84^{2}} = 85$