<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: FONDATION ALPHA0AZ1OMEGA</title>
    <description>The latest articles on DEV Community by FONDATION ALPHA0AZ1OMEGA (@fondation_alpha0az1omega_).</description>
    <link>https://dev.to/fondation_alpha0az1omega_</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4161446%2F0491c7a9-f632-48ec-af44-d6c2efc74f52.jpg</url>
      <title>DEV Community: FONDATION ALPHA0AZ1OMEGA</title>
      <link>https://dev.to/fondation_alpha0az1omega_</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/fondation_alpha0az1omega_"/>
    <language>en</language>
    <item>
      <title>How I Rediscovered Kepler's Third Law on a Phone, in 204 Lines</title>
      <dc:creator>FONDATION ALPHA0AZ1OMEGA</dc:creator>
      <pubDate>Sun, 04 Oct 2026 11:19:52 +0000</pubDate>
      <link>https://dev.to/fondation_alpha0az1omega_/how-i-rediscovered-keplers-third-law-on-a-phone-in-204-lines-2hl0</link>
      <guid>https://dev.to/fondation_alpha0az1omega_/how-i-rediscovered-keplers-third-law-on-a-phone-in-204-lines-2hl0</guid>
      <description>&lt;h1&gt;
  
  
  How I Rediscovered Kepler's Third Law on a Phone, in 204 Lines
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;A minimal symbolic regression engine that runs on Termux, with no GPU and no cloud.&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  The problem with machine learning today
&lt;/h2&gt;

&lt;p&gt;Most ML models are black boxes. You feed them data, they give you predictions, but they never tell you why.&lt;/p&gt;

&lt;p&gt;For some tasks, that's fine. For others — physics, biology, finance — it's a problem. You don't want a prediction. You want a law.&lt;/p&gt;

&lt;p&gt;That's what symbolic regression does. It doesn't fit parameters. It finds the equation itself.&lt;/p&gt;

&lt;p&gt;It's a well-established field. Tools exist:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PySR (Julia backend, state of the art)&lt;/li&gt;
&lt;li&gt;gplearn (Python, sklearn-compatible)&lt;/li&gt;
&lt;li&gt;FastSymbolicGP (2026, mobile preset)&lt;/li&gt;
&lt;li&gt;Eureqa (historical, closed source)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But they all share a common trait: they need a real computer. A GPU helps. A server is often required.&lt;/p&gt;

&lt;p&gt;I wanted to see if the same idea could run on the smallest machine I had: my phone.&lt;/p&gt;




&lt;h2&gt;
  
  
  The constraint
&lt;/h2&gt;

&lt;p&gt;My setup:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Android phone&lt;/li&gt;
&lt;li&gt;Termux (a Linux environment for Android)&lt;/li&gt;
&lt;li&gt;Python 3.13&lt;/li&gt;
&lt;li&gt;NumPy, SymPy&lt;/li&gt;
&lt;li&gt;No GPU. No cloud. No server.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal was simple: build the smallest symbolic regression engine that fits on a phone.&lt;/p&gt;

&lt;p&gt;Not the fastest. Not the most capable. The smallest.&lt;/p&gt;




&lt;h2&gt;
  
  
  What it does
&lt;/h2&gt;

&lt;p&gt;The engine takes numeric data and discovers the underlying formula.&lt;/p&gt;

&lt;p&gt;Two examples that worked:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Target&lt;/th&gt;
&lt;th&gt;Discovered&lt;/th&gt;
&lt;th&gt;MSE&lt;/th&gt;
&lt;th&gt;Time&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;y = x*sin(x)&lt;/td&gt;
&lt;td&gt;y = x*sin(x)&lt;/td&gt;
&lt;td&gt;5.36e-33&lt;/td&gt;
&lt;td&gt;18 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;T = a^(3/2)&lt;/td&gt;
&lt;td&gt;y = a**(3/2)&lt;/td&gt;
&lt;td&gt;4.77e-31&lt;/td&gt;
&lt;td&gt;11 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The second one is the Third Law of Kepler: the square of the orbital period is proportional to the cube of the semi-major axis.&lt;/p&gt;

&lt;p&gt;The engine rediscovered it, from raw numbers, in 11 milliseconds, on an Android phone.&lt;/p&gt;




&lt;h2&gt;
  
  
  How it works
&lt;/h2&gt;

&lt;p&gt;Three steps, in about 200 lines.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Build a library of candidate forms
&lt;/h3&gt;

&lt;p&gt;For each input variable x, the engine generates: x, x^2, x^3, 1/x, 1/x^2, sqrt(x), sin(x), cos(x), exp(-x), log(x).&lt;/p&gt;

&lt;p&gt;Then it generates all pairwise products: (a)*(b).&lt;/p&gt;

&lt;p&gt;Total: around 55 candidate forms.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Sparse selection with OMP
&lt;/h3&gt;

&lt;p&gt;Orthogonal Matching Pursuit picks the smallest subset of columns that best reconstructs the target.&lt;/p&gt;

&lt;p&gt;Implemented in pure NumPy, in about 20 lines. It tries k = 1 through k = 6 and keeps the best MSE.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Symbolic simplification with SymPy
&lt;/h3&gt;

&lt;p&gt;The selected terms are combined into a SymPy expression and simplified.&lt;/p&gt;

&lt;p&gt;That's how a * sqrt(a) becomes a**(3/2).&lt;/p&gt;




&lt;h2&gt;
  
  
  What fails
&lt;/h2&gt;

&lt;p&gt;Two targets didn't work.&lt;/p&gt;

&lt;p&gt;Newton's law of gravitation (F = m1*m2/r^2): MSE 1.6.&lt;/p&gt;

&lt;p&gt;Reason: the library only generates pairwise products. (m1*m2)*(1/r^2) is a triple product, and it isn't there.&lt;/p&gt;

&lt;p&gt;Radioactive decay (N = exp(-t/2)): MSE 6e-6.&lt;/p&gt;

&lt;p&gt;Reason: the library has exp(-t), but not exp(-t/2). Fractional exponents aren't generated.&lt;/p&gt;

&lt;p&gt;Success rate: 2 out of 4 on known targets.&lt;/p&gt;

&lt;p&gt;That's the expected behavior of a minimal engine. Not a bug. A design limit.&lt;/p&gt;




&lt;h2&gt;
  
  
  What this is — and what it isn't
&lt;/h2&gt;

&lt;p&gt;It is: a pedagogical demonstration, a proof of feasibility, 204 lines of readable Python, a tool that fits on a phone.&lt;/p&gt;

&lt;p&gt;It is not: production-ready, faster than PySR, a new scientific discovery, competitive with state-of-the-art tools.&lt;/p&gt;

&lt;p&gt;If you want to solve a hard problem, use PySR. If you want to understand how symbolic regression works, this is a 200-line starting point.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why it matters
&lt;/h2&gt;

&lt;p&gt;Because the barrier to entry should be low.&lt;/p&gt;

&lt;p&gt;You don't need a GPU cluster to study symbolic regression. You don't need a server to discover Kepler's third law.&lt;/p&gt;

&lt;p&gt;You need a phone, an idea, and 200 lines of code.&lt;/p&gt;




&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;pip install numpy sympy rich&lt;br&gt;
python flash.py kepler&lt;/p&gt;

&lt;p&gt;The full source is on GitHub: github.com/alpha0az1omega-sketch/adn-symbolic-regression&lt;/p&gt;

&lt;p&gt;MIT license. Runs offline.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Written by alpha0az1omega. Built on Termux, Android. No GPU. No cloud.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>python</category>
      <category>opensource</category>
      <category>android</category>
    </item>
  </channel>
</rss>
