NKTgLaw

NKTgLaw

Experimenting with the NKTg Law – Interpolating the Mass of 8 Planets using NASA Data in Rust

Hi everyone :waving_hand:,

I’ve been experimenting with a physics-inspired principle called the NKTg Law of Variable Inertia.
It connects position (x), velocity (v), and mass (m) via a conserved quantity:

NKTg1 = x * (m * v)

From this, the mass can be interpolated:

m = NKTg1 / (x * v)

Why interesting?

Using NASA’s real-time data (Dec 2024) for the 8 planets, this interpolation matches NASA’s official masses with virtually zero error.
Here’s a quick implementation in Rust.


Rust Implementation

fn main() {
    let planets = vec![
        ("Mercury", 6.9817930e7, 38.86, 3.301e23),
        ("Venus",   1.08939e8,  35.02, 4.867e24),
        ("Earth",   1.471e8,    29.29, 5.972e24),
        ("Mars",    2.4923e8,   24.07, 6.417e23),
        ("Jupiter", 8.1662e8,   13.06, 1.898e27),
        ("Saturn",  1.50653e9,  9.69,  5.683e26),
        ("Uranus",  3.00139e9,  6.8,   8.681e25),
        ("Neptune", 4.5589e9,   5.43,  1.024e26),
    ];

    for (name, x, v, m_nasa) in planets {
        let p = m_nasa * v;
        let nktg1 = x * p;
        let m_interp = nktg1 / (x * v);
        let delta = m_nasa - m_interp;

        println!(
            "{}:\n  NASA mass        = {:.3e}\n  Interpolated mass= {:.3e}\n  Δm               = {:.2e}\n",
            name, m_nasa, m_interp, delta
        );
    }
}


Sample Output

Mercury:
  NASA mass        = 3.301e23
  Interpolated mass= 3.301e23
  Δm               = 0.00e+00

Earth:
  NASA mass        = 5.972e24
  Interpolated mass= 5.972e24
  Δm               = 0.00e+00
...


Observations

  • All 8 planets match NASA’s published values with negligible error (<0.0001%).

  • Suggests NKTg1 acts as a conserved quantity in orbital mechanics.

  • Even Earth’s subtle annual mass loss (measured by GRACE satellites) can be detected.


Why share this here?

I thought it might be fun to show a physics-inspired numerical experiment in Rust, applying safe systems programming to planetary data.

Curious what you all think:

  • How would you approach this kind of model more idiomatically in Rust?

  • Would you use crates like ndarray or nalgebra instead of plain f64s?

  • Anyone interested in extending this into a visualization project?

Nguyen Khanh Tung

Where Next?

Popular Backend topics Top

AstonJ
Or which features of current frameworks you use you feel you couldn’t live without?
New
wolf4earth
Serverless has been quite a prevalent topic in our industry in the past few years, and while there are a lot of sceptics, I think it’s sa...
New
bot
A new item has been posted: https://crates.io/crates/rsfbclient This thread was posted automatically, if you feel it could be in a bett...
New
AstonJ
Consider this Erlang code: Rectangle = {rectangle, 20, 10}. {rectangle, Width, Height} = Rectangle. &gt; Width. 20 &gt; Height. 10 When...
New
finner
During a recent code review I came across this scenario: Code in review if (input.getValue() != null) { return Arrays.asList(value);...
New
mafinar
I’ll be participating. This would be very interesting because I have been having coders block + a lot of distraction this weekend. But l...
New
almokhtar
Howdy, folks i have this question about it is ok to learn two different programming languages same time, well my story is i joined a comp...
New
mafinar
We always have fun in this forum around this time of the year, discussing the days’ (or yesterdays’) challenges and talking through solut...
New
jaeyson
Hey! Just a random thought though: Found an article from fudzilla where AI can be a good debugger. How does one integrate something like ...
New
New

Other popular topics Top

Devtalk
Hello Devtalk World! Please let us know a little about who you are and where you’re from :nerd_face:
New
Rainer
My first contact with Erlang was about 2 years ago when I used RabbitMQ, which is written in Erlang, for my job. This made me curious and...
New
AstonJ
Thanks to @foxtrottwist’s and @Tomas’s posts in this thread: Poll: Which code editor do you use? I bought Onivim! :nerd_face: https://on...
New
AstonJ
We’ve talked about his book briefly here but it is quickly becoming obsolete - so he’s decided to create a series of 7 podcasts, the firs...
New
PragmaticBookshelf
Author Spotlight Mike Riley @mriley This month, we turn the spotlight on Mike Riley, author of Portable Python Projects. Mike’s book ...
New
New
husaindevelop
Inside our android webview app, we are trying to paste the copied content from another app eg (notes) using navigator.clipboard.readtext ...
New
New
PragmaticBookshelf
Explore the power of Ash Framework by modeling and building the domain for a real-world web application. Rebecca Le @sevenseacat and ...
New
AstonJ
Curious what kind of results others are getting, I think actually prefer the 7B model to the 32B model, not only is it faster but the qua...
New