Question: What formula returns speed of a planet, e.g. Earth orbiting Sun, on its ellipse like trajectory orbiting Sun? Input variables have to be $a,b$ (ellipse) and some more, because the speed of the planet movement is not constant, as I have read.

Answer: 
You can calculate the speed $v$ of a planet at any time
using the so-called [vis-viva equation](https://en.wikipedia.org/wiki/Vis-viva_equation)

$$v=\sqrt{GM\left(\frac{2}{r}-\frac{1}{a}\right)}$$
where

* $G$ is Newton's gravitational constant,
* $M$ is the mass of the sun,
* $r$ is the planet's distance from the sun at this time,
* $a$ is the semi-major axis of the ellipse.

The linked article also describes how this equation can be derived
from the constant total energy of the planet
and the elliptic shape of its orbit.
We can use the concept of **Orbital Velocity**, it is a concept of satellites revolving around planets. Here, in your case, we can use it for planet to sun revolutions.
[Also check this out for a better visualization](https://planetfacts.org/orbital-speed-of-planets-in-order/)
**ORBITAL VELOCITY:**
orbital velocity, velocity sufficient to cause a natural or artificial satellite to remain in orbit. The inertia of the moving body tends to make it move on in a straight line, while gravitational force tends to pull it down. The orbital path, elliptical or circular, thus represents a balance between gravity and inertia.

$$\text{orbital velocity} = \frac{2\pi R}{T} \text{ (if considered as circle)}$$

As per your convention let us take it as an ellipse and the formula goes like

$$\text{orbital velocity} = \frac{\pi (a + b)}{T} \text{ (FOR ELLIPSE)}$$

These formulas give approx values, to get the perfect answers, you can approach like this,
The area under the distance-time graph gives "non-uniform velocity". As you consider the speed is not constant

So now you can integrate the Ellipse formed in the distance-time graph,

**DERIVATION:**
Let the ellipse be $\frac{x^2}{a^2}+\frac{y^2}{b^2}=1$.

$$\Rightarrow
 y=b\sqrt{1-\frac{x^2}{a^2}}
 =\frac{b}{a}\sqrt{a^2-x^2}.$$

By symmetry, it is clear that the area of the ellipse having its center at the origin is equally distributed among the four quadrants.

$$\Rightarrow
A=4\int\_0^a y\ dx
 =4\int\_0^a \frac{b}{a} \sqrt{a^2-x^2}\ dx
 =\frac{4b}{a}\int\_0^a \sqrt{a^2-x^2}\ dx.$$

Let $x=a\sin\theta \Rightarrow dx=a\cos\theta\ d\theta$.

Then, when $x=0,\theta=0$ and when $x=a,\theta=\pi/2$.

$$\Rightarrow
A=\frac{4b}{a} \int\_0^{\pi/2} \sqrt{a^2-a^2\sin^2\theta}\ a\cos\theta\ d\theta
 =4ab \int\_0^{\pi/2} \cos^2\theta\ d\theta \\
 =4ab \int\_0^{\pi/2} \frac{1+\cos 2\theta}{2}d\theta
 =2ab \left[\theta+\frac{\sin 2\theta}{2}\right]\_0^{\pi/2}
 =2ab(\pi/2)$$

$$\Rightarrow A=\pi ab$$
You can use the middle product terms as your formula.

**EXPERIMENTAL VALUES:**
Mercury 47.9 km/s
Venus 35.0 km/s
Earth 29.8 km/s
Mars 24.1 km/s
THANK YOU...