EDIT
I am currently attempting to try the standard Cartesian State Vectors to Keplerian Orbit Elements conversion but i am having problems getting my head around the formulas and the use of vectors. My premise for doing this is so i get past the simple calculations like velocity, period that i can do quite easily. The resources i have been using are This, This, This and finaly the textbook "Fundamentals of Astrodynamics" By Bate, Mueller, White
I have calculated by hand and then replicated in C# shown below. With some ballpark starting values:
$$ \mathbf{v} = 7770 \ \hat{\mathbf{y}} \ \text{(m/s)}$$
$$ \mathbf{r} = 6771000 \ \hat{\mathbf{x}} \ \text{(m)}$$
$$ \mu = 4.0\text{E+}14 \ \text{(m³/s²)}$$
I have so far manage to successfully use the following formulas:
$$ \mathbf{H} = \mathbf{r} \times \mathbf{v}$$
$$ M = \frac{1}{2} v^2 - \frac{\mu}{r} $$
$$ p = \frac{H^2}{\mu} $$
$$ a = \frac{-\mu}{2M} $$
$$ e = \sqrt{1 - \frac{p}{a}},$$
where $\mathbf{H}$ is the angular momentum vector, $M$ is the total energy (inertial frame), p is the semi-latus rectum, e is eccentricity, and $\mathbf{r}$ and $\mathbf{v}$ (and $r$ and $v$) are the position and velocity vectors (and magnitudes).
However i am having problems trying to follow up with:
$$ \hat n = \hat K \times \mathbf{h} $$ (as seen in PG61 of the Book mentioned above)
And correctly using: $$\vec e = \frac{\vec v \times \vec h}{\mu} \ - \frac{\vec r}{||r||} $$
IN the PDF it is shown as:
$$ \hat n = \mathbf{(0,0,1)^T} \times \mathbf{h} = (-hy,hx,0)^T$$
I am unsure what to plug in or how to use these types of formulas (or i even have the information)
I have included some of my C# code so you can see my line of thinking.progress.
double V = 7770;
double R = 6771000;
double Mu = 4e+14;
Vector velocity = new Vector(0, V);
Vector Radius = new Vector(R, 0);
double H = Vector.CrossProduct(Radius, velocity);// Angular Momentum
double M = (Math.Pow(V, 2) / 2) - (Mu / R);//Mechanical Energy
double p = Math.Pow(H, 2) / Mu;// Semi-Latus Recum
double a = -Mu / (2 * M);//Semi-Major Axis? Comes out only 40km less than
SLR and no where near the correct SMA.
double test = Vector.Multiply(Radius, velocity);//test dot product.
//double e = Math.Sqrt(1 - p / a);//Eccentricty ? No where near correct
vaule.
//double e2 = (Math.Pow(V, 2) - Mu / R) * Radius - test * velocity /
Mu);//Eccentricty ?
I have been fiddling with the code and reading material for around two months and i have gotten some progress but my lack of experience with calculating Vectors is letting me down. Help with examples i can reverse engineer or get a better understanding of what i need to do to get going.