Abstract
In this work, we ‘derived’ the famous Pythagorean theorem from the measurements of the sides of right-angled triangles with machine learning. In classical Euclidean geometry, this result is proved with rigorous geometrical argument, but we have followed a data-driven approach and got the same result without entering a single step in the domain of geometry. We used symbolic regression with genetic programming to reach the model. As far as our knowledge goes, this result is a novel one and may open up a new avenue of applying machine learning tool in geometry. We have used Python programming language 3.7 and libraries such as DEAP (v1.2) and pygraphviz. The whole project can be found on https://github.com/snigdhasjg/Pythagorean-Triplate.git.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
References
Holland, J.H.: Adaptation in Natural and Artificial Systems.: University of Michigan Press, Ann Arbor (1975)
Gen, M., Cheng, R.: Genetic Algorithms and Engineering Design. Wiley, New York (1997)
Holland's schema theorem
Human-competitive results produced by genetic programming by John R Koza
Smits, G., Kotanchek, M. : Pareto-front exploitation in symbolic regression. In: Genetic Programming Theory and Practice II. Springer, Ann Arbor, pp 283–299 (2004)
Martí, R., Resende, M.G.C., Ribeiro, C.C.: Multi-start methods for combinatorial optimization. Eur. J. Oper. Res. 226(1), 1–8 (2013)
Dao, S.D., Abhary, K., Marian, R.: An Adaptive Restarting Genetic Algorithm for Global Optimization
Vladislavleva, E.J., Smits, G.F., Hertog, D.: Order of nonlinearity as a complexity measure for models generated by symbolic regression via pareto genetic programming. In: IEEE Trans. Evolut. Comput. 13(2), 334 (2009)
Kessaci, Y., et al.: Parallel evolutionary algorithms for energy aware scheduling. In: Bouvry, P., González-Vélez, H., Kołodziej, J. (eds.) Intelligent Decision Systems in Large-Scale Distributed Environments, pp. 75–100. Springer, Berlin (2011)
Dao, S.D., Abhary, K., Marian, R.: Optimisation of partner selection and collaborative transportation scheduling in virtual enterprises using GA. Expert Syst. Appl. 41(15), 6701–6717 (2014)
Purohit, A., Choudhari, N.S., Tiwari, A.: Code Bloat Problem in Genetic Programming
Trujillo, L., Naredo, E., Martínez, Y.: Preliminary Study of Bloat in Genetic Programming with Behaviour-Based Search
Koza, J.R.: Genetic Programming: On the Programming of Computers by Means of Natural Selection (Chap. 6), p 114
Dignum, S., Poli, R.: Operator Equalisation and Bloat Free GP
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Appendix
Appendix
The algorithm gives output as string representation of tree like \(power\left( {add\left( {mul\left( {A,A} \right),mul\left( {B,B} \right)} \right),1,2} \right)\) that can be expressed as \(\sqrt {A^{2} + B^{2} }\). In Fig. 5, the same equation is represented as tree.
Not every time this algorithm gives the same result. Some non-trivial and apparently complicated trees which finally leads to the Pythagorean theorem are:
-
power(add(mul(A,A),mul(B,B)),1,2)
-
power(add(mul(B,B),mul(A,A)),2,4)
-
power(add(mul(B,B),mul(A,A)),3,6)
-
power(add(mul(B,B),mul(A,A)),4,8)
-
power(add(mul(A,A),mul(B,B)),5,10)
-
power(add(mul(A,A),power(B,8,4)),1,2)
-
power(add(power(A,8,4),mul(B,B)),2,4)
-
power(add(power(A,4,2),mul(B,B)),5,10)
-
power(add(sub(mul(A,A),sub(A,A)),mul(B,B)),1,2)
-
power(add(sub(A,A),add(mul(A,A),mul(B,B))),1,2)
-
power(add(mul(power(B,4,2),safe_div(A,A)),add(mul(A,A),sub(B,B))),4,8)
-
power(sub(add(mul(A,A),sub(A,B)),sub(sub(A,B),mul(B,B))),5,10)
-
power(add(mul(B,B),mul(A,power(power(A,4,3),3,4))),3,6)
-
power(sub(mul(add(B,A),A),sub(mul(B,A),mul(B,B))),2,4)
-
add(power(add(add(mul(B,B),sub(A,A)),mul(A,A)),2,4),safe_div(A,add(mul(B,B),
mul(power(B,10,10),A))))
-
power(add(add(mul(A,A),mul(B,B)),safe_div(add(B,A),power(B,5,1))),4,8)
1.1 Run Results
We have achieved 8 successful runs out of 10 test runs. The results are as follows.
-
1.
power(add(mul(A, A), mul(B, B)), 1, 2)
-
2.
power(add(mul(B, B), mul(A, A)), 3, 6)
-
3.
power(sub(mul(B, B), sub(safe_div(power(B, 3, 5), mul(B, B)), mul(A, A))), 4, 8)
-
4.
power(sub(add(mul(A, A), mul(B, B)), safe_div(sub(B, B), A)), 2, 4)
-
5.
power(add(mul(A, A), add(sub(B, B), mul(B, B))), 4, 8)
-
6.
power(mul(add(mul(A, A), power(B, 6, 3)), add(mul(A, A), power(B, 6, 3))), 2, 8)
-
7.
power(add(mul(A, A), mul(B, B)), 4, 8)
-
8.
power(add(mul(A, A), mul(B, B)), 5, 10)
All these generated trees are having fitness value near 0, i.e., 0.0407. This small error is due to choosing input points as floating number.
And the other 2 unsuccessful runs are:
-
1.
add(B, safe_div(add(power(A, 5, 6), mul(A, A)), add(safe_div(mul(A, A), add(A, B)), add(B, B))))
which has fitness value of 3.795.
-
2.
add(B, safe_div(safe_div(add(mul(B, A), B), safe_div(B, A)), add(add(A, B), safe_div(mul(B, B), add(B, A)))))
which has fitness value of 3.816.
Rights and permissions
Copyright information
© 2021 Springer Nature Singapore Pte Ltd.
About this paper
Cite this paper
Ghosh, S., Goswami, D., Datta, C.R. (2021). An Approach to Geometric Modeling Using Genetic Programming. In: Das, N.R., Sarkar, S. (eds) Computers and Devices for Communication. CODEC 2019. Lecture Notes in Networks and Systems, vol 147. Springer, Singapore. https://doi.org/10.1007/978-981-15-8366-7_13
Download citation
DOI: https://doi.org/10.1007/978-981-15-8366-7_13
Published:
Publisher Name: Springer, Singapore
Print ISBN: 978-981-15-8365-0
Online ISBN: 978-981-15-8366-7
eBook Packages: EngineeringEngineering (R0)