Quantcast
Channel: Math.NET Numerics
Viewing all articles
Browse latest Browse all 971

New Post: Is the reference point (x, y) above or below the non-linear equation?

$
0
0
The problem is that in order to decide whether the point is above or below, you need to define the exact curve instead of just a few points.

The simplest approach would be to connect the closest points with straight lines, i.e. a linear spline interpolation. Or a cubic spline if the curve needs to be smooth (you mentioned "non-linear"). Using the interpolation you can then compute y' = f(x) for the curve, and compare this with your y value.
var spline = Interpolate.CubicSpline(new[] {0.0, 4.0, 9.0, 16.0}, new[] {10.0, 7.0, 12.0, 10.0});

spline.Interpolate(5.0).Dump(); // 7.519
spline.Interpolate(12.0).Dump(); // 12.621
Thanks,
Christoph

Viewing all articles
Browse latest Browse all 971

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>