Enable contrast version

Tutor profile: George D.

Inactive
George D.
University Teaching Assistant (TA) for Three Years
Tutor Satisfaction Guarantee

Questions

Subject: Python Programming

TutorMe
Question:

First, define some class representing relatives in a family tree, with attributes for each person’s name (string), age (integer), and parents (collection of relative classes). Then, write a function that finds the youngest relative of some person p with name n, assuming age only ever increases as you go to a new generation. Some skeleton code has been provided for specificity: class Relative(): """ Defines an instance of the relative class, with attributes for the name age, and parents of a relative. Attributes: name: string of the name of the relative age: int of the age of the relative to the nearest year parents: either None or list of Relative objects of length at most 2 """ pass def find_closest_relative(p, name): """ Function that returns the closest relative of object p with the name n or None of no such relative exists. Parameters: p: instance of Relative class n: string containing name of relative """ pass

Inactive
George D.
Answer:

class Relative(): """ Defines an instance of the relative class, with attributes for the name age, and parents of a relative. Attributes: name: string of the name of the relative age: int of the age of the relative to the nearest year parents: either None or list of Relative objects of length at most 2 """ def __init__(self, name, age, parents): self.name = name self.age = age self.parents = parents def find_closest_relative(p, name): """ Function that returns the closest relative of object p with the name n or None of no such relative exists. Parameters: p: instance of Relative class n: string containing name of relative """ ancestors = [] if p.parents is None: return None for parent in p.parents: if parent.name == name: ancestors.append(parent) if len(ancestors) == 2: return ancestors[0] if ancestors[0].age <= ancestors[1].age else ancestors[1] elif len(ancestors) == 1: return ancestors[0] else: a1 = find_closest_relative(p.parents[0], name) a2 = find_closest_relative(p.parents[1], name) if (a1 is None) and (a2 is None): return None elif a1 is None: return a2 elif a2 is None: return a1 else: return a1 if a1.age <= a2.age else a2 While the exercise of writing classes is an important one, the key lesson here is that one of the most natural approaches to solving a problem involving searching a tree-like data structure (in this case a family tree) is recursion. By recursing through the parents of relative objects, we handle the uncertainty of how many generations there could be and limit how many generations we need to check before converging to our answer for each tree. Before tackling any coding challenge, it is always important to start by asking yourself what tool is right for this job before beginning to write your solution.

Subject: Calculus

TutorMe
Question:

At a carnival, you notice a vendor is selling soda inside a trumpet shaped cup instead of the usual bottle. You walk up to order and the vendor offers you two sizes: one that is 1 ft. tall and the other is 1.5 ft. tall for only 25 cents more. Looking at the trumpet, you notice something seems wrong: The side of the shorter bottle can be parametrized by the function f(x)=1/x, starting from y = 1 ft. to y = 2 ft. rotated around the y axis, while the side of the taller bottle is parametrized by the curve g(x)=1/sqrt(x) from y = 1 ft. to y = 3 ft. In an attempt to prove he is innocent, he shows you the radius of the top of each bottle is exactly the same, so the taller cone must hold more soda. Calculate the volume of each cone, and either defend his innocence or prove his guilt.

Inactive
George D.
Answer:

In order to calculate the volume of the cone, we must find an equation relating the volume of the bottle to the curve that defines it's shape. Since we know our trumpet was made by rotating the curve around the y-axis, the cross-sectional area of the trumpet for any fixed y value will always look like with a radius equivalent to the x value of the curve at that y-value. In other words, we can re-write the radius of our cross-sectional area as: $$r=x=\frac{1}{y}$$ and the area itself can be written as: $$A=\pi (x^{2}) = \pi(\frac{1}{y^{2}})$$ Now, to find the volume of the trumpet shape parametrized by this area, we can just integrate the area over the range of y values that where the curve of our bottle is defined (from y=1 ft. to y=2 ft.): $$V=\int_{1}^{2} A(y)dy = \int_{1}^{2} \frac{\pi}{y^{2}} dy = \left. \frac{-\pi}{y} \right|_{1}^{2} = \frac{\pi}{2} $$ We can repeat the same process with the curve defined by g(x) with the radius and area analogously defined as: $$r=\frac{1}{y^{2}}$$ $$A=\frac{\pi}{y^{4}}$$ and with the volume evaluate from 1 ft. to 3 ft. instead: $$V=\int_{1}^{3} A(y)dy = \int_{1}^{3} \frac{\pi}{y^{4}} dy = \left. \frac{-\pi}{3y^{3}} \right|_{1}^{3} = \frac{26\pi}{81} < \frac{\pi}{3} $$ After our hard work, we've caught the vendor red-handed! The taller bottle, thought it is 1 ft. taller, actually contains less soda than the shorter bottle.

Subject: Physics

TutorMe
Question:

Imagine a King rewards you with a 1kg bar of gold for your heroic deeds and offers you one last challenge to test your wit. He has another bar of gold he is willing to give you, but only if you can guess the mass of this new bar (m2) correctly, without weighing it. If you guess incorrectly, you forfeit your bar of gold and walk away with nothing. Assuming the bars have the same density, can you figure out the mass of the second bar (m2) using only a rope, a frictionless pulley, a stopwatch, and a ruler? You may assume air resistance is negligible to your calculation. (Hint: If you don’t know where to start, see if you can figure it out using an Atwood machine made from the rope, pulley, and two bars!)

Inactive
George D.
Answer:

Given the supplies the King so generously provided us, we can build an Atwood machine with the two gold bars. Given that we know the mass of one of the bars, the overall acceleration of the bars as we let them freefall depends on the mass of both blocks, so if we know the mass of one block, and we can measure the acceleration of the system, we can deduce the mass of the other! The King is clearly no match for our Physics skills. Setting up our Atwood machine, each mass experiences some force due to gravity pulling the blocks down and some force due to the tension in the rope pulling it upwards. While I can’t draw it hear, it is essential that we draw a free body diagram depicting each force acting on each mass. Once the free body diagrams are drawn, we can write down an equation for the forces acting on each mass based on Newton’s Second law as follows $$ \sum F_{1} = m_{1}a_{1}$$ where, if we label tension as going up and the force of gravity going down: $$ \sum F_{1} = T_{1}-m_{1}g $$ And similarly for the second mass $$ \sum F_{2} = m_{2}a_{2}$$ $$ \sum F_{2} = T_{2}-m_{2}g $$ Just looking at the equations in front of us, this might look impossible to solve. After all, we only know m1 and g, but the tensions, mass of the second block, and accelerations are all unknown! To start tackling this issue, let's first remember the King gave us a stopwatch and ruler, so if we let the blocks go, we can measure the distance they travel over a period of time to determine the acceleration. If we assume it takes 1 second (t) for block one to raise 0.5 meters (h), we can calculate the acceleration using the equations for projectile motion: $$h=v_{0}t+\frac{1}{2}at^{2}$$ Since we let the blocks go with no initial velocity, we solve for acceleration and get: $$a=\frac{2h}{t^{2}}$$ Plugging in our values for h and t we get a=1.0 m/s^2. Similarly, we could measure the acceleration for block two, but there's no need: As long as the masses are tied together by the rope, they have to fall and raise at the same rate. Now we've narrowed down our force equations to: $$T_{1}-m_{1}g = m_{1}a$$ $$T_{2}-m_{2}g = -m_{2}a$$ The minus sign on the second equation is extremely important as the block is falling down, not up; otherwise, we would get the wrong answer for the mass. All that's left is to recognize the tension of the rope on both masses must be the same. Therefore, we can just call it T. Rearranging both equations we get: $$T = m_{1}g + m_{1}a$$ $$T= m_{2}g -m_{2}a$$ Finally, we can set these two equations equal to each other to solve for m2: $$m_{1}(g+a) = m_{2}(g-a) $$ $$m_{2}=m_{1}\frac{g+a}{g-a}$$ Plugging in a=1.0 m/s^2, g=9.8 m/s^2, and m1=1 kg, we get m2=1.23 kg. We turn in our answer to the King, and we are handsomely rewarded for our hard work with two gold bars!

Contact tutor

Send a message explaining your
needs and George will reply soon.
Contact George

Request lesson

Ready now? Request a lesson.
Start Lesson

FAQs

What is a lesson?
A lesson is virtual lesson space on our platform where you and a tutor can communicate. You'll have the option to communicate using video/audio as well as text chat. You can also upload documents, edit papers in real time and use our cutting-edge virtual whiteboard.
How do I begin a lesson?
If the tutor is currently online, you can click the "Start Lesson" button above. If they are offline, you can always send them a message to schedule a lesson.
Who are TutorMe tutors?
Many of our tutors are current college students or recent graduates of top-tier universities like MIT, Harvard and USC. TutorMe has thousands of top-quality tutors available to work with you.
BEST IN CLASS SINCE 2015
TutorMe homepage
Made in California by Zovio
© 2020 TutorMe, LLC
High Contrast Mode
On
Off