3 个版本
0.1.2 | 2024年5月8日 |
---|---|
0.1.1 | 2024年5月8日 |
0.1.0 | 2024年5月8日 |
#550 in 数学
275KB
7.5K SLoC
ihateintegrals
此crate提供表示数学表达式和自动简化它们的类型,显示推导答案的步骤。这包括求解积分。此crate用作我的cas网站ihateintegrals.com的后端。
请参阅crate文档以获取示例和使用方法。
lib.rs
:
用于求解积分的计算机代数系统。
此crate没有稳定的API。
提供表示符号数学表达式的类型和用于使用等价规则简化它们的推导工具。
- 将表达式解析为JSON并从JSON解析
- 自动推导简化
- 提供简化过程中使用的步骤
以下是一个求解/简化平凡积分的示例。
use ihateintegrals::simplify_incremental;
use ihateintegrals::{integral::Integral, integer::Integer, exponent::Exponent, variable::Variable};
use ihateintegrals::product::product_of;
use ihateintegrals::graph::Graph;
use ihateintegrals::EvaluateFirstProfile;
// Create an expression for the integral of 2x with respect to x
let start = Integral::of(
product_of(&[Integer::of(2), Variable::of("x")]),
Variable::of("x"),
);
// Create a derivation object for this expression
let mut handle = simplify_incremental(&start, EvaluateFirstProfile::new(), None);
// Do some simplification work
let result = handle.do_pass(20);
assert!(result.finished);
assert_eq!(result.failed, None);
assert_eq!(
result.steps.unwrap().steps.last().unwrap().1,
Exponent::of(Variable::of("x"), Integer::of(2))
);
// Assess the produced derivation graph
let graph: &Graph = handle.deriver();
依赖关系
~3.5–5MB
~83K SLoC