Manipulating lists, basic mathematical functions and LaTeX-like writing
Project description
Rathureqpy - A Python Utility Library
Rathureqpy is a Python library that provides a set of useful functions for a variety of tasks including list manipulation, mathematical operations, logical operations, statistical measures, and more.
Installation
You can install Rathureqpy by running:
bash pip install rathureqpy
Features
List Operations
-
zero(number): Returns a list of zeros with the specified length.
-
prod(L, a): Returns a new list with each element of
Lmultiplied bya. -
addl(*args): Adds corresponding elements from multiple lists of equal length.
-
linespace(start, end, step): Generates a list of evenly spaced values between
startandendwith a givenstep. -
array(start, end, n): Generates an array of
nevenly spaced values betweenstartandend. -
uni(*lists): Flattens multiple lists into a single list.
-
uniwd(*lists): Flattens multiple lists into a single list and removes duplicates.
-
inter(*lists): Returns the intersection of multiple lists.
-
uniq(L): Returns a list with unique elements from
L. -
moy(L): Returns the mean of a list
L. -
sum_int(start, end): Returns the sum of integers between
startandend. -
randl(min, max, n): Generates a list of
nrandom integers betweenminandmax. -
shuffle_list(L): Returns a shuffled version of
L. -
filtrer(L, condition): Filters
Lbased on a condition. -
chunk(L, n): Splits
Linto chunks of sizen. -
partition(L, condition): Partitions
Linto two lists based on a condition.
Logical Operations
-
binr(n): Converts an integer
nto its binary representation as a string. -
change_base(value, inp_base, out_base): Converts
valuefrominp_basetoout_base. -
divisor_list(n): Returns a list of divisors of
n. -
dicho(start, end, f, eps): Performs binary search to find the root of the function
fin the interval[start, end]with an error toleranceeps. -
size(point_A, point_B): Calculates the distance between two points
AandBin a 2D space.
Constants
-
pi: Returns the constant
\u03C0. -
e: Returns the constant
e. -
tau: Returns the constant
\u03C4(2\u03C0).
Mathematical Operations
-
abs(x): Returns the absolute value of
x. -
cos(x): Returns the cosine of
x. -
sin(x): Returns the sine of
x. -
log(x, base=e()): Returns the logarithm of
xto the specifiedbase. -
exp(x): Returns the exponential of
x. -
sqrt(x): Returns the square root of
x. -
facto(n): Returns the factorial of
n. -
floor(x): Returns the largest integer less than or equal to
x. -
ceil(x): Returns the smallest integer greater than or equal to
x. -
rint(x): Returns the integer closest to
x(rounding halfway cases away from zero). -
gcd(a, b): Returns the greatest common divisor of
aandb. -
lcm(a, b): Returns the least common multiple of
aandb. -
is_prime(n): Checks if
nis a prime number. -
integ(f, a, b, N) : Calculates the integral of
ffromatobusing the trapezoidal rule, with a sign adjustment ifa > b
Statistical Measures
-
variance(L): Returns the variance of the list
L. -
ecart_type(L): Returns the standard deviation of the list
L. -
mediane(L): Returns the median of the list
L. -
decomp(n): Returns the prime factorization of
nas a list of tuples. -
list_prime(n): Returns a list of all prime numbers up to
n. -
pascal_row(n): Returns the
n-th row of Pascal's Triangle.
Mathematical Language LaTeX-like
-
lat(expr): Converts a simple LaTeX-like string
exprinto Unicode math characters. Supports: exponents (^), indices (_), square roots (sqrt(...)), sums (sum{...}^...), products (prod{...}^...), integrals (int), and fractions (frac{...}{...}). -
symbol(sym): Returns the Unicode math symbol corresponding to the LaTeX command
sym. If the command is unknown, returns[unknown: sym]. -
dot(text): Returns the input string
textwith a dot placed above each character. -
vec(text): Returns the input string
textwith a bar placed above each character. -
greek(expr): Converts the Greek letter name
exprinto its corresponding Unicode symbol. Returns an empty string if the name is not recognized. -
italic(text): Converts the input string
textto italic Unicode mathematical characters. Only English letters (a-z, A-Z) are transformed. -
bold(text): Converts the input string
textto bold Unicode mathematical characters. Only English letters (a-z, A-Z) are transformed. -
mathbb(text): Converts the input string
textto double-struck (blackboard bold) Unicode characters. Only English letters (a-z, A-Z) are transformed. -
cursive(text): Converts the input string
textto cursive (script) Unicode characters. Only English letters (a-z, A-Z) are transformed.
Contribute and Bugs
If you encounter any bugs or would like to contribute to the project, feel free to open an issue or submit a pull request. Contributions are always welcome!
email : quersin.arthur@gmail.com
Made by Arthur Quersin
Change log
0.0.1 (26/01/2025)
First release
0.0.2 (27/01/2025)
Second release (stable)
0.0.3 (31/01/2025)
Third release (stable, I hope)
0.0.4 (31/01/2025)
Fourth release (stable, I hope 2)
0.0.5 (02/02/2025)
Fith release, with a lot of new fonctions
0.1.2 (18/02/2025)
A new release with, again, a lot of new and useful functions including : - subindex
- pascal_row
- list_prime
- decomp
0.1.21 (24/03/2025)
Fixing readme file
0.1.22 (24/03/2025)
Fixing readme file
0.1.32 (29/04/2025)
-
Removed
apply()because it duplicated functionality ofmap() -
Changed
rathureqpy.pi(),rathureqpy.e(), andrathureqpy.tau()torathureqpy.pi,rathureqpy.e, andrathureqpy.tau(variables instead of functions) -
Added
integ(f, a, b, N)to calculate the integral using the trapezoidal rule, with sign adjustment ifa > b
0.1.40 (12/06/2025)
A new release with, again, a lot of new and useful functions for mathematical writing ! - lat
- symbol
- dot
- vec
- greek
- italic
- bold
- mathbb
- cursive
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file rathureqpy-0.1.40.tar.gz.
File metadata
- Download URL: rathureqpy-0.1.40.tar.gz
- Upload date:
- Size: 11.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8bd2fb0b22dc3115b0823febe6977a56c49c0fa858ba779899b773f8741ebe6e
|
|
| MD5 |
15adc834b4fd329b3a5b23efd550ab3a
|
|
| BLAKE2b-256 |
f096ebdfbb037f570cf75d37b09c0e418705f231c0bd747e33feff92e8595015
|