Skip to content

Commit

Permalink
RELEASE 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zvanjak committed Mar 10, 2024
1 parent 58d9a65 commit b71008e
Show file tree
Hide file tree
Showing 136 changed files with 23,346 additions and 88,084 deletions.
83 changes: 57 additions & 26 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.20.0)

set (CMAKE_CXX_STANDARD 20)

project(MML_Demo VERSION 0.1.0)
project(MML_Demo VERSION 1.0)

add_compile_definitions(MML_USE_SINGLE_HEADER)

Expand Down Expand Up @@ -69,46 +69,77 @@ set( MML_DEMO_SOURCES src/demo_app_main.cpp
src/visualization_examples/demo4_vector_field_gravity.cpp
src/visualization_examples/demo5_vector_field_EM.cpp
src/visualization_examples/visualization_examples.cpp

docs_examples/readme_examples/demo1_vectors_matrices.cpp
docs_examples/readme_examples/demo2_lin_alg_solvers.cpp
docs_examples/readme_examples/demo3_defining_functions.cpp
docs_examples/readme_examples/demo4_working_with_functions.cpp
docs_examples/readme_examples/demo5_ode_solvers.cpp
docs_examples/readme_examples/demo6_vector_field_operations.cpp
docs_examples/readme_examples/demo7_parametric_curves.cpp
docs_examples/readme_examples/demo8_visualizators.cpp
docs_examples/readme_examples/demo9_function_analyzer.cpp
docs_examples/readme_examples/readme_examples.cpp
docs_examples/readme_examples/readme1_vectors_matrices.cpp
docs_examples/readme_examples/readme2_lin_alg_solvers.cpp
docs_examples/readme_examples/readme3_defining_functions.cpp
docs_examples/readme_examples/readme4_working_with_functions.cpp
docs_examples/readme_examples/readme5_ode_solvers.cpp
docs_examples/readme_examples/readme6_vector_field_operations.cpp
docs_examples/readme_examples/readme7_parametric_curves.cpp
docs_examples/readme_examples/readme8_visualizators.cpp
docs_examples/readme_examples/readme9_function_analyzer.cpp
docs_examples/readme_examples/main_readme_examples.cpp
)


add_executable(MML_Demo ${MML_DEMO_SOURCES})
target_include_directories(MML_Demo PRIVATE include)


project(DocsApp VERSION 0.5.0)
set(MML_DOCS_APP_SOURCES docs_examples/doc_examples_app_main.cpp
project(DocsApp VERSION 1.0)
set(MML_DOCS_APP_SOURCES docs_examples/docs_app_main.cpp

docs_examples/readme_examples/demo1_vectors_matrices.cpp
docs_examples/readme_examples/demo2_lin_alg_solvers.cpp
docs_examples/readme_examples/demo3_defining_functions.cpp
docs_examples/readme_examples/demo4_working_with_functions.cpp
docs_examples/readme_examples/demo5_ode_solvers.cpp
docs_examples/readme_examples/demo6_vector_field_operations.cpp
docs_examples/readme_examples/demo7_parametric_curves.cpp
docs_examples/readme_examples/demo8_visualizators.cpp
docs_examples/readme_examples/demo9_function_analyzer.cpp
docs_examples/readme_examples/readme_examples.cpp
docs_examples/readme_examples/readme1_vectors_matrices.cpp
docs_examples/readme_examples/readme2_lin_alg_solvers.cpp
docs_examples/readme_examples/readme3_defining_functions.cpp
docs_examples/readme_examples/readme4_working_with_functions.cpp
docs_examples/readme_examples/readme5_ode_solvers.cpp
docs_examples/readme_examples/readme6_vector_field_operations.cpp
docs_examples/readme_examples/readme7_parametric_curves.cpp
docs_examples/readme_examples/readme8_visualizators.cpp
docs_examples/readme_examples/readme9_function_analyzer.cpp

docs_examples/readme_examples/main_readme_examples.cpp

docs_examples/examples/main_example.cpp
docs_examples/examples/example_main.cpp
docs_examples/examples/example1_kosi_hitac.cpp
docs_examples/examples/example2_collision_calculator.cpp
docs_examples/examples/example3_tensor_of_inertia.cpp
docs_examples/examples/example4_gravity_field_investigations.cpp
docs_examples/examples/example5_voyager_travels.cpp
docs_examples/examples/example6_electric_charge_distribution.cpp
docs_examples/examples/examples.cpp
docs_examples/examples/example7_covariant_derivation.cpp
docs_examples/examples/example8_EM_field_investigations.cpp
docs_examples/examples/example9_thermodynamics_simulator.cpp

docs_examples/examples/main_docs_examples.cpp

docs_examples/demos/docs_demo_coord_transf.cpp
docs_examples/demos/docs_demo_derivation.cpp
docs_examples/demos/docs_demo_diff_geometry.cpp
docs_examples/demos/docs_demo_eigen_solvers.cpp
docs_examples/demos/docs_demo_field_operations.cpp
docs_examples/demos/docs_demo_functions.cpp
docs_examples/demos/docs_demo_integration.cpp
docs_examples/demos/docs_demo_integration_multidim.cpp
docs_examples/demos/docs_demo_integration_path.cpp
docs_examples/demos/docs_demo_integration_surface.cpp
docs_examples/demos/docs_demo_interpolated_functions.cpp
docs_examples/demos/docs_demo_geometry_2d_3d.cpp
docs_examples/demos/docs_demo_lin_alg_solvers.cpp
docs_examples/demos/docs_demo_matrix.cpp
docs_examples/demos/docs_demo_matrixnm.cpp
docs_examples/demos/docs_demo_ode_solvers.cpp
docs_examples/demos/docs_demo_polynom.cpp
docs_examples/demos/docs_demo_root_finding.cpp
docs_examples/demos/docs_demo_surface_integration.cpp
docs_examples/demos/docs_demo_tensors.cpp
docs_examples/demos/docs_demo_vector.cpp
docs_examples/demos/docs_demo_visualizers.cpp
docs_examples/demos/docs_demo_volume_integration.cpp

docs_examples/demos/main_docs_demos.cpp
)
add_executable(DocsApp ${MML_DOCS_APP_SOURCES})
target_include_directories(DocsApp PRIVATE include)
Expand Down
44 changes: 28 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ All your basic (numerical) math needs, contained in a single-header file (more c
- For a C++ developer, on Windows, Mac or Linux
- Who needs a math library to perform simple (and not so simple) numerical calculations
- The Minimal Math Library is a general purpose, pythonesque in its focus on simplicity of use, single-header C++ library of classes and functions
- That is trivial to use in any kind of project, is C++ 20 cross-platform compatible, and comes with a rich set of functionalities for working with vectors, matrices, tensors, linear systems, real, scalar and vector functions, polynoms, differential equations, coordinate systems and transformations, 2D & 3D geometry with algorithms for derivation, integration, root finding, interpolation, optimization, statistics, and more.
- That is trivial to use in any kind of project, is C++ 20 cross-platform compatible, and comes with a rich set of functionalities for working with vectors, matrices, tensors, linear systems, polynoms, real, scalar and vector functions, coordinate systems and their transformations, 2D & 3D geometry with algorithms for derivation, integration, interpolation, differential equations solving, root finding, statistics, and more.

## Basic facts
- As of now, and for foreseable future, this is unfortunately strictly for personal, research and educational use only (see Licensing at the end)
Expand All @@ -27,43 +27,42 @@ Library is organized in three main groups (you could call them layers), with add
**Base**

Basic math types. These are the building blocks of the library, sitting at the lowest layer, depending only on standard library headers (and possibly Vector and Matrix class), and are used in all other parts of the library.
- [Algebra](/docs/base/Algebra.md) - groups, permutation group (big TODO!)
- [Vectors](/docs/base/Vectors.md) - Vector, VectorN<int N>, Vector(2)(3)Cartesian, Vector2Polar, Vector3Spherical, Vector3Cylindrical
- [Matrices](/docs/base/Matrices.md) - Matrix, MatrixNM<int N, int M>, MatrixSym, MatrixTridiag, MatrixBandDiag
- [Tensors](/docs/base/Tensors.md) - Tensor2<int Dim>, Tensor3<int Dim>, Tensor4<int Dim>, Tensor5<int Dim> in N dimensions
- [Polynoms](/docs/base/Polynoms.md) - general Polynom class (tested for Real, Complex and Matrix as field type)
- [Geometry](/docs/base/Geometry.md) - pure geometry: points, triangles, bodies
- [Geometry](/docs/base/Geometry.md) - pure geometry: points, triangles
- [2D & 3D geometry](/docs/base/Geometry_2D_3D.md) - analytic geometry in 2D and 3D
- [Vector spaces](/docs/base/Vector_spaces.md) - vector space, normed vector space, metric (Hilbert) space (still much to do here!)
- [Functionals, operators, quadratic forms](/docs/base/Operators.md) - linear functional, quadratic form, linear operator (much to do here!)
- [Standard functions](/docs/base/Standard_Functions.md) - definition of available standard functions
- [Base utils](/docs/base/BaseUtils.md) - general utilities including matrix helper (IsOrthogonal, IsUnitary, IsHermitian)
- [Algebra](/docs/base/Algebra.md) - groups, permutation group (big TODO!)

**Core**

Core mathematical objects and operations of the library, depending on Base types, and used by higher algorithms.
Core mathematical objects and operations of the library, depending on Base types, and used by MML algorithms.
Function objects, and different algorithms for working with them are the heart of this layer.
- [Linear alg. equations solvers](/docs/core/Linear_equations_solvers.md) - GJ, LU, QR, SVD, Cholesky
- [Functions](/docs/core/Function_types.md) - IRealFunction, IScalarFunction<int N>, IVectorFunction<int N>, IParametricCurve<N>, IParametricSurface<N>, ITensorField<N>
- [Standard functions](/docs/core/Functions.md) - definition of available standard functions
- [Functions](/docs/core/Functions.md) - IRealFunction, IScalarFunction<int N>, IVectorFunction<int N>, IParametricCurve<N>, IParametricSurface<N>, ITensorField<N>
- [Interpolated functions](/docs/core/Interpolated_functions.md) - linear, polynomial, rational polynomial, spline interpolations
- [Dirac delta function](/docs/core/Dirac_delta_function.md)- predefined distributions for representing Dirac delta function
- [Numerical derivation](/docs/core/Derivation.md) - orders 1, 2, 4, 6, 8 for IRealFunction, IScalarFunction, IVectorFunction, IParametricCurve, IParametricSurface, ITensorField
- [Numerical integration](/docs/core/Integration.md) - Trapezoidal, Simpson, Romberg basic integration algorithms
- [Multidim integration](/docs/core/Multidim_integration.md) - calculating 2D and 3D (cartesian) integrals
- [Curves & Surfaces](/docs/core/Curves_and_surfaces.md) - predefined curves and surfaces
- [Fields](/docs/core/Fields.md) - predefined example fields
- [Numerical derivation](/docs/core/Derivation.md) - orders 1, 2, 4, 6, 8 for IRealFunction, IScalarFunction, IVectorFunction, IParametricCurve, IParametricSurface, ITensorField
- [Field operations](/docs/core/Vector_field_operations.md) - grad, div, curl, Laplacian in general, Cartesian, cylindrical and spherical coordinates
- [Metric tensor](/docs/core/Metric_tensor.md) - predefined metric tensors in General, Cartesian, Cylindrical and Spherical coordinates
- [Coordinate transformations](/docs/core/Coordinate_transformations.md) - General, Cartesian, Cylindrical, Spherical
- [Numerical integration](/docs/core/Integration.md) - Trapezoidal, Simpson, Romberg basic integration algorithms
- [Multidim integration](/docs/core/Multidim_integration.md) - calculating 2D and 3D (cartesian) integrals
- [ODE system](/docs/core/ODE_system.md) - represents a dynamical system of ordinary differential equations
- [Function spaces](/docs/core/Function_spaces.md) - Hermitian, Legendre, Laguerre, Chebyshev, Fourier spaces
- [Core utils](/docs/core/CoreUtils.md) - general core utilities
- [Coordinate transformations](/docs/core/Coordinate_transformations.md) - General, Cartesian, Cylindrical, Spherical
- [Metric tensor](/docs/core/Metric_tensor.md) - predefined metric tensors in General, Cartesian, Cylindrical and Spherical coordinates
- [Function spaces](/docs/core/Function_spaces.md) - Hermitian, Legendre, Laguerre, Chebyshev, Fourier spaces (much to do here!)

**Algorithms**

Algorithms for solving mathematical problems. These are the algorithms of the library, depending on Base and Core types.
- [Eigen solvers](/docs/algorithms/Eigen_solvers.md) - solving eigenvalue problems for symmetric and non-symmetric real matrices
- [Path integration](/docs/algorithms/Path_integration.md) - calculating line and work integrals
- [Path integration](/docs/algorithms/Path_integration.md) - calculating path integrals (curve len, line and work integrals)
- [ODE system solvers](/docs/algorithms/Differential_equations_solvers.md) - solvers for systems of ordinary differential equations
- [Differential geometry](/docs/algorithms/Differential_geometry.md) - for curves only, so far
- [Root finding](/docs/algorithms/Root_finding.md) - different root finding algorithms (bracketing, Newton-Raphson)
Expand Down Expand Up @@ -463,6 +462,7 @@ Examples of integration real functions, but also 2D and 3D scalar functions
~~~ c++
// numerical integration of real function
RealFunction f1{[](double x) { return sin(x)*(1.0 + 0.5*x*x); } };
RealFunction f1_integral{ [](Real x) { return (Real)(x * (-0.5 * x * cos(x) + sin(x))); } };
double a = 0.0;
double b = 1.0;
Expand All @@ -472,6 +472,12 @@ double int_romb = IntegrateRomberg(f1,a,b);
// we can use default Integrate routine (set to IntegrateSimpson), requires precision
double int_def = Integrate(f1, a, b, 1e-04);
std::cout << "Integrating function f1 from " << a << " to " << b << std::endl;
std::cout << "Exact integral = " << f1_integral(b) - f1_integral(a) << std::endl;
std::cout << "IntegrateTrap = " << int_trap << std::endl;
std::cout << "IntegrateSimpson = " << int_simp << std::endl;
std::cout << "IntegrateRomberg = " << int_romb << std::endl;
// 2D integration of constant scalar 2D function (ie. we'll get the area of the surface)
ScalarFunction<2> f2([](const VectorN<Real, 2> &x) { return 1.0; });
Expand All @@ -496,8 +502,14 @@ Real vol = IntegrateVolume( f3,
std::cout << "Calc. vol. = " << vol << ", exact value: 4/3 * PI = " << 4.0/3.0 * Constants::PI << std::endl;
/* OUTPUT
Calc. area = 12.57211164, exact value: 4 * PI = 12.56637061
Calc. vol. = 4.190703882, exact value: 4/3 * PI = 4.188790205
Integrating function f1 from 0 to 10
Exact integral = 36.5134
IntegrateTrap = 36.5133
IntegrateSimpson = 36.5134
IntegrateRomberg = 36.5134
Calc. area = 12.57211164, exact value: 4 * PI = 12.56637061
Calc. vol. = 4.190703882, exact value: 4/3 * PI = 4.188790205
*/
~~~

Expand Down
Loading

0 comments on commit b71008e

Please sign in to comment.