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
I’ve seen more and more people get into Rust recently, so thought it would be cool to have a thread for people to share what they like ab...
New
New
AstonJ
Currently a hot topic in the BEAM world, let’s start a thread for it (as suggested by @crowdhailer here) :smiley: What are your current...
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
First poster: bot
AbstractMachinesLab/caramel. :candy: An Erlang backend to the OCaml compiler. Contribute to AbstractMachinesLab/caramel development by c...
New
First poster: bot
The Complete AWS Lambda Handbook for Beginners (Part 1). In the first part of our Complete AWS Lambda Handbook for Beginners, we explain...
New
AstonJ
Inspired by this post by @stefan.jarina, I’m curious about the kind of Bash scripts you’ve written and whether you still use Bash given t...
New
New
lucasvegi
Hello guys! Perhaps some of you have already seen this invitation on other channels in the Elixir community or even responded to our surv...
New
lucasvegi
Hello guys! Perhaps some of you have already seen this invitation on other channels in the Elixir community or even responded to our sur...
New

Other popular topics Top

axelson
I’ve been really enjoying obsidian.md: It is very snappy (even though it is based on Electron). I love that it is all local by defaul...
New
Exadra37
Please tell us what is your preferred monitor setup for programming(not gaming) and why you have chosen it. Does your monitor have eye p...
New
dasdom
No chair. I have a standing desk. This post was split into a dedicated thread from our thread about chairs :slight_smile:
New
PragmaticBookshelf
Design and develop sophisticated 2D games that are as much fun to make as they are to play. From particle effects and pathfinding to soci...
New
AstonJ
We have a thread about the keyboards we have, but what about nice keyboards we come across that we want? If you have seen any that look n...
New
dimitarvp
Small essay with thoughts on macOS vs. Linux: I know @Exadra37 is just waiting around the corner to scream at me “I TOLD YOU SO!!!” but I...
New
PragmaticBookshelf
Create efficient, elegant software tests in pytest, Python's most powerful testing framework. Brian Okken @brianokken Edited by Kat...
New
New
RobertRichards
Hair Salon Games for Girls Fun Girls Hair Saloon game is mainly developed for kids. This game allows users to select virtual avatars to ...
New
Fl4m3Ph03n1x
Background Lately I am in a quest to find a good quality TTS ai generation tool to run locally in order to create audio for some videos I...
New