Professional Documents
Culture Documents
Variables Units m s kg T V
pF Pressure −1 −2 1 0 0
R Resistance −2 3 −1 0 2
S Shear modulus −1 −2 1 0 0
Lrad Spectral radiance 0 −2 1 0 0
kspring Spring constant 0 −2 1 0 0
den Surface charge 0 −2 1 0 −1
density
T, T1, T2 Temperature 0 0 0 1 0
Thermal conductivity 1 −3 1 −1 0
t, t1 Time 0 1 0 0 0
Torque 2 −2 1 0 0
Avec Vector potential −1 1 0 0 1
u, v, v1, c, w Velocity 1 −1 0 0 0
Algorithm comparison mysteries, where our neural network enables eliminating variables
We reviewed the symbolic regression literature for publicly available by discovering symmetries and separability. The neural network
software against which our method could be compared. To the best of our becomes even more important when we rerun AI Feynman without
knowledge, the best competitor by far is the commercial Eureqa software the dimensional analysis module: It now solves 93% of the mysteries
sold by Nutonian Inc. at https://www.nutonian.com/products/eureqa, and makes very heavy use of the neural network to discover separa-
implementing an improved version of the generic search algorithm bility and translational symmetries. Without dimensional analysis,
outlined in (27). many of the mysteries retain variables that appear only raised to some
We compared the AI Feynman and Eureqa algorithms by apply- power or in a multiplicative prefactor, and AI Feynman tends to
ing them both to the Feynman Database for symbolic regression, recursively discover them and factor them out one by one. For example,
allowing a maximum of 2 hours of central processing unit (CPU) the neural network strategy is used six times when solving
time per mystery. Tables 4 and 5 show that Eureqa solved 71% of
the 100 basic mysteries, while AI Feynman solved 100%. m 1 m 2
G
F = ───────────────────
For this comparison, the AI Feynman algorithm was run using (x 2 − x 1) 2 + (y 2 − y 1) 2 + (z 2 − z 1) 2
the hyperparameter settings in Table 2. For Eureqa, each mystery was
run on four CPUs. The symbols used in trying to solve the equations without dimensional analysis: three times to discover translational
were +, −, *, /, constant, integer constant, input variable, sqrt, exp, symmetry that replaces x2 − x1, y2 − y1, and z2 − z1 by new variables,
log, sin, and cos. To help Eureqa gain speed, we included the addi- once to group together G and m1 into a new variable a, once to group
tional functions arcsin and arccos only for those mysteries requiring together a and m2 into a new variable b, and one last time to discover
them, and we used only 300 data points (since it does not use a neural separability and factor out b. This shows that although dimensional
network, adding additional data does not help much). The time taken analysis often provides major time savings, it is usually not necessary
to solve an equation using our algorithm, as presented in Tables 4 for successfully solving the problem.
and 5, corresponds to the time needed for an equation to be solved Inspection of how AI Feynman and Eureqa make progress over
using a set of symbols that can actually solve it (see Table 1). Equations time reveals interesting differences. The progress of AI Feynman
I.15.3t and I.48.2 were solved using the second set of symbols, so the over time corresponds to repeatedly reducing the number of inde-
overall time needed for these two equations is 1 hour longer than pendent variables, and every time this occurs, it is virtually guaranteed
the one listed in the tables. Equations I.15.3x and II.35.21 were to be a step in the right direction. In contrast, genetic algorithms
solved using the third set of symbols, so the overall time taken is such as Eureqa make progress over time by finding successively better
2 hours longer than the one listed here. approximations, but there is no guarantee that more accurate symbolic
Closer inspection of these tables reveals that the greatest improve- expressions are closer to the truth when viewed as strings of symbols.
ment of our algorithm over Eureqa is for the most complicated Specifically, by virtue of being a genetic algorithm, Eureqa has the
Table 4. Tested Feynman equations, part 1. Abbreviations in the “Methods used” column: da, dimensional analysis; bf, brute force; pf, polyfit; ev, set two
variables equal; sym, symmetry; sep, separability. Suffixes denote the type of symmetry or separability (sym–, translational symmetry; sep*, multiplicative
separability; etc.) or the preprocessing before brute force (e.g., bf-inverse means inverting the mystery function before bf).
Feynman Eq. Equation Solution Time (s) Methods Used Data Needed Solved By Eureqa Solved W/o Noise
da Tolerance
_
I.6.20a 2
e − /2 / √ 2
f = 16 bf 10 No Yes 10−2
_
I.6.20 / √ 2 2
e −2
f =
2
_
2 2992 ev, bf-log 102 No Yes 10−4
_
/ √ 2 2 103 10−4
− 1) 2
I.6.20b 4792 sym–, ev, bf-log No Yes
(_
e − 2
f = 2
__________________
I.8.14 544 da, pf-squared 102 No Yes 10−4
√ (x 2 − x 1
d = ) 2 + (y 2
− y 1) 2
I.11.19 A = x1y1 + x2y2 + x3y3 184 da, pf 102 Yes Yes 10−3
I.12.1 F = Nn 12 da, bf 10 Yes Yes 10−3
I.12.2 _
F = 1 2
2
q q 17 da, bf 10 Yes Yes 10−2
4ϵ r
I.12.4 _
E f =
1
2
q 12 da 10 Yes Yes 10−2
4ϵ r
I.13.4 _1 m(v 2 + u 2 + w 2)
K = 22 da, bf 10 Yes Yes 10−4
2
I.13.12 U = G m 1 m 2( _1
− r_1 1 )
r 2
20 da, bf 10 Yes Yes 10−4
ks pring x 2
I.14.4 _
U =
9 da 10 Yes Yes 10−2
2
I.15.3x _
x 1 =
_x − ut
22 da, bf 10 No No 10−3
2 2
√ 1 − u
/ c
I.15.10 _
p = _0
m v 13 da, bf 10 No Yes 10−4
2 2
√ 1 − v
/ c
I.16.6 _
u + v
v 1 = 2
18 da, bf 10 No Yes 10−3
1 + uv / c
I.18.4 _
r = 1 1
m r + m r
m 1 + m 2
2 2
17 da, bf 10 Yes Yes 10−2
I.24.6 _1 m(
E = 2
+ 20 ) x 2 22 da, bf 10 Yes Yes 10−4
4
I.25.13 _
Ve =
q
10 da 10 Yes Yes 10−2
C
Feynman Eq. Equation Solution Time (s) Methods Used Data Needed Solved By Eureqa Solved W/o Noise
da Tolerance
I.26.2 1 = arcsin (n sin 2) 530 da, bf-sin 102 Yes Yes 10−2
I.27.6 _
1 1
ff =
_ n
_
14 da, bf 10 Yes Yes 10−2
d1 + d2
I.29.4 _
k = 8 da 10 Yes Yes 10−2
c
I.30.3 I * =
sin 2(n / 2)
I * 0 _
118 da, bf 102 Yes Yes 10−3
2
sin ( / 2)
102 10−3
I.30.5
(nd
= arcsin _ ) 529 da, bf-sin Yes Yes
I.32.5 _3
P =
q 2 a 2 13 da 10 Yes Yes 10−2
6ϵ c
I.34.8 _
=
qvB 13 da 10 Yes Yes 10−2
p
I.34.10 _
= 0
13 da, bf 10 No Yes 10−3
1 − v / c
I.34.14 _
=
_1 + v / c
0 14 da, bf 10 No Yes 10−3
√ 1 − v
2 2
/ c
I.38.12 _
4ϵ ℏ
r = 2
2
13 da 10 Yes Yes 10−2
m q
I.39.10 _3 p V
E = 8 da 10 Yes Yes 10−2
2 F
I.39.11 _
1
E = p F V 13 da, bf 10 Yes Yes 10−3
− 1
I.39.22 _
P F = b n k T
16 da, bf 10 Yes Yes 10−4
V
mgx
10−2
_
I.40.1 n 0 e −k T
n = b 20 da, bf 10 No Yes
I.41.16 _
2 2 ℏ
L rad =
3
22 da, bf 10 No No 10−5
c (e k T − 1)
_
ℏ
b
I.43.16 _
v = drift q V
e
14 da 10 Yes Yes 10−2
d
I.43.43 _
= 1 _
b
k v 16 da, bf 10 Yes Yes 10−3
− 1 A
_
I.47.23 c = _ √ 14 da, bf 10 Yes Yes 10−2
pr
Feynman Eq. Equation Solution Time (s) Methods Used Data Needed Solved By Eureqa Solved W/o Noise
da Tolerance
I.48.20 _
E = _m c
2
108 da, bf 102 No No 10−5
√ 1 − v
2 2
/ c
advantage of not searching the space of symbolic expressions blindly noise added to the independent variables, as well as directly on
like our brute-force module, but rather with the possibility of a net real-world data.
drift toward more accurate (“fit”) equations. The flip side of this is
that if Eureqa finds a fairly accurate yet incorrect formula with a Bonus mysteries
quite different functional form, it risks getting stuck near that local The 100 basic mysteries discussed above should be viewed as a train-
optimum. This reflects a fundamental challenge for genetic approaches ing set for our AI Feynman algorithm, since we made improvements
symbolic regression: If the final formula is composed of separate parts to its implementation and hyperparameters to optimize performance.
II.2.42 _
P = 2
1
(T − T ) A 54 da, bf 10 Yes Yes 10−3
d
II.3.24 _
P
F E = 8 da 10 Yes Yes 10−2
2
4 r
II.4.23 _
Ve =
q 10 da 10 Yes Yes 10−2
4ϵr
II.6.11 _ _
1
Ve = d
2
p cos 18 da, bf 10 Yes Yes 10−3
4ϵ r
4ϵ 5 √
II.6.15a _
E f =
p z
_
3
d
x 2 + y 2
2801 da, sm, bf 104 No Yes 10−3
r
II.6.15b _ p
_d
3
E f =
cos sin 23 da, bf 10 Yes Yes 10−2
4ϵ 3 r
ϵ E2
II.8.31 _
E den = f
8 da 10 Yes Yes 10−2
2
II.10.9 _
E f =
den _
1
13 da, bf 10 Yes Yes 10−2
ϵ 1 +
II.11.3 _
x =
2 f
2
qE 25 da, bf 10 Yes Yes 10−3
m(0 −
)
n p2 E f
II.11.20 _
P * = d
18 da, bf 10 Yes Yes 10−3
3 k b T
II.11.27 _
n
P * = ϵ E f 337 da bf-inverse 102 No Yes 10−3
1 − n / 3
II.13.17 _
1
B = _
2I 13 da 10 Yes Yes 10−2
2
r
4ϵ c
II.13.23 _
c =
_c
0 13 da, bf 102 No Yes 10−4
√ 1 − v
2 2
/ c
II.13.34 _
j = _
c
0 v
14 da, bf 10 No Yes 10−4
√ 1 − v
2 2
/ c
II.21.32 _
Ve =
q 21 da, bf 10 Yes Yes 10−3
4ϵr(1 − v / c)
_
II.24.17
√ 62 da bf 10 No Yes 10−5
2 2
k = _
_
− 2
2
c d
Feynman Eq. Equation Solution Time Methods Used Data Needed Solved By Solved W/o da Noise
(s) Eureqa Tolerance
II.34.2a _
I =
qv 11 da 10 Yes Yes 10−2
2r
II.34.2 _
M =
qvr 11 da 10 Yes Yes 10−2
2
II.34.11 _
= _
g qB 16 da, bf 10 Yes Yes 10−4
2m
II.34.29a _
M =
qh 12 da 10 Yes Yes 10−2
4m
II.34.29b _
E = _ M
z
g B J 18 da, bf 10 Yes Yes 10−4
ℏ
II.35.18 ______________________
n = 0 n
30 da, bf 10 No Yes 10−2
exp ( m B / (k b T ) ) + exp (− m B / (k b T ) )
da, halve-input,
n M tanh (_ 10−4
)
II.35.21 M = kM b T
B 1597 10 Yes No
bf
II.38.3 _
YAx
F =
47 da, bf 10 Yes Yes 10−3
d
II.38.14 _
Y
S = 13 da, bf 10 Yes Yes 10−3
2(1 + )
III.4.32 _
_1
n = ℏ
20 da, bf 10 No Yes 10−3
e k T − 1
b
III.4.33 _
_ℏ
E = ℏ
19 da, bf 10 No Yes 10−3
e k T − 1
b
III.7.38 _
= M
2 B 13 da 10 Yes Yes 10−2
ℏ
III.8.54 ( ℏ )
p = sin _
Et
2
39 da, bf 10 No Yes 10−3
10−3
qVe
_
III.14.14 I 0( e k T − 1)
I =
b 18 da, bf 10 No Yes
III.15.27 _
2
k =
14 da, bf 10 Yes Yes 10−3
nd
III.17.37 f = (1 + cos ) 27 bf 10 Yes Yes 10−3
10−5
4
III.19.51 _
E =
2 _
2
1
2
− m q 18 da, bf 10 Yes Yes
2 (4ϵ) ℏ n
− c 0 qA vec
_
III.21.20 j = m 13 da 10 Yes Yes 10−2
for ab to be shortened from “aLb * E” to “ab ∧ , ” would enable brute numerically optimized over. This strategy is currently implemented
force to solve many mysteries faster, including Jackson 2.11. in Eureqa, but not AI Feynman, and could make a useful upgrade as
Last, a powerful strategy that could ameliorate both of these fail- long as it is done in a way that does not unduly slow down the sym-
ures would be to add symbols corresponding to parameters that are bolic brute-force search. In summary, the two failures of the AI
Table 6. Tested bonus equations. Goldstein 8.56 is for the special case where the vectors p and A are parallel.
Source Equation Solved Solved by Eureqa Methods used
( 2 _θ
)
2
Rutherford scattering A = _1 2
Z Z αℏc
Yes No da, bf-sqrt
4E sin ( 2 )
_
Friedman equation H = _
8G
3
√
_
−
f
2
k c 2
af
Yes No da, bf-squared
Compton scattering _
U =
_ E
Yes No da, bf
E
1 +
2(
1 − cos )
m c
1 = arccos (_
1 − _vc cos 2)
Relativistic aberration cos − _v Yes No da, bf-cos
2 c
______________
√
Goldstein 3.16 Yes No da, bf-squared
( 2)
2
v = _
2
m
_
L
E − U −
___________
√
Goldstein 3.99 Yes No da, sym*, bf
= 1 + _ 2 ϵ 2 E L 2
m (Z Z q 2) 2
1 2
___________________
Goldstein 8.56 Yes No da, sep+, bf-squared
√ (p − q Av
E = ec) 2 c 2 +
m 2 c 4
+ q Ve
Jackson 4.60 Ve = E f cos (_ − r) Yes No da, sep*, bf
3
− 1 _ d
+ 2 2
r
√
2
1 − _
v
2
Jackson 11.38 (Doppler) _
0 =
c
Yes No da, cos-input, bf
1 + _v cos c
8G( 2
+ H 2)
Weinberg 15.2.1 c 2 k Yes Yes da, bf
_
= 3 _f
af
8G[ 2
+ c 2 H 2(1 − 2 ) ]
Weinberg 15.2.2 c 4 k Yes Yes da, bf
p f = − _ _ f
1
af
( ω )
[ _ − sin 2 θ]
Schwarz 13.132 (Klein-Nishina) _
π α 2 ℏ 2 ω
A = _ 0 2 ω 0 _
+ ωω 0 Yes No da, sym/, sep*, sin-input, bf
2 2
ω
m c
Feynman algorithm signal not unsurmountable obstacles, but which frequently occur in physics equations. For example, if we sus-
motivation for further work. pect that our formula contains a partial differential equation, then
In addition, we tested the performance of our algorithm on the the user can simply estimate various derivatives from the data (or its
mystery functions presented in (41) (we wish to thank the anonymous interpolation, using a neural network) and include them in the AI
reviewer who brought this dataset to our attention). Some equations Feynman algorithm as independent variables, thus discovering the
appear twice; we included them only once. Our algorithm again differential equation in question.
outperformed Eureqa, discovering 66.7% of the equations, while We saw how, even if the mystery data have very low noise, substantial
Eureqa discovered 48.9%. The fact that the AI Feynman algorithm de facto noise was introduced by imperfect neural network fitting,
performs less well on this test set than on genuine physics formulas complicating subsequent solution steps. It will therefore be valuable
traces back to the fact that most of the equations presented in (41) to explore better neural network architectures, ideally reducing fitting
are rather arbitrary compositions of elementary functions unlikely to noise to the 10−6 level. This may be easier than in many other con-
occur in real-world problems, thus lacking the symmetries, separa- texts, since we do not care whether the neural network generalizes
bility, etc., that the neural network part of our algorithm is able poorly outside the domain where we have data: As long as it is highly
to exploit. accurate within this domain, it serves our purpose of correctly factor-
ing separable functions, etc.
Our brute-force method can be better integrated with a neural net-
DISCUSSION work search for hidden simplicity. Our implemented symmetry search
We have presented a novel physics-inspired algorithm for solving simply tests whether two input variables a and b can be replaced by
multidimensional analytic regression problems: finding a symbolic a bivariate function of them, specifically +, −, *, or /, corresponding
https://github.com/SJ001/AI-Feynman; pseudocode is provided below 8. B. Oh, Y. Na, J. Yang, S. Park, J. Nang, J. Kim, Genetic algorithm-based dynamic vehicle
route search using car-to-car communication. Adv. Electr. Comput. En. 10, 81–86
for symmetry and separability exploitation.
(2010).
9. A. Ram, R. Arkin, G. Boone, M. Pearce, Using genetic algorithms to learn reactive control
Algorithm 1 AI Feynman: Translational symmetry parameters for autonomous robotic navigation. Adapt. Behav. 2, 277–305 (1994).
10. B. Delman, Genetic algorithms in cryptography. Rochester Institute of Technology (2004).
Require Dataset D = {(x, y)}. 11. S. Kim, P. Lu, S. Mukherjee, M. Gilbert, L. Jing, V. Ceperic, M. Soljacic, arXiv
preprint arXiv:1912.04825 (2019).
Require net: trained neural network
12. R. J. Bauer, Genetic algorithms and investment strategies, (John Wiley & Sons, ed. 1, 1994),
Require NNerror: the neural network validation error vol. 19, p. 320.
a = 1 13. R. Venkatesan, V. Kumar, A genetic algorithms approach to forecasting of wireless
for i in len(x) do: subscribers. Int. J. Forecast. 18, 625–646 (2002).
for j in len(x) do: 14. W. L. Cava, T. R. Singh, J. Taggart, S. Suri, J. Moore, International Conference on Learning
if i < j: Representations (2019), https://openreview.net/forum?id=Hke-JhA9Y7.
15. S. McAleer, F. Agostinelli, A. Shmakov, P. Baldi, International Conference on Learning
xt = x Representations (2019); https://openreview.net/forum?id=Hyfn2jCcKm.
xt[i] = xt[i] + a 16. J. R. Koza, J. R. Koza, Genetic Programming: On the Programming of Computers by Means of
xt[j] = xt[j] + a Natural Selection (MIT Press, 1992), vol. 1.
error = RMSE(net(x),net(xt)) 17. M. D. Schmidt, R. R. Vallabhajosyula, J. W. Jenkins, J. E. Hood, A. S. Soni, J. P. Wikswo,
H. Lipson, Automated refinement and inference of analytical models for metabolic
error = error/RMSE(net(x))
networks. Phys. Biol. 8, 055011 (2011).
if error <7 × NNerror: 18. R. K. McRee, Proceedings of the 12th Annual Conference Companion on Genetic and
xt[i] = xt[i] − xt[j]
40. M. Schwartz, Quantum Field Theory and the Standard Model, Quantum Field Theory and the project management: M.T. Design of methodology, programming, experimental validation, data
Standard Model (Cambridge Univ. Press, 2014); curation, data analysis, validation, and manuscript writing: S.-M.U. and M.T. Competing interests:
https://books.google.com/books?id=HbdEAgAAQBAJ. The authors declare that they have no competing interests. Data and materials availability: All
41. J. McDermott, D. R. White, S. Luke, L. Manzoni, M. Castelli, L. Vanneschi, W. Jaskowski, data needed to evaluate the conclusions in the paper are present in the paper, at https://
K. Krawiec, R. Harper, K. De Jong, Proceedings of the 14th Annual Conference on Genetic and space.mit.edu/home/tegmark/aifeynman.html, and at https://github.com/SJ001/AI-Feynman.
Evolutionary Computation (ACM, 2012), pp. 791–798. Any additional datasets, analysis details, and material recipes are available upon request.
Acknowledgments: We thank R. Domingos, Z. Dong, M. Skuhersky, A. Tan, and T. Wu for the Submitted 7 June 2019
helpful comments, and the Center for Brains, Minds, and Machines (CBMM) for hospitality. Accepted 3 January 2020
Funding: This work was supported by The Casey and Family Foundation, the Ethics and Published 15 April 2020
Governance of AI Fund, the Foundational Questions Institute, the Rothberg Family Fund for 10.1126/sciadv.aay2631
Cognitive Science, and the Templeton World Charity Foundation Inc. The opinions expressed
in this publication are those of the authors and do not necessarily reflect the views of the Citation: S.-M. Udrescu, M. Tegmark, AI Feynman: A physics-inspired method for symbolic regression.
Templeton World Charity Foundation Inc. Author contributions: Concept, supervision, and Sci. Adv. 6, eaay2631 (2020).
REFERENCES This article cites 10 articles, 2 of which you can access for free
http://advances.sciencemag.org/content/6/16/eaay2631#BIBL
PERMISSIONS http://www.sciencemag.org/help/reprints-and-permissions
Science Advances (ISSN 2375-2548) is published by the American Association for the Advancement of Science, 1200 New
York Avenue NW, Washington, DC 20005. The title Science Advances is a registered trademark of AAAS.
Copyright © 2020 The Authors, some rights reserved; exclusive licensee American Association for the Advancement of
Science. No claim to original U.S. Government Works. Distributed under a Creative Commons Attribution NonCommercial
License 4.0 (CC BY-NC).