rgwfuncs 0.0.31__py3-none-any.whl → 0.0.33__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rgwfuncs/__init__.py +1 -1
- rgwfuncs/algebra_lib.py +31 -31
- {rgwfuncs-0.0.31.dist-info → rgwfuncs-0.0.33.dist-info}/METADATA +31 -31
- rgwfuncs-0.0.33.dist-info/RECORD +11 -0
- rgwfuncs-0.0.31.dist-info/RECORD +0 -11
- {rgwfuncs-0.0.31.dist-info → rgwfuncs-0.0.33.dist-info}/LICENSE +0 -0
- {rgwfuncs-0.0.31.dist-info → rgwfuncs-0.0.33.dist-info}/WHEEL +0 -0
- {rgwfuncs-0.0.31.dist-info → rgwfuncs-0.0.33.dist-info}/entry_points.txt +0 -0
- {rgwfuncs-0.0.31.dist-info → rgwfuncs-0.0.33.dist-info}/top_level.txt +0 -0
rgwfuncs/__init__.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# This file is automatically generated
|
2
2
|
# Dynamically importing functions from modules
|
3
3
|
|
4
|
-
from .algebra_lib import compute_constant_expression, compute_constant_expression_involving_matrices, compute_constant_expression_involving_ordered_series,
|
4
|
+
from .algebra_lib import compute_constant_expression, compute_constant_expression_involving_matrices, compute_constant_expression_involving_ordered_series, compute_prime_factors, python_polynomial_expression_to_latex, simplify_polynomial_expression, solve_homogeneous_polynomial_expression
|
5
5
|
from .df_lib import append_columns, append_percentile_classification_column, append_ranged_classification_column, append_ranged_date_classification_column, append_rows, append_xgb_labels, append_xgb_logistic_regression_predictions, append_xgb_regression_predictions, bag_union_join, bottom_n_unique_values, cascade_sort, delete_rows, drop_duplicates, drop_duplicates_retain_first, drop_duplicates_retain_last, filter_dataframe, filter_indian_mobiles, first_n_rows, from_raw_data, insert_dataframe_in_sqlite_database, last_n_rows, left_join, limit_dataframe, load_data_from_path, load_data_from_query, load_data_from_sqlite_path, mask_against_dataframe, mask_against_dataframe_converse, numeric_clean, order_columns, print_correlation, print_dataframe, print_memory_usage, print_n_frequency_cascading, print_n_frequency_linear, rename_columns, retain_columns, right_join, send_data_to_email, send_data_to_slack, send_dataframe_via_telegram, sync_dataframe_to_sqlite_database, top_n_unique_values, union_join, update_rows
|
6
6
|
from .docs_lib import docs
|
7
7
|
from .str_lib import send_telegram_message
|
rgwfuncs/algebra_lib.py
CHANGED
@@ -10,6 +10,37 @@ from sympy.parsing.sympy_parser import (standard_transformations, implicit_multi
|
|
10
10
|
from typing import Tuple, List, Dict, Optional
|
11
11
|
|
12
12
|
|
13
|
+
def compute_prime_factors(n: int) -> str:
|
14
|
+
"""
|
15
|
+
Computes the prime factors of a number and returns the factorization as a LaTeX string.
|
16
|
+
|
17
|
+
Determines the prime factorization of the given integer. The result is formatted as a LaTeX
|
18
|
+
string, enabling easy integration into documents or presentations that require mathematical notation.
|
19
|
+
|
20
|
+
Parameters:
|
21
|
+
n (int): The number for which to compute prime factors.
|
22
|
+
|
23
|
+
Returns:
|
24
|
+
str: The LaTeX representation of the prime factorization.
|
25
|
+
"""
|
26
|
+
|
27
|
+
factors = []
|
28
|
+
while n % 2 == 0:
|
29
|
+
factors.append(2)
|
30
|
+
n //= 2
|
31
|
+
for i in range(3, int(math.sqrt(n)) + 1, 2):
|
32
|
+
while n % i == 0:
|
33
|
+
factors.append(i)
|
34
|
+
n //= i
|
35
|
+
if n > 2:
|
36
|
+
factors.append(n)
|
37
|
+
|
38
|
+
factor_counts = {factor: factors.count(factor) for factor in set(factors)}
|
39
|
+
latex_factors = [f"{factor}^{{{count}}}" if count > 1 else str(
|
40
|
+
factor) for factor, count in factor_counts.items()]
|
41
|
+
return " \\cdot ".join(latex_factors)
|
42
|
+
|
43
|
+
|
13
44
|
def compute_constant_expression(expression: str) -> float:
|
14
45
|
"""
|
15
46
|
Computes the numerical result of a given expression, which can evaluate to a constant,
|
@@ -520,34 +551,3 @@ def solve_homogeneous_polynomial_expression(
|
|
520
551
|
raise ValueError(f"Error solving the expression: {e}")
|
521
552
|
|
522
553
|
|
523
|
-
|
524
|
-
|
525
|
-
def get_prime_factors_latex(n: int) -> str:
|
526
|
-
"""
|
527
|
-
Computes the prime factors of a number and returns the factorization as a LaTeX string.
|
528
|
-
|
529
|
-
Determines the prime factorization of the given integer. The result is formatted as a LaTeX
|
530
|
-
string, enabling easy integration into documents or presentations that require mathematical notation.
|
531
|
-
|
532
|
-
Parameters:
|
533
|
-
n (int): The number for which to compute prime factors.
|
534
|
-
|
535
|
-
Returns:
|
536
|
-
str: The LaTeX representation of the prime factorization.
|
537
|
-
"""
|
538
|
-
|
539
|
-
factors = []
|
540
|
-
while n % 2 == 0:
|
541
|
-
factors.append(2)
|
542
|
-
n //= 2
|
543
|
-
for i in range(3, int(math.sqrt(n)) + 1, 2):
|
544
|
-
while n % i == 0:
|
545
|
-
factors.append(i)
|
546
|
-
n //= i
|
547
|
-
if n > 2:
|
548
|
-
factors.append(n)
|
549
|
-
|
550
|
-
factor_counts = {factor: factors.count(factor) for factor in set(factors)}
|
551
|
-
latex_factors = [f"{factor}^{{{count}}}" if count > 1 else str(
|
552
|
-
factor) for factor, count in factor_counts.items()]
|
553
|
-
return " \\cdot ".join(latex_factors)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: rgwfuncs
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.33
|
4
4
|
Summary: A functional programming paradigm for mathematical modelling and data science
|
5
5
|
Home-page: https://github.com/ryangerardwilson/rgwfunc
|
6
6
|
Author: Ryan Gerard Wilson
|
@@ -154,7 +154,31 @@ Print a list of available function names in alphabetical order. If a filter is p
|
|
154
154
|
|
155
155
|
This section provides comprehensive functions for handling algebraic expressions, performing tasks such as computation, simplification, solving equations, and prime factorization, all outputted in LaTeX format.
|
156
156
|
|
157
|
-
### 1. `
|
157
|
+
### 1. `compute_prime_factors`
|
158
|
+
|
159
|
+
Computes prime factors of a number and presents them in LaTeX format.
|
160
|
+
|
161
|
+
• Parameters:
|
162
|
+
- `n` (int): The integer to factorize.
|
163
|
+
|
164
|
+
• Returns:
|
165
|
+
- `str`: Prime factorization in LaTeX.
|
166
|
+
|
167
|
+
• Example:
|
168
|
+
|
169
|
+
from rgwfuncs import compute_prime_factors
|
170
|
+
factors_1 = compute_prime_factors(100)
|
171
|
+
print(factors_1) # Output: "2^{2} \cdot 5^{2}"
|
172
|
+
|
173
|
+
factors_2 = compute_prime_factors(60)
|
174
|
+
print(factors_2) # Output: "2^{2} \cdot 3 \cdot 5"
|
175
|
+
|
176
|
+
factors_3 = compute_prime_factors(17)
|
177
|
+
print(factors_3) # Output: "17"
|
178
|
+
|
179
|
+
--------------------------------------------------------------------------------
|
180
|
+
|
181
|
+
### 2. `compute_constant_expression`
|
158
182
|
|
159
183
|
Computes the numerical result of a given expression, which can evaluate to a constant, represented as a float. Evaluates an constant expression provided as a string and returns the computed result. Supports various arithmetic operations, including addition, subtraction, multiplication, division, and modulo, as well as mathematical functions from the math module.
|
160
184
|
|
@@ -178,7 +202,7 @@ Computes the numerical result of a given expression, which can evaluate to a con
|
|
178
202
|
|
179
203
|
--------------------------------------------------------------------------------
|
180
204
|
|
181
|
-
###
|
205
|
+
### 3. `compute_constant_expression_involving_matrices`
|
182
206
|
|
183
207
|
Computes the result of a constant expression involving matrices and returns it as a LaTeX string.
|
184
208
|
|
@@ -206,7 +230,7 @@ Computes the result of a constant expression involving matrices and returns it a
|
|
206
230
|
|
207
231
|
--------------------------------------------------------------------------------
|
208
232
|
|
209
|
-
###
|
233
|
+
### 4. `compute_constant_expression_involving_ordered_series`
|
210
234
|
|
211
235
|
Computes the result of a constant expression involving ordered series, and returns it as a Latex string.
|
212
236
|
|
@@ -235,7 +259,7 @@ Computes the result of a constant expression involving ordered series, and retur
|
|
235
259
|
|
236
260
|
--------------------------------------------------------------------------------
|
237
261
|
|
238
|
-
###
|
262
|
+
### 5. `python_polynomial_expression_to_latex`
|
239
263
|
|
240
264
|
Converts a polynomial expression written in Python syntax to a LaTeX formatted string. This function parses algebraic expressions provided as strings using Python’s syntax and translates them into equivalent LaTeX representations, making them suitable for academic or professional documentation. The function supports inclusion of named variables, with an option to substitute specific values into the expression.
|
241
265
|
|
@@ -275,7 +299,7 @@ Converts a polynomial expression written in Python syntax to a LaTeX formatted s
|
|
275
299
|
|
276
300
|
--------------------------------------------------------------------------------
|
277
301
|
|
278
|
-
###
|
302
|
+
### 6. `simplify_polynomial_expression`
|
279
303
|
|
280
304
|
Simplifies an algebraic expression in polynomial form and returns it in LaTeX format. Takes an algebraic expression, in polynomial form, written in Python syntax and simplifies it. The result is returned as a LaTeX formatted string, suitable for academic or professional documentation.
|
281
305
|
|
@@ -308,7 +332,7 @@ Simplifies an algebraic expression in polynomial form and returns it in LaTeX fo
|
|
308
332
|
|
309
333
|
--------------------------------------------------------------------------------
|
310
334
|
|
311
|
-
###
|
335
|
+
### 7. `solve_homogeneous_polynomial_expression`
|
312
336
|
|
313
337
|
Solves a homogeneous polynomial expression for a specified variable and returns solutions in LaTeX format. Assumes that the expression is homoegeneous (i.e. equal to zero), and solves for a designated variable. May optionally include substitutions for other variables in the equation. The solutions are provided as a LaTeX formatted string. The method solves equations for specified variables, with optional substitutions, returning LaTeX-formatted solutions.
|
314
338
|
|
@@ -331,30 +355,6 @@ Solves a homogeneous polynomial expression for a specified variable and returns
|
|
331
355
|
|
332
356
|
--------------------------------------------------------------------------------
|
333
357
|
|
334
|
-
### 7. `get_prime_factors_latex`
|
335
|
-
|
336
|
-
Computes prime factors of a number and presents them in LaTeX format.
|
337
|
-
|
338
|
-
• Parameters:
|
339
|
-
- `n` (int): The integer to factorize.
|
340
|
-
|
341
|
-
• Returns:
|
342
|
-
- `str`: Prime factorization in LaTeX.
|
343
|
-
|
344
|
-
• Example:
|
345
|
-
|
346
|
-
from rgwfuncs import get_prime_factors_latex
|
347
|
-
factors1 = get_prime_factors_latex(100)
|
348
|
-
print(factors1) # Output: "2^{2} \cdot 5^{2}"
|
349
|
-
|
350
|
-
factors2 = get_prime_factors_latex(60)
|
351
|
-
print(factors2) # Output: "2^{2} \cdot 3 \cdot 5"
|
352
|
-
|
353
|
-
factors3 = get_prime_factors_latex(17)
|
354
|
-
print(factors3) # Output: "17"
|
355
|
-
|
356
|
-
--------------------------------------------------------------------------------
|
357
|
-
|
358
358
|
## String Based Functions
|
359
359
|
|
360
360
|
### 1. send_telegram_message
|
@@ -0,0 +1,11 @@
|
|
1
|
+
rgwfuncs/__init__.py,sha256=xs4RKtP6koffSxgfqG8b5E6qebsTmoQUMVj8-Hf2xj0,1467
|
2
|
+
rgwfuncs/algebra_lib.py,sha256=HAG57M5ce5RsPBcKX1LFwK7hr-b55vSRPmxjYxDdRkE,21585
|
3
|
+
rgwfuncs/df_lib.py,sha256=G_H3PXNVeseX2YLjkkrmO9eXA_7r29swUZlbPBDZjXA,66612
|
4
|
+
rgwfuncs/docs_lib.py,sha256=y3wSAOPO3qsA4HZ7xAtW8HimM8w-c8hjcEzMRLJ96ao,1960
|
5
|
+
rgwfuncs/str_lib.py,sha256=rtAdRlnSJIu3JhI-tA_A0wCiPK2m-zn5RoGpBxv_g-4,2228
|
6
|
+
rgwfuncs-0.0.33.dist-info/LICENSE,sha256=7EI8xVBu6h_7_JlVw-yPhhOZlpY9hP8wal7kHtqKT_E,1074
|
7
|
+
rgwfuncs-0.0.33.dist-info/METADATA,sha256=7rjtuE5Q1RAd44zz995DwJXPdoGHEAp05cKkDQ_UKew,44916
|
8
|
+
rgwfuncs-0.0.33.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
9
|
+
rgwfuncs-0.0.33.dist-info/entry_points.txt,sha256=j-c5IOPIQ0252EaOV6j6STio56sbXl2C4ym_fQ0lXx0,43
|
10
|
+
rgwfuncs-0.0.33.dist-info/top_level.txt,sha256=aGuVIzWsKiV1f2gCb6mynx0zx5ma0B1EwPGFKVEMTi4,9
|
11
|
+
rgwfuncs-0.0.33.dist-info/RECORD,,
|
rgwfuncs-0.0.31.dist-info/RECORD
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
rgwfuncs/__init__.py,sha256=Xei98Hu6tuFZMCAthCMgmkiD2ZWKKypArV4zcJ9Qtds,1469
|
2
|
-
rgwfuncs/algebra_lib.py,sha256=96rXb82urUVlrRgkpaNYNsap_ndSQc3NeWjFCG3aTYc,21587
|
3
|
-
rgwfuncs/df_lib.py,sha256=G_H3PXNVeseX2YLjkkrmO9eXA_7r29swUZlbPBDZjXA,66612
|
4
|
-
rgwfuncs/docs_lib.py,sha256=y3wSAOPO3qsA4HZ7xAtW8HimM8w-c8hjcEzMRLJ96ao,1960
|
5
|
-
rgwfuncs/str_lib.py,sha256=rtAdRlnSJIu3JhI-tA_A0wCiPK2m-zn5RoGpBxv_g-4,2228
|
6
|
-
rgwfuncs-0.0.31.dist-info/LICENSE,sha256=7EI8xVBu6h_7_JlVw-yPhhOZlpY9hP8wal7kHtqKT_E,1074
|
7
|
-
rgwfuncs-0.0.31.dist-info/METADATA,sha256=_oeyab985L-gFGP6woQfHRIg3jnX4XlLX6lU3BuxOts,44925
|
8
|
-
rgwfuncs-0.0.31.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
9
|
-
rgwfuncs-0.0.31.dist-info/entry_points.txt,sha256=j-c5IOPIQ0252EaOV6j6STio56sbXl2C4ym_fQ0lXx0,43
|
10
|
-
rgwfuncs-0.0.31.dist-info/top_level.txt,sha256=aGuVIzWsKiV1f2gCb6mynx0zx5ma0B1EwPGFKVEMTi4,9
|
11
|
-
rgwfuncs-0.0.31.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|