pmlpp/mlpp/numerical_analysis/numerical_analysis.h

71 lines
3.4 KiB
C
Raw Normal View History

2023-01-24 18:57:18 +01:00
#ifndef MLPP_NUMERICAL_ANALYSIS_H
#define MLPP_NUMERICAL_ANALYSIS_H
//
// NumericalAnalysis.hpp
//
//
2023-01-27 13:01:16 +01:00
#include "core/math/math_defs.h"
#include "core/object/reference.h"
2023-12-29 18:37:06 +01:00
#include "core/containers/vector.h"
#include "core/string/ustring.h"
class MLPPVector;
class MLPPMatrix;
class MLPPTensor3;
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-12-29 18:37:06 +01:00
real_t num_diffr(real_t (*function)(real_t), real_t x);
real_t num_diff_2r(real_t (*function)(real_t), real_t x);
real_t num_diff_3r(real_t (*function)(real_t), real_t x);
2023-01-24 19:00:54 +01:00
2023-12-29 18:37:06 +01:00
real_t constant_approximationr(real_t (*function)(real_t), real_t c);
real_t linear_approximationr(real_t (*function)(real_t), real_t c, real_t x);
real_t quadratic_approximationr(real_t (*function)(real_t), real_t c, real_t x);
real_t cubic_approximationr(real_t (*function)(real_t), real_t c, real_t x);
2023-01-24 19:00:54 +01:00
2023-12-29 18:37:06 +01:00
real_t num_diffv(real_t (*function)(const Ref<MLPPVector> &), const Ref<MLPPVector> &, int axis);
real_t num_diff_2v(real_t (*function)(const Ref<MLPPVector> &), const Ref<MLPPVector> &, int axis1, int axis2);
real_t num_diff_3v(real_t (*function)(const Ref<MLPPVector> &), const Ref<MLPPVector> &, int axis1, int axis2, int axis3);
2023-01-24 19:00:54 +01:00
2023-12-29 18:37:06 +01:00
real_t newton_raphson_method(real_t (*function)(real_t), real_t x_0, real_t epoch_num);
real_t halley_method(real_t (*function)(real_t), real_t x_0, real_t epoch_num);
real_t inv_quadratic_interpolation(real_t (*function)(real_t), const Ref<MLPPVector> &x_0, int epoch_num);
2023-01-24 19:00:54 +01:00
2023-12-29 18:37:06 +01:00
real_t eulerian_methodr(real_t (*derivative)(real_t), real_t q_0, real_t q_1, real_t p, real_t h); // Euler's method for solving diffrential equations.
real_t eulerian_methodv(real_t (*derivative)(const Ref<MLPPVector> &), real_t q_0, real_t q_1, real_t p, real_t h); // Euler's method for solving diffrential equations.
2023-01-24 19:00:54 +01:00
2023-12-29 18:37:06 +01:00
real_t growth_method(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-12-29 18:37:06 +01:00
Ref<MLPPVector> jacobian(real_t (*function)(const Ref<MLPPVector> &), const Ref<MLPPVector> &x); // Indeed, for functions with scalar outputs the Jacobians will be vectors.
Ref<MLPPMatrix> hessian(real_t (*function)(const Ref<MLPPVector> &), const Ref<MLPPVector> &x);
Ref<MLPPTensor3> third_order_tensor(real_t (*function)(const Ref<MLPPVector> &), const Ref<MLPPVector> &x);
Vector<Ref<MLPPMatrix>> third_order_tensorvt(real_t (*function)(const Ref<MLPPVector> &), const Ref<MLPPVector> &x);
2023-01-24 19:00:54 +01:00
2023-12-29 18:37:06 +01:00
real_t constant_approximationv(real_t (*function)(const Ref<MLPPVector> &), const Ref<MLPPVector> &c);
real_t linear_approximationv(real_t (*function)(const Ref<MLPPVector> &), const Ref<MLPPVector> &c, const Ref<MLPPVector> &x);
real_t quadratic_approximationv(real_t (*function)(const Ref<MLPPVector> &), const Ref<MLPPVector> &c, const Ref<MLPPVector> &x);
real_t cubic_approximationv(real_t (*function)(const Ref<MLPPVector> &), const Ref<MLPPVector> &c, const Ref<MLPPVector> &x);
2023-01-24 19:00:54 +01:00
2023-12-29 18:37:06 +01:00
real_t laplacian(real_t (*function)(const Ref<MLPPVector> &), const Ref<MLPPVector> &x); // laplacian
String second_partial_derivative_test(real_t (*function)(const Ref<MLPPVector> &), const Ref<MLPPVector> &x);
2023-01-24 19:20:18 +01:00
protected:
static void _bind_methods();
};
#endif /* NumericalAnalysis_hpp */