You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Assert.AreEqual(4,horizontalDerivatives.Length,"Incorrect number of points with derivative value equal to 0");
220
+
Assert.IsTrue(horizontalDerivatives[0]>=-3&&horizontalDerivatives[0]<=-2,"Spline returns wrong t value: "+horizontalDerivatives[0]+" for first point");
221
+
Assert.IsTrue(horizontalDerivatives[1]>=-1&&horizontalDerivatives[1]<=0,"Spline returns wrong t value: "+horizontalDerivatives[1]+" for second point");
222
+
Assert.IsTrue(horizontalDerivatives[2]>=0&&horizontalDerivatives[2]<=1,"Spline returns wrong t value: "+horizontalDerivatives[2]+" for third point");
223
+
Assert.IsTrue(horizontalDerivatives[3]>=2&&horizontalDerivatives[3]<=3,"Spline returns wrong t value: "+horizontalDerivatives[3]+" for fourth point");
224
+
Console.WriteLine("GetHorizontalDerivativeTValues checked out ok for cubic spline.");
225
+
}
226
+
227
+
/// <summary>
228
+
/// Tests that the min and max values for the natural spline are correct
Assert.IsTrue(minMax.Item2.AlmostEqual(ofset,0.3),"Expexted max value near ofset.");
261
+
Assert.IsTrue(minMax.Item1.AlmostEqual(ofset+period/2,0.3)||minMax.Item1.AlmostEqual(ofset-period/2,0.3),"Expexted min value near ofset +- period/2.");
262
+
//spit out the time it took to calculate
263
+
Console.WriteLine("Extrema took: "+(DateTime.Now-t).TotalMilliseconds.ToString("000.00")+" ms for "+points.ToString()+" points.");
264
+
//determine if the values are correct
265
+
varsp=it.StationaryPoints();
266
+
foreach(varxinsp)
267
+
{
268
+
//check that the stationary point falls roughly at a half period
269
+
Assert.IsTrue(Math.Abs((Math.Abs((x-ofset)*2/period)-Math.Round(Math.Abs(x-ofset)*2/period,0))).AlmostEqual(0,0.3),"Stationary point found outside of period/2 for x="+x.ToString());
270
+
}
271
+
}
272
+
273
+
/// <summary>
274
+
/// Generates a set of points representing an oscilating decaying function
275
+
/// </summary>
276
+
/// <param name="amplitude">The max amplitude</param>
277
+
/// <param name="period">The period of oscilation</param>
278
+
/// <param name="decay">The decaying exponent, the larger the value the faster the functioon decays</param>
279
+
/// <param name="minX">The min value for X</param>
280
+
/// <param name="maxX">The max value for X</param>
281
+
/// <param name="ofset">The x - ofset of the max value of the function</param>
282
+
/// <param name="points">The number of points to generate, must be greater than 1</param>
0 commit comments