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)data4.txt(percentage formula)data5.txt(area of a rectangle)
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:
- Pythagoras theorem is solved in 19 seconds (6 characters):
bl|(;v|x0;e|**2;o|+;v|x1;e|**2;br|);e|**0.5
Performance on GPU:
- Pythagorean theorem solved in 27 seconds (6 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_idto the dataset ID (1 – linear, 2 – Pythagoras theorem, 3 – prime number series). To add a dataset for a new equation, place the file in thedatasetsfolder (tab separator; first element isy, the rest arex). - Run the file
ludmila_cpu.pywith 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.py - CPU/GPU
- ludmila.ipynb - Jupyter Notebook