
Re: Help with formula (revised question)
Posted:
Nov 20, 2013 3:16 PM


On Wed, 20 Nov 2013 00:50:59 0700, "Robert Crandal" <noreply2me@yahoo.com> wrote:
>I asked a similar question earlier. Thank you >everyone who tried helping. However, I'd now >like to revise the data and requirements. >Here is the new data set: > >X Y >  >0.0 1 >0.1 1 >0.5 1 >0.9 1 >1.0 1 >1.03 2 >1.5 2 >1.8 2 >2.0 2 >2.3 3 >3.0 3 >3.2 4 > >X is a positive real number greater than or equal >to zero (or 0.0). Y is an integer as seen in the >second column above. > >Can this data be represented with a formula >that only uses either addition, subtraction, >multiplication, division, modulus, or the power (^) >function, or any combination of these? > >The function f(x) = x + (0^x) almost works, but >it needs a little bit of tweaking. > >If possible, I would like to avoid using any >abs() value functions, or max() functions, or >"ifelse" programming logic, or roundup() functions. >I'm curious if I can find a formula that only >uses basic math operators. > >I'd appreciate any ideas. Thank you!
I don't know if this is the same as the reference Peter provided but I learned this in high school as a rebuttal to those inane IQ test questions about the next number in sequence. It works for any finite number of real X and Y values.
If there are N sets of XY values, the polynomial consists of the sum of N terms, each term being a polynomial of degree N1. The ith term is the product of a quotient and a constant. The numerator of the quotient is formed as the product of factors each having the form XX(j) where j goes from 1 to N but omits i. The denominator of the quotient is formed as the product of factors each having the form X(i)X(j) for the same j. The constant this quotient is multiplied by is Y(i).
If you evaluate this polynomial at X(k), every term goes to zero, because the numerator contains the expression XX(k), except the kth term. In the kth term, the numerator and denominator evaluate to the same value so the quotient is 1 and the product is simply Y(k) as desired.
Here is a sample using just the X values of 0.0, 0.9, 1.5, and 3.2 from your data. It is probably best viewed in monospaced font.
(x0.9)(x1.5)(x3.2) y =  * 1 (0.9)(1.5)(3.2)
(x)(x1.5)(x3.2) +  * 1 (0.9)(0.6)(2.3)
(x)(x0.9)(x3.2) +  * 2 (1.5)(0.6)(1.7)
(x)(x0.9)(x1.5) +  * 4 (3.2)(2.3)(1.7)
You should have no trouble expanding this for the 12 values you provided.
 Remove del for email

