Can AI Discover the Laws of Physics? SINDy vs PINNs Explained for Data Scientists
Can AI Discover the Laws of Physics? SINDy vs PINNs Explained for Data Scientists 🧪

What if I told you there’s an algorithm that can watch a pendulum swing… and write down Newton’s equations by itself?
No, seriously.
Feed it some data. It hands you back the actual mathematical equation governing the system. Not a prediction. Not a probability. The equation. 🤯
Welcome back, Data Chefs! 👩🍳👨🍳
Today we’re stepping out of the traditional data mining kitchen and into the world of Scientific Machine Learning — where AI doesn’t just learn patterns, it discovers the rules of nature.
We’ll break down two powerful methods: SINDy and PINNs. By the end, you’ll understand both without needing a physics PhD. Promise.
Let’s get cooking. 🍳
TL;DR ⚡
SINDy watches data and discovers the equation behind it. → “I watched the cars move and figured out the traffic rules.”
PINNs already know the equation and use a neural network to solve it. → “I already know the traffic rules, so I forced the car to follow them.”
Both are incredible. Both have trade-offs. And most data scientists haven’t heard of either.

Wait… Why Should I Care? 🤔
Let’s talk straight.
Traditional ML learns patterns. It predicts. But ask it why something happens? It shrugs. 🤷 Black box.
Scientific Machine Learning asks a different question: “What is the actual rule governing this system?”
That matters when a doctor needs to trust a diagnosis 🏥, when a wrong prediction crashes a spacecraft 🚀, or when you need the mechanism behind climate change, not just next week’s forecast 🌍.
This is where SINDy and PINNs enter the kitchen.
SINDy: The Equation Detective 🔍
Sparse Identification of Nonlinear Dynamics
Let me paint a picture.
You’re sitting at a busy intersection, watching cars go by. Nobody told you the traffic rules. But you’re observing. 👀
After watching long enough, you notice: cars stop at the red light, go on green, slow down at yellow.
You just discovered the traffic rules from observation alone.
That’s SINDy. That’s literally it.
Introduced by Steven Brunton and colleagues in a 2016 paper published in the Proceedings of the National Academy of Sciences, the core idea is beautifully simple:
🧠 Nature tends to follow simple rules. SINDy finds those few simple rules from data.


How It Works (The Cooking Version 👨🍳)
Step 1: Watch the change 👀 Track how things change over time. You’re watching a moving object. At time 1, 2, 3 seconds, the position is 10, 15, 23. The rate of change? That’s +5, +8, +12.
Step 2: Lay out every possible ingredient 🧂 Write down every simple math term that could explain the change: constants, x, x², x³, sin(x)… This is the candidate library. Think of it as putting every ingredient on the counter.
Step 3: Organize it into a table 📋 Each column is a candidate term, each row is a time step. Nice and neat.
Step 4: Find the recipe 🍲 Can we explain the change by combining just a few of these columns? Maybe: change = value + 0.5 × value². Most other terms? Their contribution is zero.
Step 5: Toss what you don’t need 🗑️ This is the “sparse” part. Cross out everything that doesn’t matter. What remains is your discovered equation.
Just like that, SINDy reverse-engineered the governing equation from nothing but data. No physics textbook required.
Why It’s Exciting 🔥
✅ Interpretable — You get an actual equation you can write on a napkin. Not a neural network with millions of weights.
✅ Fast — No neural network to train. SINDy is essentially a smart regression, making it orders of magnitude faster than deep learning approaches for the same task.
✅ Discovered what humans couldn’t — SINDy has been used to discover equations for **plasma fluid dynamics** that scientists hadn’t been able to formulate analytically. The algorithm found what we couldn’t. Let that sink in.
The Catch ⚠️
SINDy needs clean, well-sampled data. Noisy measurements? Big gaps? SINDy struggles. It computes derivatives from data, and noisy derivatives are… a mess.
Think of it like trying to read traffic rules through a foggy window. 🌫️ The cars are blurry. Was that a red light or orange? The observations need to be crisp for SINDy to do its thing.
I’ll be real with you: I’ve worked on problems with 50 to 100 data points where SINDy would’ve saved me months of manually deriving equations. If you’ve ever stared at a small dataset wondering “what’s the rule here?” this tool was built for you.
PINNs: The Physics-Obeying Neural Network 🧠
Physics-Informed Neural Networks
Now flip the scenario.
This time, you already know the traffic rules. Red means stop, green means go. But you want to predict: if a car starts at point A at 3 PM, where will it be at 3:15 PM?
You know the rules. You just need to trace the path. 🛣️
That’s PINNs.
Introduced by Raissi, Perdikaris, and Karniadakis in a 2019 paper, the idea is elegant:
🧠 Take a regular neural network. But during training, punish it every time it breaks the laws of physics.

How It Works (The Cooking Version 👨🍳)
Step 1: Define the dish 🎯 What are you trying to learn? The solution curve. Maybe height vs. time for a falling object. Or temperature vs. position in a metal rod.
Step 2: Neural network = flexible curve drawer ✏️ Input: time. Output: position. The network is essentially drawing a curve through your data.
Step 3: Teach it the physics rules 📏 Here’s the magic. During training, the network doesn’t only fit the data. It also checks: “Does my curve obey the known physics?” If physics says gravity is 9.8 m/s² and the network’s curve implies 15 m/s²… penalty! 🚨
Step 4: The double-check ✅✅ The loss function has TWO jobs: (1) Does the curve pass near the measured data? (2) Does the curve obey the physics? Fail either? Penalty.
Step 5: Keep adjusting 🔄 The network tweaks its weights to minimize both penalties. The result: a solution that fits data AND respects physics. Beautiful.
Why It’s Exciting 🔥
✅ Works with messy data — Sparse, noisy, incomplete? No problem. Physics acts like a guardrail, filling in the gaps.
✅ Mesh-free — Traditional methods like Finite Element Analysis require dividing your domain into tiny pieces (a “mesh”). For complex 3D shapes, this takes weeks. PINNs skip that entirely.
✅ Wild range of applications — Modeling cardiac blood flow 🫀, optimizing spacecraft trajectories 🛰️, even pricing financial options on Wall Street 💰. From quantum mechanics to oil wells.
The Catch ⚠️
You must already know the governing equation. PINNs don’t discover physics — they use physics you give them. No equation? No PINNs.
They’re also slow 🐢. Training a neural network is computationally expensive. And while the output is physically meaningful, the network’s internal reasoning is still opaque. You get a solution, not an equation.
The Showdown: SINDy vs PINNs ⚔️

Your Decision Framework 🧭
Two questions:
“Do I know the physics?” → Yes? PINNs. → No? SINDy.
“Is my data clean?” → Yes? SINDy will shine. → Noisy or sparse? PINNs are more robust.
Pro tip 💡: You can use both together. Use SINDy to discover the equation, then feed it into a PINN to solve it under new conditions. Best of both worlds.
Wait… Where Does This Fit in the Bigger Picture? 🧩
If you’ve read my previous article — **Model Recovery vs Model Learning: The Great Divide in Data Science** — you already know the framework.
Quick refresher for those who haven’t (go read it, I promise it’s worth it 😉):
Model Recovery 🔬 = “Open the music box. Understand the mechanism. Find the equation.” Model Learning 📊 = “Keep it closed. Let the data teach the model. Optimize the output.”
Now here’s where it gets interesting:
- SINDy is Model Recovery in action. It literally opens the box and hands you the equation.
- Traditional deep learning is Model Learning. Powerful, but blind to the “why.”
- PINNs? They’re the hybrid I teased at the end of that article. Neural network flexibility (Learning) constrained by known physics (Recovery). Best of both worlds.
This article is the sequel. If Model Recovery vs Model Learning was the philosophy, SINDy and PINNs are the tools that bring it to life.
See It in Action: 5 Lines That Discover Physics 🐍
This is the part that blew my mind. Using the PySINDy library, you can discover the equations of a dynamical system in just a few lines:
import numpy as np
import pysindy as ps
# Some data from an unknown system
t = np.linspace(0, 1, 100)
x = 3 * np.exp(-2 * t)
y = 0.5 * np.exp(t)
X = np.stack((x, y), axis=-1)
# Let SINDy figure it out
model = ps.SINDy()
model.fit(X, t=t, feature_names=["x", "y"])
model.print()
Output:
x' = -2.000 x
y' = 1.000 y
🎤 drops mic
SINDy discovered the exact governing equations. No labels. No supervision. No prior knowledge. Data in, equations out.
Take a moment to appreciate how wild that is.

Where This Is All Heading 🚀
Scientific Machine Learning is a bridge between two worlds that have been talking past each other for decades: the physics world that cares about understanding and the ML world that cares about performance.
SINDy and PINNs prove you don’t have to choose. You can have models that are both powerful and interpretable. Models that don’t just predict. They explain.
For data scientists, this is a superpower hiding in plain sight. While everyone is chasing the latest LLM or prompt engineering trick, these tools are quietly solving problems that black-box models simply can’t touch.
Next time someone tells you “AI is just pattern matching,” tell them about SINDy. Tell them there’s an algorithm that watches a pendulum swing and hands you back Newton’s equations.
No training labels. No million-parameter network. Just data in, physics out.
That’s not pattern matching.
That’s discovery. 🔬
Key References 📚
- Brunton, S. L., Proctor, J. L., & Kutz, J. N. (2016). *Discovering governing equations from data by sparse identification of nonlinear dynamical systems.* Proceedings of the National Academy of Sciences, 113(15), 3932–3937.
- Raissi, M., Perdikaris, P., & Karniadakis, G. E. (2019). *Physics-informed neural networks: A deep learning framework for solving forward and inverse problems.* Journal of Computational Physics, 378, 686–707.
- Kaptanoglu, A. A., et al. (2021). *PySINDy: A comprehensive Python package for robust sparse system identification.* arXiv preprint arXiv:2111.08481.
- Chen, Z., Liu, Y., & Sun, H. (2021). *Physics-informed learning of governing equations from scarce data.* Nature Communications, 12, 6136.
If this was useful, give it a clap 👏 and share it with someone who thinks AI is only chatbots and image generators.
I write about data science, AI, and the stuff that actually matters. No hype. Just real talk.
📍 Connect with me on LinkedIn: Farhat Shaikh 📍 Instagram: @datalicious_life
Until next time — keep cooking! 🍳
#ScientificMachineLearning #SINDy #PINNs #DataScience #PhysicsInformedAI #MachineLearning #PySINDy #AI #ModelRecovery
메타데이터
- post_id
- 33ecb8b589b7
- slug
- can-ai-discover-the-laws-of-physics-sindy-vs-pinns-explained-for-data-scientists-33ecb8b589b7
- url
- https://medium.com/@farhat.shaikh/can-ai-discover-the-laws-of-physics-sindy-vs-pinns-explained-for-data-scientists-33ecb8b589b7
- canonical_url
- https://medium.com/@farhat.shaikh/can-ai-discover-the-laws-of-physics-sindy-vs-pinns-explained-for-data-scientists-33ecb8b589b7
- author_url
- https://medium.com/@farhat.shaikh
- status
- ok
- fetched_at
- 2026-06-09 15:37:30