sequential-integration

Crates.iosequential-integration
lib.rssequential-integration
version1.0.2
sourcesrc
created_at2021-02-22 11:14:28.015469
updated_at2021-02-24 13:26:55.813314
descriptionLightweight library for sequential integration
homepage
repositoryhttps://github.com/magistrser/sequential-integration
max_upload_size
id358943
size41,747
Sergey (magistrser)

documentation

README

Sequential integration


Description

Lightweight library for sequential integration.


Now support

Single, double and triple integrals with Simpson quadrature.


Examples version 1.*.*

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)


Release updates:

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)



Examples for old versions:

Examples version 0.*.*

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
    )?
Commit count: 15

cargo fmt