How to determine the eccentricity, knowing the orbital speed and distance How to determine the orbital eccentricity of a planet, knowing the instantaneous orbital speed of it and the distance from the Sun to the planet at that moment?
How to determine the orbital eccentricity of a planet, knowing the instantaneous orbital speed of it and the distance from the Sun to the planet at that moment?


We are given three things:


$v$ "instantaneous orbital speed" (a scalar)
$r$ "distance from the Sun to the planet at that moment" (a scalar)
$GM$ since the OP specifies "the Sun"


Let's see how far we can get with the vis-viva equation and look at the problem purely from an energy standpoint.

$$v^2 = GM(2/r-1/a)$$

becomes

$$a = 1/(2/r-v^2/GM).$$

Let's look at a numerical example. Say $r = 1AU \approx 1.5 \times 10^{11}$ meters, and $v = 25,000$ m/s. 

We know then that the semimajor axis of the orbit must be 0.773 AU. If the orbit reaches 1AU, the velocity will be 25,000 m/s. If it reaches 1.1 AU (which it might or might not, depending on eccentricity) it's velocity will be 21,500 m/s.

We're almost there but not quite. We need one more piece of information.

The periapsis and apoapsis $r_p$ and $r_a$ are related to the semimajor axis and eccentricity by 

$$r_p = (1-e)a$$ 
$$r_a = (1+e)a$$

So for example if you had mentioned that the apoapsis was 1.1 AU, then we could calculate eccentricity from

$$e = r_a/a -1$$

and get $e = 0.4228$ AU and a periapsis $r_p = 0.387$ AU.