2023-01-24 18:57:18 +01:00
# ifndef MLPP_NUMERICAL_ANALYSIS_H
# define MLPP_NUMERICAL_ANALYSIS_H
2023-01-23 21:13:26 +01:00
//
// NumericalAnalysis.hpp
//
//
2023-01-27 13:01:16 +01:00
# include "core/math/math_defs.h"
2023-02-12 16:06:59 +01:00
# include "core/object/reference.h"
2023-01-23 21:13:26 +01:00
# include <string>
2023-01-24 19:00:54 +01:00
# include <vector>
2023-01-23 21:13:26 +01:00
2023-02-12 16:06:59 +01:00
class MLPPNumericalAnalysis : public Reference {
GDCLASS ( MLPPNumericalAnalysis , Reference ) ;
2023-01-24 19:20:18 +01:00
2023-01-24 19:00:54 +01:00
public :
/* A numerical method for derivatives is used. This may be subject to change,
as an analytical method for calculating derivatives will most likely be used in
the future .
*/
2023-01-27 13:01:16 +01:00
real_t numDiff ( real_t ( * function ) ( real_t ) , real_t x ) ;
real_t numDiff_2 ( real_t ( * function ) ( real_t ) , real_t x ) ;
real_t numDiff_3 ( real_t ( * function ) ( real_t ) , real_t x ) ;
2023-01-24 19:00:54 +01:00
2023-01-27 13:01:16 +01:00
real_t constantApproximation ( real_t ( * function ) ( real_t ) , real_t c ) ;
real_t linearApproximation ( real_t ( * function ) ( real_t ) , real_t c , real_t x ) ;
real_t quadraticApproximation ( real_t ( * function ) ( real_t ) , real_t c , real_t x ) ;
real_t cubicApproximation ( real_t ( * function ) ( real_t ) , real_t c , real_t x ) ;
2023-01-24 19:00:54 +01:00
2023-01-27 13:01:16 +01:00
real_t numDiff ( real_t ( * function ) ( std : : vector < real_t > ) , std : : vector < real_t > x , int axis ) ;
real_t numDiff_2 ( real_t ( * function ) ( std : : vector < real_t > ) , std : : vector < real_t > x , int axis1 , int axis2 ) ;
real_t numDiff_3 ( real_t ( * function ) ( std : : vector < real_t > ) , std : : vector < real_t > x , int axis1 , int axis2 , int axis3 ) ;
2023-01-24 19:00:54 +01:00
2023-01-27 13:01:16 +01:00
real_t newtonRaphsonMethod ( real_t ( * function ) ( real_t ) , real_t x_0 , real_t epoch_num ) ;
real_t halleyMethod ( real_t ( * function ) ( real_t ) , real_t x_0 , real_t epoch_num ) ;
2023-02-12 16:10:00 +01:00
real_t invQuadraticInterpolation ( real_t ( * function ) ( real_t ) , std : : vector < real_t > x_0 , int epoch_num ) ;
2023-01-24 19:00:54 +01:00
2023-01-27 13:01:16 +01:00
real_t eulerianMethod ( real_t ( * derivative ) ( real_t ) , std : : vector < real_t > q_0 , real_t p , real_t h ) ; // Euler's method for solving diffrential equations.
real_t eulerianMethod ( real_t ( * derivative ) ( std : : vector < real_t > ) , std : : vector < real_t > q_0 , real_t p , real_t h ) ; // Euler's method for solving diffrential equations.
2023-01-24 19:00:54 +01:00
2023-01-27 13:01:16 +01:00
real_t growthMethod ( real_t C , real_t k , real_t t ) ; // General growth-based diffrential equations can be solved by seperation of variables.
2023-01-24 19:00:54 +01:00
2023-01-27 13:01:16 +01:00
std : : vector < real_t > jacobian ( real_t ( * function ) ( std : : vector < real_t > ) , std : : vector < real_t > x ) ; // Indeed, for functions with scalar outputs the Jacobians will be vectors.
std : : vector < std : : vector < real_t > > hessian ( real_t ( * function ) ( std : : vector < real_t > ) , std : : vector < real_t > x ) ;
std : : vector < std : : vector < std : : vector < real_t > > > thirdOrderTensor ( real_t ( * function ) ( std : : vector < real_t > ) , std : : vector < real_t > x ) ;
2023-01-24 19:00:54 +01:00
2023-01-27 13:01:16 +01:00
real_t constantApproximation ( real_t ( * function ) ( std : : vector < real_t > ) , std : : vector < real_t > c ) ;
real_t linearApproximation ( real_t ( * function ) ( std : : vector < real_t > ) , std : : vector < real_t > c , std : : vector < real_t > x ) ;
real_t quadraticApproximation ( real_t ( * function ) ( std : : vector < real_t > ) , std : : vector < real_t > c , std : : vector < real_t > x ) ;
real_t cubicApproximation ( real_t ( * function ) ( std : : vector < real_t > ) , std : : vector < real_t > c , std : : vector < real_t > x ) ;
2023-01-24 19:00:54 +01:00
2023-01-27 13:01:16 +01:00
real_t laplacian ( real_t ( * function ) ( std : : vector < real_t > ) , std : : vector < real_t > x ) ; // laplacian
2023-01-24 19:00:54 +01:00
2023-01-27 13:01:16 +01:00
std : : string secondPartialDerivativeTest ( real_t ( * function ) ( std : : vector < real_t > ) , std : : vector < real_t > x ) ;
2023-01-24 19:20:18 +01:00
2023-02-12 16:06:59 +01:00
protected :
static void _bind_methods ( ) ;
} ;
2023-01-23 21:13:26 +01:00
# endif /* NumericalAnalysis_hpp */