Crates.io | ariprog |
lib.rs | ariprog |
version | 0.1.4 |
source | src |
created_at | 2024-03-12 00:39:33.238537 |
updated_at | 2024-03-16 19:57:37.029347 |
description | Need a powerful and simple library to work with arithmetic progressions in Rust? You should definitively try out ariprog! |
homepage | |
repository | https://github.com/kauefraga/ariprog |
max_upload_size | |
id | 1169992 |
size | 11,577 |
I had a test (03/2024) on arithmetic progressions, so I decided to create a library to study math. Taking advantage of the fact that I was studying Rust and APs, I created this library.
The objetive of ariprog is to solve the main problems around APs. Here's a list of what it's capable of.
In the API section, you'll see the corresponding functions and how to use them.
First, create a new Rust project or open an existing one
cargo new testing-ariprog
cd testing-ariprog
# or
cd existing-project
Then, add ariprog as a dependency
cargo add ariprog
As an alternative, you can add the following line in your Cargo.toml
(dependencies section)
ariprog = "0.1.4"
use ariprog::{
common_difference,
nth_term
};
fn main() {
let common_diff = common_difference(6.0, 2.0); // expected 4.0
println!(
"The common difference in the AP [2.0, 6.0, 10.0, 14.0] is {}",
common_diff
);
println!(
"The seventeenth term of the AP [2.0, 6.0, 10.0, 14.0, ...] is {}",
nth_term(2.0, common_diff, 17.0)
); // expected 66.0
}
First things first, after adding ariprog in your project, import it.
use ariprog;
ariprog::common_difference
ariprog::nth_term
ariprog::first_term
ariprog::insert_arithmetic_means
ariprog::how_many_terms
ariprog::common_difference_and_first_term
All of these functions have their own documentation. See in docs.rs or in your IDE.
Feel free to fork it, make a change and open a pull request. Same for issues, suggest an API change, an improvement, a feature or report a bug.
To test ariprog, with the project in your machine, run cargo test
.
You should create tests in tests/unit_test.rs
, however if you think that your tests should be in other module, do it and explain why in the PR.
This project is licensed under the MIT License - See the LICENSE for more information.
Made with ❤ and 🦀 by Kauê Fraga Rodrigues.