TutorMe homepage

SIGN IN

Start Free Trial

Gray O.

Math, Science, Computer and Art Geek and Tutor

Tutor Satisfaction Guarantee

Javascript Programming

TutorMe

Question:

Consider the following code: $(\texttt{ (function() { var a = b = 10; })(); console.log(a); console.log(b); }$) What will be output to the console?

Gray O.

Answer:

The first thing we notice in this question is that we have a function literal that is being called immediately and then two $${\tt console.log}$$ statements that output the value of variables $$a$$ and $$b$$. The important thing to understand here is that the IIFE will interpret the line $${\tt var a = b = 10;}$$ as two separate assignments. The first will assign a local variable $$a$$, to the value of $$b$$. However, in order to get the value of $$b$$, it must first assign $$b$$ to be a global variable with the value 10. $$b$$ is a global variable because it does not have the keyword $${\tt var}$$ in front of it. Therefore, the console will output $(\texttt{ undefined 10 })$ $$a$$ is a local variable to the function literal, so it will not be defined in the global scope. $$b$$, on the other hand, is declared as a global variable, and so its value will still be 10 outside of the function.

Trigonometry

TutorMe

Question:

Two airplanes take off at the same time from the same airport. One is traveling at 350mph and the other is traveling at 575mph. How far apart are they from each other after 1 hour and 40 minutes if there is an angle of 30 degrees between their directions of flight?

Gray O.

Answer:

The first thing to do when attempting to solve this kind of question is to draw out or imagine a diagram of the scenario in your head. We will end up with a triangle where one vertex is the airport where both planes took off and each side extending from that vertex is the distance that one of the planes traveled in 1 hour and 40 minutes. The remaining side, opposite the vertex that represents the airport, will then be the distance between the planes after 1 hour and 40 minutes has elapsed. I will call the vertex that represents the airport $$A$$ for Airport and its corresponding side (opposite to it on the triangle ) $$a$$. The side representing the distance that the first plane traveled will be $$b$$ and the side representing the distance that the second plane traveled will be $$c$$. In order to find the distance that each plane traveled, we simply multiply its speed times the duration of its travel in hours. 1 hour and 40 minutes = $$\frac{5}{3} hours. Therefore, $(b = 350 * \frac{5}{3} = \frac{1751}{3} $) $(c = 575 * \frac{5}{3} = \frac{2876}{3} $) Now that we have a triangle where we know the value of an angle and the lengths of its adjacent sides and want to find the length of the side opposite, we can use the law of cosines, which states: $(a^2 = b^2 + c^2 - 2bc\cos A $) Therefore, we can find a simply by plugging in our values and taking a square root. $(a = \sqrt{(\frac{1751}{3})^2 + (\frac{2876}{3})^2 - 2(\frac{1751}{3})(\frac{2876}{3})\cos(30)} $) $(a = 539.030 $) So, the distance between the planes after 1 hour and 40 minutes is 539.030 miles.

Calculus

TutorMe

Question:

A particle is moving on the xy-plane and its position is given by the parametric equations $$x(t) = t^3 - 3t^2$$ and $$y(t) = 12t - 3t^2$$. At which coordinate $$(x, y)$$ is the particle at rest?

Gray O.

Answer:

Since the question is asking when the particle is at rest, we want to find where the particle's velocity in both the $$x$$ and $$y$$ directions are 0. In order to do this, remember that taking the derivative of a function will give us that function's rate of change. In the question, we are given parametric functions for the particle's $$x$$ and $$y$$ positions. Taking the derivative of a position function will give us the rate of change of position, which is also known as velocity. Since we want to know when the velocities in both directions equal zero, the first step will be taking the derivative of each position function. To do this, we can use power rule since each parametric equation is simply a polynomial. $(x(t) = t^3 - 3t^2 $) $(\frac{dx}{dt} = 3t^2 - 6t $) $(y(t) = 12t - 3t^2 $) $(\frac{dy}{dt} = 12 - 6t $) Next, we want to find where the velocities, $$\frac{dx}{dt}$$ and $$\frac{dy}{dt}$$, both equal zero. We can do this by setting each equation equal to 0. For $$ \frac{dy}{dt} $$: $( 12 - 6t = 0 $) $( 12 = 6t $) $( t = 2 $) For $$ \frac{dx}{dt} $$: $( 3t^2 - 6t = 0 $) $( 3t(t-2) = 0 $) $( t = 0, 2 $) From this we can see that $$\frac{dx}{dt}$$ equals 0 when $$t = 0$$ and $$t = 2$$. However, we know that $$\frac{dy}{dt}$$ only equals 0 when $$t = 2$$. Therefore, the particle will only be at rest when $$t =2$$. However, the question asked us for the $$x,y$$ coordinate of the particle when it is at rest. To do this, we plug $$t = 2$$ back into the original position equations $$x(t)$$ and $$y(t)$$. $(x(t) = t^3 - 3t^2 $) $(x(2) = (2)^3 - 3(2)^2 $) $(x(2) = 8 - 12 $) $(x(2) = -4 $) $(y(t) = 12t - 3t^2 $) $(y(2) = 12(2) - 3(2)^2 $) $(y(2) = 24 - 12 $) $(y(2) = 12 $) Therefore, the $$(x, y)$$ coordinate when the particle is at rest is $$(-4, 12)$$.

Send a message explaining your

needs and Gray will reply soon.

needs and Gray will reply soon.

Contact Gray

Ready now? Request a lesson.

Start Session

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 Session" 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.

Made in California

© 2019 TutorMe.com, Inc.