Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If your numbers are discrete, and properly spaced, and drawing from a limited subset, there are other possibilities.</p> <p>If you're guaranteed that a, b, and c are integers for instance, then you can multiply the vector by itself to get an odd power and then dot it with &lt;1, 1, 1>. If we multiply it by itself 4 times, for instance, it will give you &lt; a^5, b^5, c^5 >. If |a| is the largest and |a|=2, then we know that b and c will be 1 or 0, so the value of a^3 will dominate and the dot product will have its sign. For instance, if X= &lt; a=-2, b=1, c=0 > , then X^5 = &lt;-32, 1, 0>. When you dot this with &lt;1, 1, 1> you get -31, whose sign reflects that of the largest absolute value. As the absolute value of the largest number increases, the disparity between it and the other terms will tend to converge - for instance, if we have &lt;-8, 7, 7>, then the algorithm above gives X^5=&lt;-32768, 16807, 16807>, you dot that with &lt;1, 1, 1> and get 846, so the algorithm fails with exponent 5. If we bump the exponent up to 7, we get &lt;-2097152, 823543, 823543>, dotted with &lt;1, 1, 1> gives us -450066, which is the correct answer. Eventually round-off errors will also break this method. But I'm hoping it might give some insights into other alternatives, if you know the limits on your dataset.</p> <p>As a footnote, remember that X^5 = (X*X) * (X*X) * X, so you do one multiply to get X^2, multiply that by itself to get X^4, and then multiply by X - three multiplies total. You need an odd exponent to preserve sign.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload