May 26, 200620 yr Would someone help me determine the formular for a curve that plots to these values:If Miles = 0, then Offset = 5;If Miles = 10, then Offset = 500;If Miles = 20, then Offset =2000.I would like to have a formula that would calculate the Offset for any known value of Miles between 0 and 20 and would be xml friendly.Thanks,Glenn
May 26, 200620 yr Hi,(Long tima ago??????????????????????)Looks like something as a parabole:y = ax2 + b Jan"Beatus ille qui procul negotiis..." Jan "Beatus ille qui procul negotiis..."
May 26, 200620 yr Commercial Member >Would someone help me determine the formular for a curve that>plots to these values:>If Miles = 0, then Offset = 5;>If Miles = 10, then Offset = 500;>If Miles = 20, then Offset =2000.>I would like to have a formula that would calculate the Offset>for any known value of Miles between 0 and 20 and would be xml>friendly.>Thanks,>Glenn>What you're wanting to do is called forecasting in statistics.It's not really complex... but it would be in XML. I don't do XML... but I do C... here's a C version... maybe you can translate it?FLOAT64 Offset_By_Miles(FLOAT64 miles_index){ FLOAT64 Miles[3] = {0,10,20}; FLOAT64 Offset[3] = {5,500,2000}; int i; FLOAT64 sx, sy, xmean, ymean, sxx, sxy, syy, x, y; FLOAT64 B0, B1; //{compute basic sums} sx = 0.0; sy = 0.0; sxx = 0.0; sxy = 0.0; syy = 0.0; for (i = 0; i < 3; i++) { x = Miles; y = Offset; sx = sx+x; sy = sy+y; sxx = sxx+x*x; syy = syy+y*y; sxy = sxy+x*y; } xmean = sx/(float)3; <<- number of items ymean = sy/(float)3; sxx = sxx-(float)3*xmean*xmean; syy = syy-(float)3*ymean*ymean; sxy = sxy-(float)3*xmean*ymean; //{check for zero variance} if (sxx <= 0.0) { // bad return 0; } B1 = sxy/sxx; B0 = ymean-B1*xmean; // forecast Y based on X; return B0+B1*miles_index; //2049.75} Ed Wilson Mindstar AviationMy Playland - I69
May 26, 200620 yr Glenn,(miles) sp0l0 sqr 5.025 * l0 0.75 * - 5 + (>Offset)2nd order polinomial, R2=1Hope this helps.Tom
May 26, 200620 yr Hi,Tom was first!Old dutch mathematics for parabole:y (offset) = ax2 + bx + cYour data 0-5; 10-500; 20-2000So c = 5and after some calc a = 5.025 and b = -0.75That gives y = 5.025 * Miles2 - 0.75 * miles + 5 in xml:(L:Miles,number) (L:Miles,number) * 5.025 * (L:Miles,number) 0.75 * - 5 + (>L:Offset,number) "Mustard after meal"Jan"Beatus ille qui procul negotiis..." Jan "Beatus ille qui procul negotiis..."
May 26, 200620 yr ""and after some calc""Not too much calcs indeed, aprox. 30 secs to find the formula in Excel. :-)Tom
May 28, 200620 yr Yeah Tom got in before me, but if you plot curves in Excel it can tell you the formula, especially if it has a regular mathematical shape.cheers,nick
May 29, 200620 yr My daughter has been praising Excel for years. They gave me MS Office for Christmas because my old Word 97 was coughing up blood if graphics got a bit heavy. I've never run anything in the Office suite other than Word. I always thought Excel was just a spreadsheet for business applications such as taxes, etc. I'll definitely look into it now. Thanks for the tip.Glenn
Create an account or sign in to comment