kamagra how much to take

Calculating Polynomial Interpolation Coefficients

The interpolation of a dataset can be examined by polynomials, which is nice because polynomials are useful for complex curves approximations. In order to get the coefficients of the polynomial, since the dataset points are known, the below InterpolatingPolynomialCoefficients method can be used. This takes in a double array of tabulation points and polynomial points.

  1. public: virtual Double __gc* InterpolatingPolynomialCoefficients(Double __gc* tabPoints __gc [], Double __gc* polyPoints __gc []) __gc []
  2. {
  3. Int32 __gc* length = Math::Min(tabPoints->Length, polyPoints->Length);
  4. Double __gc* tempArray __gc [] = __gc new Double __gc*[length];
  5. Double __gc* returnArray __gc [] = __gc new Double __gc*[length];
  6. try
  7. {
  8. for (Int32 __gc* i = 0; (i < length); i++)
  9. {
  10. tempArray[i] = returnArray[i] = 0;
  11. }
  12. tempArray[(length - 1)] = -tabPoints[0];
  13. PushToTempArray(tabPoints, length, tempArray);
  14. PushToFinalArray(tabPoints, polyPoints, length, tempArray, returnArray);
  15. }
  16. catch (ArithmeticException __gc* exception)
  17. {
  18. }
  19. return returnArray;
  20. }
  21.  
  22. private: static void __gc* PushToFinalArray(Double __gc* tabPoints __gc [], Double __gc* polyPoints __gc [], Int32 __gc* length, Double __gc* tempArray __gc [], Double __gc* returnArray __gc [])
  23. {
  24. for (Int32 __gc* calcHold = 0; (calcHold < length); calcHold++)
  25. {
  26. Double __gc* lengthHold = length;
  27. Int32 __gc* index = (length - 1);
  28. while ((index >= 1))
  29. {
  30. lengthHold = ((index * tempArray[index]) + (tabPoints[calcHold] * lengthHold));
  31. index--;
  32. }
  33. Double __gc* poolArrayAndHold = (polyPoints[calcHold] / lengthHold);
  34. Double __gc* iArray = 1;
  35. for (index = (length - 1); (index >= 0); index--)
  36. {
  37. returnArray[index] += (iArray * poolArrayAndHold);
  38. iArray = (tempArray[index] + (tabPoints[calcHold] * iArray));
  39. }
  40. }
  41. }
  42. private: static void __gc* PushToTempArray(Double __gc* tabPoints __gc [], Int32 __gc* length, Double __gc* tempArray __gc [])
  43. {
  44. for (Int32 __gc* i = 1; (i < length); i++)
  45. {
  46. IntPtr __gc* x;
  47. for (Int32 __gc* calcHold = ((length - 1) - i); (calcHold < (length - 1)); calcHold++)
  48. {
  49. tempArray[calcHold] -= (tabPoints[i] * tempArray[(calcHold + 1)]);
  50. }
  51. tempArray[*static_cast<__box Int32*>(x = *static_cast<__box IntPtr*>((length - 1)))] = (tempArray[*static_cast<__box Int32*>(x)] - tabPoints[i]);
  52. }
  53. }

~~ These are the notes from my N.A. class @ UoM ~~

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>