README.md – English version of README.md
README-RU.md – Russian version of README.md
The Ludmila script is designed to solve unsolved mathematical problems using a brute-force method.
It has a list of equation elements:
- Numbers (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
- Operations (+, *, /, -)
- Brackets (left, right)
- Powers (square, cubic, square root, cube root)
- Variables
x
(there can be several in the dataset – x0, x1, x2, ...)
It uses input datasets:
data1.txt
(linear equation)data2.txt
(Pythagoras theorem)data3.txt
(prime number series)
Example of data1.txt
(linear equation):
3235 51 62 73
3350 52 63 74
3467 53 64 75
...
(100 elements total)
The first number is the value of y
, the following numbers are the values of x
(in this case x0, x1, x2).
To find the correct equation, combinations of equations are iterated over. It looks like this:
y = 1
y = 2
...
All equations of length 1 are tried, then of length 2. Equations of length 3 might look like:
y = 1 + x0
y = 1 + x1
...
and so on until reaching:
y = x0 * x1 + x2
As a result, the dataset (3235 51 62 73)
will produce a match, then this formula is tested on all datasets in data1.txt
(100 total). If all 100 datasets pass, the equation is considered solved.
Performance on CPU:
- Linear equation is solved in 7 seconds (5 characters):
v|x0;o|*;v|x1;o|+;v|x2
- Pythagoras theorem is solved in 8100 seconds (8 characters):
bl|(;v|x0;e|**2;o|+;v|x1;e|**2;br|);e|**0.5
Performance on GPU:
- Linear equation solved in 0.27 seconds (5 characters)
v|x0;o|*;v|x1;o|+;v|x2
- Pythagorean theorem solved in 168 seconds (8 characters)
bl|(;v|x0;e|**2;o|+;v|x1;e|**2;br|);e|**0.5
The main goal of this script is to solve unsolved mathematical problems:
But not all of them can be represented as datasets.
- Add more mathematical operations – sin, cos, tg, ctg, π, e, log (performance will drop, but the probability of finding a formula will increase).
- Add datasets for other unsolved mathematical problems.
- Set the variable
dataset_id
to the dataset ID (1 – linear, 2 – Pythagoras theorem, 3 – prime number series). To add a dataset for a new equation, place the file in thedatasets
folder (tab separator; first element isy
, the rest arex
). - Run the file
ludmila_cpu.py
with the command:
c:\Python311\python d:\python\maths\ludmila_cpu.py
- The result will be in the console and also in the log file
log.txt
. - To run the GPU version use ludmila_gpu.py
- To run ludmila_jupyter_gpu.py use Jupyter Notebook ludmila_jupyter_gpu.ipynb
- ludmila_cpu.py – CPU
- ludmila_cpu_processpool.py – CPU multiprocessing
- ludmila_gpu.py - GPU (recommended)
- ludmila_jupyter_cpu.py – Jupyter Notebook CPU
- ludmila_jupyter_cpu_processpool.py – Jupyter Notebook CPU multiprocessing
- ludmila_jupyter_gpu.py - Jupyter Notebook GPU (recommended), also see notebook ludmila_jupyter_gpu.ipynb