##### Spotlight todayNovember 11, 2019

#### Joint Enterprise Defense Infrastructure – Office 365 Global Principles, Rules and Priorities

The Department of Defense has resources that are designed to be operational in an attempt to successfully manage the missions that they have set as goals within the department. The ability for these various solutions to work across all of the different operations of the department. This type of goal [...]

# Calculating The Second Derivatives Of A Piecewise Cubic Polynomial

Numerical Analysis Owner todayDecember 19, 2018 23 share close

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.

[cpp]
public: virtual Double __gc* cubicSpline2ndDifferential(Double __gc* tabPoints __gc [], Double __gc* funcVals __gc [], Double __gc* dervAt0X, Double __gc* dervAtN) __gc []
{
Double __gc* place;
Double __gc* holder;
Int32 __gc* num = Math::Min(tabPoints->Length, funcVals->Length);
Double __gc* helpArray __gc [] = __gc new Double __gc*[num];
Double __gc* returnArray __gc [] = __gc new Double __gc*[num];
if (dervAt0X > 9.9E+29)
{
returnArray = helpArray = 0;
}
else
{
returnArray = -0.5;
helpArray = ((3 / (tabPoints – tabPoints)) * (((funcVals – funcVals) / (tabPoints – tabPoints)) – dervAt0X));
}
for (Int32 __gc* i = 1; (i < (num – 1)); i++)
{
Double __gc* calcedTab = ((tabPoints[i] – tabPoints[(i – 1)]) / (tabPoints[(i + 1)] – tabPoints[(i – 1)]));
Double __gc* calcedArray = ((calcedTab * returnArray[(i – 1)]) + 2);
returnArray[i] = ((calcedTab – 1) / calcedArray);
helpArray[i] = (((funcVals[(i + 1)] – funcVals[i]) / (tabPoints[(i + 1)] – tabPoints[i])) – ((funcVals[i] – funcVals[(i – 1)]) / (tabPoints[i] – tabPoints[(i – 1)])));
helpArray[i] = ((((6 * helpArray[i]) / (tabPoints[(i + 1)] – tabPoints[(i – 1)])) – (calcedTab * helpArray[(i – 1)])) / calcedArray);
}
if (dervAtN > 9.9E+29)
{
place = holder = 0;
}
else
{
place = 0.5;
holder = ((3 / (tabPoints[(num – 1)] – tabPoints[(num – 2)])) * (dervAtN – ((funcVals[(num – 1)] – funcVals[(num – 2)]) / (tabPoints[(num – 1)] – tabPoints[(num – 2)]))));
}
returnArray[(num – 1)] = ((holder – (place * helpArray[(num – 2)])) / ((place * returnArray[(num – 2)]) + 1));
for (Int32 __gc* j = (num – 2); (j >= 0); j–)
{
returnArray[j] = ((returnArray[j] * returnArray[(j + 1)]) + helpArray[j]);
}
return returnArray;
}
[/cpp]

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

Written by: Owner

Rate it

###### Previous post todayDecember 19, 2018

• 13
• 1
close

Uncategorized Owner

##### The Akismet Update Is Sucking

Is anyone else noticing this? I updated my Akismet WP plug-in sometime last week, and all of a sudden I am getting borderline 13 spams every 30 seconds in my ...

###### Similar posts todayApril 17, 2019

• 24
close

Numerical Analysis Owner

##### Calculating Polynomial Interpolation Coefficients todayJanuary 8, 2019

• 17
close

Numerical Analysis Owner