Research ArticleCOMPUTER SCIENCE

# AI Feynman: A physics-inspired method for symbolic regression

See allHide authors and affiliations

Vol. 6, no. 16, eaay2631

### Figures

• Fig. 1 Schematic illustration of our AI Feynman algorithm.It is iterative as described in the text, with four of the steps capable of generating new mystery datasets that get sent to fresh instantiations of the algorithm, which may or may not return a solution.
• Fig. 2 Example: How our AI Feynman algorithm discovered mystery Equation 5.Given a mystery table with many examples of the gravitational force F together with the nine independent variables G, m1, m2, x1,..., z2, this table was recursively transformed into simpler ones until the correct equation was found. First, dimensional analysis generated a table of six dimensionless independent variables a = m2/m1,..., f = z1/x1 and the dimensionless dependent variable F≡F÷Gm12/x12. Then, a neural network was trained to fit this function, which revealed two translational symmetries (each eliminating one variable, by defining g ≡ c−d and h ≡ e − f) as well as multiplicative separability, enabling the factorization F(a, b, g, h) = G(a) H (b, g, h), thus splitting the problem into two simpler ones. Both G and H then were solved by polynomial fitting, the latter after applying one of a series of simple transformations (in this case, inversion). For many other mysteries, the final step was instead solved using brute-force symbolic search as described in the text.

### Tables

• Table 1 Functions optionally included in brute-force search.

The following three subsets are tried in turn: “+−*/><~SPLICER”, “+−*/> 0~” and “+−*/><~REPLICANTS0”.

 Symbol Meaning Arguments + Add 2 * Multiply 2 − Subtract 2 / Divide 2 > Increment 1 < Decrement 1 ∼ Negate 1 0 0 0 1 1 0 R sqrt 1 E exp 1 P π 0 L ln 1 I invert 1 C cos 1 A abs 1 N arcsin 1 T arctan 1 S sin 1
• Table 2 Hyperparameters in our algorithm and the setting we use in this paper.

 Symbol Meaning Setting ϵbr Tolerance in brute-forcemodule 10−5 ϵpol Tolerance in polynomialfit module 10−4 ϵNN0 Validation errortolerance for neuralnetwork use 10−2 ϵsep Tolerance forseparability 10 ϵNN ϵsym Tolerance for symmetry 7 ϵNN ϵbfsep Tolerance in brute-forcemodule afterseparability 10 ϵNN ϵpolsep Tolerance in polynomialfit module afterseparability 10 ϵNN λ Importance of accuracyrelative to complexity Nd1/2
• Table 3 Unit table used for our automated dimensional analysis.

 Variables Units m s kg T V a, g Acceleration 1 −2 0 0 0 h, ℏ, L, Jz Angular momentum 2 −1 1 0 0 A Area 2 0 0 0 0 kb Boltzmann constant 2 −2 1 −1 0 C Capacitance 2 −2 1 0 −2 q, q1, q2 Charge 2 −2 1 0 −1 j Current density 0 −3 1 0 −1 I, I0 Current Intensity 2 −3 1 0 −1 ρ, ρ0 Density −3 0 1 0 0 θ, θ1, θ2, σ, n Dimensionless 0 0 0 0 0 g_, kf, γ, χ, β, α Dimensionless 0 0 0 0 0 pγ, n0, δ, f, μ Dimensionless 0 0 0 0 0 n0, δ, f, μ, Z1, Z2 Dimensionless 0 0 0 0 0 D Diffusion coefficient 2 −1 0 0 0 μdrift Drift velocity constant 0 −1 1 0 0 pd Electric dipole moment 3 −2 1 0 −1 Ef Electric field −1 0 0 0 1 ϵ Electric permitivity 1 −2 1 0 −2 E, K, U Energy 2 −2 1 0 0 Eden Energy density −1 −2 1 0 0 FE Energy flux 0 −3 1 0 0 F, Nn Force 1 −2 1 0 0 ω, ω0 Frequency 0 −1 0 0 0 kG Grav. coupling (Gm1m2) 3 −2 1 0 0 H Hubble constant 0 −1 0 0 0 Lind Inductance −2 4 −1 0 2 nrho Inverse volume −3 0 0 0 0 x, x1, x2, x3 Length 1 0 0 0 0 y, y1, y2, y3 Length 1 0 0 0 0 z, z1, z2, r, r1, r2 Length 1 0 0 0 0 λ, d1, d2, d, ff, af Length 1 0 0 0 0 I1, I2, I*, I*0 Light intensity 0 −3 1 0 0 B, Bx, By, Bz Magnetic field −2 1 0 0 1 μm Magnetic moment 4 −3 1 0 −1 M Magnetization 1 −3 1 0 −1 m, m0, m1, m2 Mass 0 0 1 0 0 μe Mobility 0 1 −1 0 0 p Momentum 1 −1 1 0 0 G Newton’s constant 3 −2 −1 0 0 P* Polarization 0 −2 1 0 −1 P Power 2 −3 1 0 0 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 density 0 −2 1 0 −1 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 V, V1, V2 Volume 3 0 0 0 0 ρc, ρc0 Volume charge density −1 −2 1 0 −1 Ve Voltage 0 0 0 0 1 k Wave number −1 0 0 0 0 Y Young modulus −1 −2 1 0 0
• 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/oda NoiseTolerance I.6.20a f=e−θ2/2/2π 16 bf 10 No Yes 10−2 I.6.20 f=e−θ22σ2/2πσ2 2992 ev, bf-log 102 No Yes 10−4 I.6.20b f=e−(θ−θ1)22σ2/2πσ2 4792 sym–, ev, bf-log 103 No Yes 10−4 I.8.14 d=(x2−x1)2+(y2−y1)2 544 da, pf-squared 102 No Yes 10−4 I.9.18 F=Gm1m2(x2−x1)2+(y2−y1)2+(z2−z1)2 5975 da, sym–, sym–, sep∗, pf-inv 106 No Yes 10−5 I.10.7 m=m01−v2c2 14 da, bf 10 No Yes 10−4 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=q1q24πϵr2 17 da, bf 10 Yes Yes 10−2 I.12.4 Ef=q14πϵr2 12 da 10 Yes Yes 10−2 I.12.5 F = q2Ef 8 da 10 Yes Yes 10−2 I.12.11 F = q(Ef + Bv sin θ) 19 da, bf 10 Yes Yes 10−3 I.13.4 K=12m(v2+u2+w2) 22 da, bf 10 Yes Yes 10−4 I.13.12 U=Gm1m2(1r2−1r1) 20 da, bf 10 Yes Yes 10−4 I.14.3 U = mgz 12 da 10 Yes Yes 10−2 I.14.4 U=kspringx22 9 da 10 Yes Yes 10−2 I.15.3x x1=x−ut1−u2/c2 22 da, bf 10 No No 10−3 I.15.3t t1=t−ux/c21−u2/c2 20 da, bf 102 No No 10−4 I.15.10 p=m0v1−v2/c2 13 da, bf 10 No Yes 10−4 I.16.6 v1=u+v1+uv/c2 18 da, bf 10 No Yes 10−3 I.18.4 r=m1r1+m2r2m1+m2 17 da, bf 10 Yes Yes 10−2 I.18.12 τ = rF sin θ 15 da, bf 10 Yes Yes 10−3 I.18.16 L = mrv sin θ 17 da, bf 10 Yes Yes 10−3 I.24.6 E=14m(ω2+ω02)x2 22 da, bf 10 Yes Yes 10−4 I.25.13 Ve=qC 10 da 10 Yes Yes 10−2 I.26.2 θ1 = arcsin (n sin θ2) 530 da, bf-sin 102 Yes Yes 10−2 I.27.6 ff=11d1+nd2 14 da, bf 10 Yes Yes 10−2 I.29.4 k=ωc 8 da 10 Yes Yes 10−2 I.29.16 x=x12+x22−2x1x2cos(θ1−θ2) 2135 da, sym–, bf-squared 103 No No 10−4 I.30.3 I*=I*0sin2(nθ/2)sin2(θ/2) 118 da, bf 102 Yes Yes 10−3 I.30.5 θ=arcsin(λnd) 529 da, bf-sin 102 Yes Yes 10−3 I.32.5 P=q2a26πϵc3 13 da 10 Yes Yes 10−2 I.32.17 P=(12ϵcEf2)(8πr2/3)(ω4/(ω2−ω02)2) 698 da, bf-sqrt 10 No Yes 10−4 I.34.8 ω=qvBp 13 da 10 Yes Yes 10−2 I.34.10 ω=ω01−v/c 13 da, bf 10 No Yes 10−3 I.34.14 ω=1+v/c1−v2/c2ω0 14 da, bf 10 No Yes 10−3 I.34.27 E = ℏω 8 da 10 Yes Yes 10−2 I.37.4 I*=I1+I2+2I1I2cosδ 7032 da, bf 102 Yes No 10−3 I.38.12 r=4πϵℏ2mq2 13 da 10 Yes Yes 10−2 I.39.10 E=32pFV 8 da 10 Yes Yes 10−2 I.39.11 E=1γ−1pFV 13 da, bf 10 Yes Yes 10−3 I.39.22 PF=nkbTV 16 da, bf 10 Yes Yes 10−4 I.40.1 n=n0e−mgxkbT 20 da, bf 10 No Yes 10−2 I.41.16 Lrad=ℏω3π2c2(eℏωkbT−1) 22 da, bf 10 No No 10−5 I.43.16 v=μdriftqVed 14 da 10 Yes Yes 10−2 I.43.31 D = μekbT 11 da 10 Yes Yes 10−2 I.43.43 κ=1γ−1kbvA 16 da, bf 10 Yes Yes 10−3 I.44.4 E=nkbTln(V2V1) 18 da, bf 10 Yes Yes 10−3 I.47.23 c=γprρ 14 da, bf 10 Yes Yes 10−2 I.48.20 E=mc21−v2/c2 108 da, bf 102 No No 10−5 I.50.26 x = x1[ cos (ωt) + α cos (ωt)2] 29 da bf 10 Yes Yes 10−2
• Table 5 Tested Feynman equations, part 2 (same notation as in Table 4).

 Feynman Eq. Equation Solution Time(s) Methods Used Data Needed Solved ByEureqa Solved W/o da NoiseTolerance II.2.42 P=κ(T2−T1)Ad 54 da, bf 10 Yes Yes 10−3 II.3.24 FE=P4πr2 8 da 10 Yes Yes 10−2 II.4.23 Ve=q4πϵr 10 da 10 Yes Yes 10−2 II.6.11 Ve=14πϵpdcos θr2 18 da, bf 10 Yes Yes 10−3 II.6.15a Ef=34πϵpdzr5x2+y2 2801 da, sm, bf 104 No Yes 10−3 II.6.15b Ef=34πϵpdr3cos θsin θ 23 da, bf 10 Yes Yes 10−2 II.8.7 E=35q24πϵd 10 da 10 Yes Yes 10−2 II.8.31 Eden=ϵEf22 8 da 10 Yes Yes 10−2 II.10.9 Ef=σdenϵ11+χ 13 da, bf 10 Yes Yes 10−2 II.11.3 x=qEfm(ω02−ω2) 25 da, bf 10 Yes Yes 10−3 II.11.17 n=n0(1+pdEfcos θkbT) 28 da, bf 10 Yes Yes 10−2 II.11.20 P*=nρpd2Ef3kbT 18 da, bf 10 Yes Yes 10−3 II.11.27 P*=nα1−nα/3ϵEf 337 da bf-inverse 102 No Yes 10−3 II.11.28 θ=1+nα1−(nα/3) 1708 da, sym*, bf 102 No Yes 10−4 II.13.17 B=14πϵc22Ir 13 da 10 Yes Yes 10−2 II.13.23 ρc=ρc01−v2/c2 13 da, bf 102 No Yes 10−4 II.13.34 j=ρc0v1−v2/c2 14 da, bf 10 No Yes 10−4 II.15.4 E = − μMB cos θ 14 da, bf 10 Yes Yes 10−3 II.15.5 E = − pdEf cos θ 14 da, bf 10 Yes Yes 10−3 II.21.32 Ve=q4πϵr(1−v/c) 21 da, bf 10 Yes Yes 10−3 II.24.17 k=ω2c2−π2d2 62 da bf 10 No Yes 10−5 II.27.16 FE=ϵcEf2 13 da 10 Yes Yes 10−2 II.27.18 Eden=ϵEf2 9 da 10 Yes Yes 10−2 II.34.2a I=qv2πr 11 da 10 Yes Yes 10−2 II.34.2 μM=qvr2 11 da 10 Yes Yes 10−2 II.34.11 ω=g_qB2m 16 da, bf 10 Yes Yes 10−4 II.34.29a μM=qh4πm 12 da 10 Yes Yes 10−2 II.34.29b E=g_μMBJzℏ 18 da, bf 10 Yes Yes 10−4 II.35.18 n=n0exp(μmB/(kbT))+exp(−μmB/(kbT)) 30 da, bf 10 No Yes 10−2 II.35.21 M=nρμMtanh(μMBkbT) 1597 da, halve-input, bf 10 Yes No 10−4 II.36.38 f=μmBkbT+μmαMϵc2kbT 77 da bf 10 Yes Yes 10−2 II.37.1 E = μM(1 + χ)B 15 da, bf 10 Yes Yes 10−3 II.38.3 F=YAxd 47 da, bf 10 Yes Yes 10−3 II.38.14 μS=Y2(1+σ) 13 da, bf 10 Yes Yes 10−3 III.4.32 n=1eℏωkbT−1 20 da, bf 10 No Yes 10−3 III.4.33 E=ℏωeℏωkbT−1 19 da, bf 10 No Yes 10−3 III.7.38 ω=2μMBℏ 13 da 10 Yes Yes 10−2 III.8.54 pγ=sin(Etℏ)2 39 da, bf 10 No Yes 10−3 III.9.52 pγ=pdEftℏsin((ω−ω0)t/2)2((ω−ω0)t/2)2 3162 da, sym–, sm, bf 103 No Yes 10−3 III.10.19 E=μMBx2+By2+Bz2 410 da, bf-squared 102 Yes Yes 10−4 III.12.43 L = nℏ 11 da, bf 10 Yes Yes 10−3 III.13.18 v=2Ed2kℏ 16 da, bf 10 Yes Yes 10−4 III.14.14 I=I0(eqVekbT−1) 18 da, bf 10 No Yes 10−3 III.15.12 E = 2U(1 − cos (kd)) 14 da, bf 10 Yes Yes 10−4 III.15.14 m=ℏ22Ed2 10 da 10 Yes Yes 10−2 III.15.27 k=2παnd 14 da, bf 10 Yes Yes 10−3 III.17.37 f = β(1 + αcos θ) 27 bf 10 Yes Yes 10−3 III.19.51 E=−mq42(4πϵ)2ℏ21n2 18 da, bf 10 Yes Yes 10−5 III.21.20 j=−ρc0qAvecm 13 da 10 Yes Yes 10−2
• 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 Rutherford scattering A=(Z1Z2αℏc4Esin2(θ2))2 Yes No da, bf-sqrt Friedman equation H=8πG3ρ−kfc2af2 Yes No da, bf-squared Compton scattering U=E1+Emc2(1−cos θ) Yes No da, bf Radiated gravitational wave power P=−325G4c5(m1m2)2(m1+m2)r5 No No – Relativistic aberration θ1=arccos(cos θ2−vc1−vccos θ2) Yes No da, bf-cos N-slit diffraction I=I0[sin(α/2)α/2sin(Nδ/2)sin(δ/2)]2 Yes No da, sm, bf Goldstein 3.16 v=2m(E−U−L22mr2) Yes No da, bf-squared Goldstein 3.55 k=mkGL2(1+1+2EL2mkG2cos(θ1−θ2)) Yes No da, sym–, bf Goldstein 3.64 (ellipse) r=d(1−α2)1+αcos(θ1−θ2) Yes No da, sym–, bf Goldstein 3.74 (Kepler) t=2πd3/2G(m1+m2) Yes No da, bf Goldstein 3.99 α=1+2ϵ2EL2m(Z1Z2q2)2 Yes No da, sym*, bf Goldstein 8.56 E=(p−qAvec)2c2+m2c4+qVe Yes No da, sep+, bf-squared Goldstein 12.80 E=12m[p2+m2ω2x2(1+αxy)] Yes Yes da, bf Jackson 2.11 F=q4πϵy2[4πϵVed−qdy3(y2−d2)2] No No – Jackson 3.45 Ve=q(r2+d2−2drcos α)12 Yes No da, bf-inv Jackson 4.60 Ve=Efcos θ(α−1α+2d3r2−r) Yes No da, sep*, bf Jackson 11.38 (Doppler) ω0=1−v2c21+vccos θω Yes No da, cos-input, bf Weinberg 15.2.1 ρ=38πG(c2kfaf2+H2) Yes Yes da, bf Weinberg 15.2.2 pf=−18πG[c4kfaf2+c2H2(1−2α)] Yes Yes da, bf Schwarz 13.132 (Klein-Nishina) A=πα2ℏ2m2c2(ω0ω)2[ω0ω+ωω0−sin2θ] Yes No da, sym/, sep*, sin-input, bf