The issue was that I was using points.ElementAt(i).X.Sum; instead of points.ElementAt(i).X.ToArray().ElementAt(1). The solutions to the functions were returned in an array.
Calling all cars.
Here's what I'm up against. I'm creating an app that simulates gravitational waves. I can simulate a simplified version of these events algebraically but to simulate the real interesting things, I need to use ODE's. And it needs to do a lot of calculations quickly.
The trouble is, I don't have the money to afford some $1000 math suite.
BUT, I did find a library that seemed perfect!
Microsoft OSLO: https://www.microsoft.com/en-us/research/project/open-solving-library-for-odes/
var sol = Microsoft.Research.Oslo.Ode.RK547M(
0,
new Vector(0.0, initDisplacement),
(t, x) => new Vector(
x[1], //the first derivative of x is velocity
-Math.Pow(angFreq, 2) * x[0])); //The angular frequency squared times x as a function of time gives you the derivative of velocity (which is acceleration).
var points = sol.SolveFromToStep(0.0, 10, stepSize).ToArray();
double[] xBuffer = new double[points.Length];
double[] yBuffer = new double[points.Length];
for(int i = 0; i<points.Length; i++)
{
//adding the points based x,y to the series
xBuffer[i] = points.ElementAt(i).T;
yBuffer[i] = points.ElementAt(i).X.Sum;
}
But when I tried to use it to graph Simple Harmonic Motion (SHM) as a test, the graph didn't look right. Displacement should never go over initial displacement in this representation of SHM but it does. Maybe I'm doing something wrong, but for the life of me, I don't know what it is.
So I was wondering... If there are any people better at math than me on here... could you take a look at that Microsoft Library and see if you could graph SHM? Or if you've ever made a Xamarin App that did a lot of complex math, recommend me a library?
I've tried Rychusoft.NumericalLibraries.Differential from NuGet which is amazing but won't work for what I need it for.
I've also tried this https://github.com/OlegJakushkin/CSharpOdeLibrary which would be perfect but it uses come C++ code that is called by C# and I can't get that to work either.
Thanks for checking this thread out,
Nick