تم الحل ✓
categoryبرمجة وتطوير البرمجيات
schoolبكالوريوس
event_available2026-07-14
السؤال
Transcribed Image Text:
3. Submit on zyLabs] Write a function called orbit 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/aa9/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).
b
a
Image from http
Your function should take information about your planet's 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 planet's 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, circ Year.
Using Ramanujan's approximation, ramYear.
[circTime, ramTime]
This means that when you call your function, it should have the form:
orbit (major, minor, velo);
The circular approximation is:
a²+b²
perimeter 2
Ramanujan's approximation is:
perimeter
[3(a+b)=√(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
Earth Data
a (km)
149600000
b (km)
v (km/s)
149580000
29.78
You should find:
Output
T1
T2
Standard Soln.
3.652952252479330e+02
3.652952248398216e+02
Note that earth's orbit is indeed very close to a circle!
check_circle الجواب — حل مفصل خطوة بخطوة
hourglass_top
🔒
الحل الكامل متاح للمشتركين
اشترك في أرشيف الأسئلة لعرض هذا الحل وآلاف الحلول المفصلة خطوة بخطوة من معلمين معتمدين.