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.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
+
}
239
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