kamagra how much to take

Calculating The Second Derivatives Of A Piecewise Cubic Polynomial

The purpose of this method is to provide the faculty to calculate the second derivatives of a piecewise cubic polynomial with continuous first and second derivatives when there are known tabulation points. For more information on Spline interpolation you can view this article here. Naturally, this returns an typed double array containing the second derivatives of the interpolation function at the tabulation points. There are going to be four parameters used, a double array specifying the tabulation points, one for values of the function evaluated at the interpolation points, and the two to handle the derivative of the interpolation function consumption. There is currently a limit in this calculation with the provided arrays, but meh.

  1. public: virtual Double __gc* cubicSpline2ndDifferential(Double __gc* tabPoints __gc [], Double __gc* funcVals __gc [], Double __gc* dervAt0X, Double __gc* dervAtN) __gc []
  2. {
  3. Double __gc* place;
  4. Double __gc* holder;
  5. Int32 __gc* num = Math::Min(tabPoints->Length, funcVals->Length);
  6. Double __gc* helpArray __gc [] = __gc new Double __gc*[num];
  7. Double __gc* returnArray __gc [] = __gc new Double __gc*[num];
  8. if (dervAt0X > 9.9E+29)
  9. {
  10. returnArray[0] = helpArray[0] = 0;
  11. }
  12. else
  13. {
  14. returnArray[0] = -0.5;
  15. helpArray[0] = ((3 / (tabPoints[1] - tabPoints[0])) * (((funcVals[1] - funcVals[0]) / (tabPoints[1] - tabPoints[0])) - dervAt0X));
  16. }
  17. for (Int32 __gc* i = 1; (i < (num - 1)); i++)
  18. {
  19. Double __gc* calcedTab = ((tabPoints[i] - tabPoints[(i - 1)]) / (tabPoints[(i + 1)] - tabPoints[(i - 1)]));
  20. Double __gc* calcedArray = ((calcedTab * returnArray[(i - 1)]) + 2);
  21. returnArray[i] = ((calcedTab - 1) / calcedArray);
  22. helpArray[i] = (((funcVals[(i + 1)] - funcVals[i]) / (tabPoints[(i + 1)] - tabPoints[i])) - ((funcVals[i] - funcVals[(i - 1)]) / (tabPoints[i] - tabPoints[(i - 1)])));
  23. helpArray[i] = ((((6 * helpArray[i]) / (tabPoints[(i + 1)] - tabPoints[(i - 1)])) - (calcedTab * helpArray[(i - 1)])) / calcedArray);
  24. }
  25. if (dervAtN > 9.9E+29)
  26. {
  27. place = holder = 0;
  28. }
  29. else
  30. {
  31. place = 0.5;
  32. holder = ((3 / (tabPoints[(num - 1)] - tabPoints[(num - 2)])) * (dervAtN - ((funcVals[(num - 1)] - funcVals[(num - 2)]) / (tabPoints[(num - 1)] - tabPoints[(num - 2)]))));
  33. }
  34. returnArray[(num - 1)] = ((holder - (place * helpArray[(num - 2)])) / ((place * returnArray[(num - 2)]) + 1));
  35. for (Int32 __gc* j = (num - 2); (j >= 0); j--)
  36. {
  37. returnArray[j] = ((returnArray[j] * returnArray[(j + 1)]) + helpArray[j]);
  38. }
  39. return returnArray;
  40. }

~~ 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>