Crates.io | sequential-integration |
lib.rs | sequential-integration |
version | 1.0.2 |
source | src |
created_at | 2021-02-22 11:14:28.015469 |
updated_at | 2021-02-24 13:26:55.813314 |
description | Lightweight library for sequential integration |
homepage | |
repository | https://github.com/magistrser/sequential-integration |
max_upload_size | |
id | 358943 |
size | 41,747 |
Lightweight library for sequential integration.
Single, double and triple integrals with Simpson quadrature.
sequential_integration::calculate_single_integral_simpson(
|x: f64| (1. - x.powf(2.)).sqrt(), // equation
-1., // first_integral_begin
1., // first_integral_end
0.01, // first_integral_step
)?
sequential_integration::calculate_double_integral_simpson(
|_x, _y| 1., // equation
-1., // first_integral_begin
1., // first_integral_end
0.01, // first_integral_step
|_x| -0., // second_integral_begin
|x: f64| (1. - x.powf(2.)).sqrt(), // second_integral_end
0.01, // second_integral_step
)?
sequential_integration::calculate_triple_integral_simpson(
|x: f64, y: f64, z: f64| x.powf(2.) + y.powf(2.) + z.powf(2.), // equation
-1., // first_integral_begin
1., // first_integral_end
0.01, // first_integral_step
|x| x, // second_integral_begin
|x| x / 2., // second_integral_end
0.01, // second_integral_step
|x: f64, y: f64| x.powf(2.) + y, // third_integral_begin
|_x, _y| 0., // third_integral_end
0.01, // third_integral_step
)?
equation - f(x) for single integral, f(x,y) for double integral and f(x,y,z) for triple integral
first_integral_[begin/end] - constant
second_integral_[begin/end] - f(x)
third_integral_[begin/end] - f(x,y)
0.0.1 - Double and triple integrals with Simpson quadrature
0.0.2 - Not use additional memory, correct way for last step
0.0.3 - Support single integral
0.0.4 - Support integration from larger bound to smaller bound
1.0.0 - Use closures instead string equations (See mexprp if you want to use string equations with closures)
sequential_integration::calculate_single_integral_simpson(
"max(sqrt(1 - x^2))", // equation
-1., // first_integral_begin
1., // first_integral_end
0.01, // first_integral_step
)?
sequential_integration::calculate_double_integral_simpson(
"1", // equation
-1., // first_integral_begin
1., // first_integral_end
0.01, // first_integral_step
"0", // second_integral_begin
"max(sqrt(1 - x^2))", // second_integral_end
0.01, // second_integral_step
)?
sequential_integration::calculate_triple_integral_simpson(
"x ^ 2 + y ^ 2 + z ^ 2", // equation
-1., // first_integral_begin
1., // first_integral_end
0.01, // first_integral_step
"x", // second_integral_begin
"x / 2", // second_integral_end
0.01, // second_integral_step
"x^2 + y", // third_integral_begin
"0", // third_integral_end
0.01, // third_integral_step
)?