7 个版本 (3 个稳定版本)
1.0.2 | 2021年2月24日 |
---|---|
0.0.4 | 2021年2月24日 |
0.0.3 | 2021年2月23日 |
0.0.2 | 2021年2月23日 |
0.0.1 | 2021年2月22日 |
#660 在 数学
每月下载量 28 次
用于 宇宙学
34KB
952 行
顺序积分
描述
轻量级顺序积分库。
目前支持
使用辛普森求积的单、双、三重积分。
示例版本 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) 用于单重积分,f(x,y) 用于双重积分和 f(x,y,z) 用于三重积分
first_integral_begin/end - 常量
second_integral_begin/end - f(x)
third_integral_begin/end - f(x,y)
发布更新
0.0.1 - 使用辛普森求积进行双、三重积分
0.0.2 - 不使用额外内存,最后一步的正确方式
0.0.3 - 支持单重积分
0.0.4 - 支持从较大边界到较小边界的积分
1.0.0 - 使用闭包代替字符串方程(如果您想使用闭包与字符串方程,请参阅 mexprp)
旧版本示例
示例版本 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
)?
依赖项
~3.5–5MB
~109K SLoC