# How to find/extract the semi-major axis from a TLE with Skyfield?

I have a TLE:

1 33591U 09005A 21024.46740879 .00000049 00000-0 52095-4 0 9997
2 33591 99.1927 41.5349 0014084 172.6670 187.4709 14.12449679616592


And I would like to extract the semi-major axis using Skyfield. I also tried manually calculating it, looking at this answer: How to get semi-major axis from TLE?, but seems like I am missing something in my calculations (calculations below).

$$\mu = 398600 \ \ km^3/s^2$$

$$mm = 14.12449679 \ \ day^{-1}$$

$$n = mm \frac{2 \pi}{86400 \ \ sec}$$

$$a = \frac{\mu^{1/3}}{(2 \pi n / 86400)^{2/3}}$$

and in Python (for example):

import math
mu = 398600;
mm = 14.12449679;
n = mm * ((2 * math.pi) / 86400);
a = mu**(1/3) /(2*n*pi/86400)**(2/3);


which yields:

a = 4.1493e+06

• I've added MathJax formatted equations to complement your metacode, and then since it was so close to Python (a very popular programming language) I converted x^y to x**y and called it Python. I also added units to your numbers, and that might suggest to you how to answer your own question. It's always okay to post a good answer to your own question if you have an "Aha!" moment. :-)
– uhoh
Jan 31, 2021 at 23:40
• I haven't checked your working but it makes sense to use the same value of mu as that used in the linked answer, i,e, in m^3/s^-2 Jan 31, 2021 at 23:42
• @uhoh Ha! Actually, I forgot to mention, but that wasn't Python but GNU Octave. Doesn't matter tho, thanks for the edit! :) Jan 31, 2021 at 23:49
• @lawndownunder have you tried harmonizing your units? Best way (in my opinion) is to use MKS or meters, kilograms and seconds. I think you can answer this yourself if you do that.
– uhoh
Feb 2, 2021 at 7:18
• I think you can answer your own question and post it if you just repeat the calculation using consistent units. It's always okay to post an answer to your own question once you've solved your problem.
– uhoh
Feb 7, 2021 at 2:43

Your formulas, constants, and code have mistakes.

Here is the correct code (in Python), using the example n = 15.5918272 from the page you linked to above (How to get semi-major axis from TLE?)

import math
mu = 3.986004418E14
n = 15.5918272
a = mu**(1/3) / (2*n*math.pi/86400)**(2/3) # meters
print(a/1000.0) # kilometers


I get:

6768.158167689445