Question: Write a function that takes three inputs and returns two outputs. Our function is related to a planet that is in orbit around a star.

Write a function that takes three inputs and returns two outputs. Our function is related to a planet that is in orbit around a star. Remember that planets have elliptical orbits, like this:

Image from https://upload.wikimedia.org/wikipedia/commons/a/a9/Picture_of_an_elliptical_orbit.jpg

An ellipse has two measurements that we can use define it. Those are the major axis radius (a in the picture) and the minor axis radius (b in the picture below).

Image from https://upload.wikimedia.org/wikipedia/commons/thumb/a/a1/Ellipse_semi-major_and_minor_axes.svg/1200px-Ellipse_semi-major_and_minor_axes.svg.png

Your function should take information about your planets orbit and tell us how long that orbit will take. Your three inputs should be:

The major axis radius, major.

The minor axis radius, minor.

The planets orbital velocity, velo, in meters per second.

Your outputs should be the length of one year on that planet, in days, using two approximations for the perimeter of an ellipse:

A circular approximation, circYear.

Using Ramanujans approximation, ramYear.

The circular approximation is:

parimeter = 2pi*sqrt((a2 + b2)/2)

Ramanujans approximation is:

parimeter = pi [3(a+b) - sqrt((3a + b)(a + 3b))]

Note that those equations give you perimeters. To calculate the time it takes to travel that distance, you have to divide a perimeter by a velocity. Then remember to convert the time to the correct units (days).

To test your code, use these inputs:

Input

a (km)

b (km)

v (km/s)

Earth Data

149600000

149580000

29.87

You should find:

Output

T1

T2

Standard Soln.

3.651726018087763e+02

3.651726014008019e+02

Note that earths orbit is indeed very close to a circle!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!