C, C++, MFC  

Simulating Mercury Orbit Using NKTg Law in C#

I wanted to share a simple physics-based simulation I’ve been working on in C#, inspired by what I call the NKTg Law — a constant position–momentum parameter model.

Rather than using traditional force-based physics, this model reconstructs velocity directly from position and a constant motion parameter:

p = m * v
C = x * p

From:

C = x * (m * v)

We derive:

v = C / (x * m)

Where:

  • x is orbital distance (meters)

  • v is orbital velocity (m/s)

  • m is mass (kg)

  • p is momentum

  • C is a constant parameter

This gives us a very simple way to compute velocity from position and mass.

Validation Dataset

The model was tested with Mercury orbit positions for 2025 and compared against known reference velocity data.

Positions (meters):

5.16e10, 6.97e10, 5.49e10, 6.83e10, 4.61e10

Reference velocities (m/s):

53400, 38900, 50400, 39800, 58900

Constants used:

C = 8.90e38
m = 3.301e23

The relative error between model and reference is around 1–3%.

C# Implementation

Here’s a simple console application that performs this simulation:

using System;

namespace MercuryOrbitSimulation
{
    public class MercuryData
    {
        public string Date { get; set; }
        public double X { get; set; }
        public double VRef { get; set; }
    }

    class Program
    {
        static double ComputeVelocity(double C, double x, double m)
        {
            return C / (x * m);
        }

        static double ComputeRelativeError(double vModel, double vRef)
        {
            return (vModel - vRef) / vRef * 100.0;
        }

        static void Main(string[] args)
        {
            double C = 8.90e38;
            double mass = 3.301e23;

            var dataSet = new[]
            {
                new MercuryData { Date = "1/1/2025", X = 5.16e10, VRef = 53400 },
                new MercuryData { Date = "4/1/2025", X = 6.97e10, VRef = 38900 },
                new MercuryData { Date = "7/1/2025", X = 5.49e10, VRef = 50400 },
                new MercuryData { Date = "10/1/2025", X = 6.83e10, VRef = 39800 },
                new MercuryData { Date = "12/31/2025", X = 4.61e10, VRef = 58900 },
            };

            Console.WriteLine("Mercury Orbit Simulation Using NKTg Law\n");

            foreach (var data in dataSet)
            {
                double vModel = ComputeVelocity(C, data.X, mass);
                double relError = ComputeRelativeError(vModel, data.VRef);

                Console.WriteLine($"Date: {data.Date}");
                Console.WriteLine($"Position (x): {data.X:e}");
                Console.WriteLine($"Model Velocity: {vModel:e} m/s");
                Console.WriteLine($"Reference Velocity: {data.VRef:e} m/s");
                Console.WriteLine($"Relative Error: {relError:f2}%\n");
            }

            Console.WriteLine("Simulation complete.");
        }
    }
}

Next Steps & Discussion

This simple model is a starting point. Here are some areas I’d like feedback on:

  • Numerical precision

    — Handling large values (1e38) in double precision

    — Normalization strategies

  • Model design

    — Separating physics logic into a library

    — Extending to multi-body simulations

  • Visualization

    — Rendering orbits with WPF, WinUI, or Unity

If you have suggestions for improving the simulation or extending it with graphics or concurrency, please share!