Several files renamed to match new consistency-style of preferring .hpp over .h to indicate C++ Headers
This commit is contained in:
42
include/J3ML/Algorithm/DifferentialSolvers.hpp
Normal file
42
include/J3ML/Algorithm/DifferentialSolvers.hpp
Normal file
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// Created by dawsh on 2/8/24.
|
||||
//
|
||||
|
||||
namespace J3ML::Algorithm
|
||||
{
|
||||
/// Implementations for a variety of Differential Equation Solving algorithms
|
||||
namespace Solvers
|
||||
{
|
||||
|
||||
// Consider a differential equation
|
||||
// dy/dx = (x + y + xy)
|
||||
float eq(float x, float y)
|
||||
{
|
||||
return (x + y + x*y);
|
||||
}
|
||||
|
||||
// Accelleration = Velocity / Time
|
||||
// Velocity = Position / Time
|
||||
// Position = Vector3
|
||||
|
||||
//
|
||||
|
||||
float euler(float x0, float y, float h, float x)
|
||||
{
|
||||
float temp = -0.f;
|
||||
// Iterating till the point at which we need approximation
|
||||
while (x0 < x) {
|
||||
temp = y;
|
||||
y = y + h * eq(x0, y);
|
||||
x0 = x0 + h;
|
||||
}
|
||||
return y;
|
||||
}
|
||||
|
||||
class EulerMethodSolver {};
|
||||
class SemiImplicitEulerMethodSolver {};
|
||||
class GaussSeidelMethodSolver {};
|
||||
class GradientDescentSolver {};
|
||||
class VerletIntegrationSolver {};
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user