Confused on how you are supposed to calculate eccentricity without apsides

I'm kinda confused on how to calculate either the apsides or the eccentricity without knowing one or the other. Let's say you have an object in orbit around another. If you know the current distance, mass of both objects, and the velocity (as a vector), would you be able to calculate the eccentricity of the orbit, like through the vis-viva equation?

Edit: I used Symbolab with the vis-viva equation to solve for a, would this work?

https://www.symbolab.com/solver/step-by-step/solve%20for%20a%2C%20v%3D%5Csqrt%7Bu%5Cleft(%5Cfrac%7B2%7D%7Br%7D-%5Cfrac%7B1%7D%7Ba%7D%5Cright)%7D?or=input

• It is possible to find the eccentricity given the velocity and position vectors. Try searching google for "cartesian to kepler" Sep 20 at 12:45

The vis-viva equation doesn't care about eccentricity, so no, you can't get it from just the semimajor axis.

However, given the radial distance and the velocity vector, and the gravitational parameter, this is how I would go about calculating orbital eccentricity:

Orbital Elements

Givens:

Parameter Symbol
gravitational parameter $$\mu$$
radial distance vector $$\vec{r}$$
velocity vector $$\vec{v}$$

1. Calculate the specific orbital energy, $$\epsilon$$

Specific orbital energy is the sum of the kinetic and gravitational potential energy of the orbiting satellite, divided by its mass. Since Energy is conserved in keplerian orbits, it is one of the two parameters that determines the type of the orbit. If it is less than zero, the orbit is elliptical. If it is greater than zero, the trajectory is hyperbolic. If it is equal to zero, it is parabolic.

$$\epsilon =\frac{|\vec{v}|^2}{2} -\frac{\mu}{|\vec{r}|}$$

2. Calculate the semi-major axis, $$a$$

The semimajor axis can now be calculated once you have the specific orbital energy, and characterizes the distance of the extremes of the orbit; For an elliptical orbit, the semi-major axis is half the distance between the periapsis and the apoapsis, and for a hyperbolic trajectory, it is half the minimum distance between the two lobes.

$$a = -\frac{\mu}{2 \epsilon}$$

3. Calculate specific angular momentum, $$\vec{h}$$:

The specific angular momentum vector has units of the angular momentum of the satellite, divided by the mass of the satellite. Like orbital energy, angular momentum is conserved in keplerian orbits, and specific angular momentum is the other major parameter useful in finding the orbit's shape, as well as determining the orbit's orientation, and the satellite's direction of travel.

The specific angular momentum vector points perpendicular to the orbital plane. If it points above the reference plane, the orbit is a prograde orbit, and if it points below the reference plane, it is a retrograde orbit.

As a result, the specific angular momentum vector can be used to find other orbital parameters, including the longitude of the ascending node and the orbital inclination.

$$\vec{h} = \vec{r} \times \vec{v}$$

4. Calculate the eccentricity vector, $$\vec{e}$$:

The magnitude of the eccentricity vector is the orbital eccentricity, and its direction points towards the periapsis, making it useful in calculating argument of periapsis.

$$\vec{e}=\frac{\vec{v} \times \vec{h}}{\mu}-\frac{\vec{r}}{|r|}$$

$$e = |\vec{e}|$$ And with the magnitude of the eccentricity vector, you now can calculate periapsis ($$q$$) and apoapsis distances ($$Q$$). $$q = a(1-e)$$ $$Q = a(1 +e)$$