Enable contrast version

# Tutor profile: Sam E.

Inactive
Sam E.
Data scientist and tutor with 5 years of experience.
Tutor Satisfaction Guarantee

## Questions

### Subject:Python Programming

TutorMe
Question:

Given a list of integers N, return the max of the list without using one of Python's built in functions.

Inactive
Sam E.

First, let's go over the basics of a function. In Python, functions are declared using the notation "def nameOfYourFunction(variables):", so begin this problem by declaring our function as shown below. def getMax(N): In practice, for this problem we would normally just use Python's built in "max" function where def getMax(N): return(max(N)) but that is not allowed for this problem and would take the fun out of it. Luckily, we can solve this problem in a few other ways. For instance, if you don't consider the .sort() operation on lists as a function, we could simply write def getMax(N): N.sort() #Sort the list N so that the largest number is in the last position of the list MAX = N[-1] #Grab the last element of the list by using the -1 index return(MAX) # Return this value If you don't want to use the .sort() operation, we can always iterate through the list and look for the largest element. Let's try that. def getMax(N): #Let's iterate through the list and keep track of the largest number we've seen #We can start this process by saying the largest... # ...element to start with is the first number we see largestSoFar = N[0] # Say the largest element so far is the first element, at index 0 for number in N: #Iterate throughout the list if number > largestSoFar: largestSoFar = number return(largestSoFar) By using this algorithm, we can simply keep track of the largest element and return the maximum at the end.

### Subject:Calculus

TutorMe
Question:

Find $$f'(x)$$ if $$f(x) = 2x^2 + \frac{1}{x^2} + e^{x}$$.

Inactive
Sam E.

First, recall that $$f'(x)$$ just means the derivative of $$f(x)$$. Now, this problem may look challenging, but since $$f(x)$$ is just a function of three things being added together, we can break this problem up into little chunks, first finding the derivative of $$2x^2$$, then finding the derivative of $$\frac{1}{x^2}$$, finding the derivative of $$e^{x}$$, and then adding all three derivative together to get $$f'(x)$$. Let's start with $$\frac{d}{dx}2x^2$$. To solve this, remember that cool little thing in Calculus called the Power Rule, where $$\frac{d}{dx} x^n = nx^{n-1}$$ if $$n$$ is an integer (i.e. $$n \in \mathbb{Z}$$). Next, remember that $$\frac{d}{dx} ax^n = a\frac{d}{dx}x^{n}$$ if $$a$$ is just a number (i.e. $$a \in \mathbb{R}$$). Using those tricks, we can see that $$\frac{d}{dx}2x^2 = 2\frac{d}{dx}x^2 = 2\cdot 2x^{2-1} = 4x$$. The next derivative of $$\frac{d}{dx}\frac{1}{x^2}$$ can be solved similarly if we simply re-write $$\frac{1}{x^2}$$ as $$\frac{1}{x^2} = x^{-2}$$. Thus, $$\frac{d}{dx}\frac{1}{x^2} = \frac{d}{dx}x^{-2} = -2x^{-2-1} = -2x^{-3} = \frac{-2}{x^{3}}$$. Lastly, we must find $$\frac{d}{dx}e^x$$. This derivative is both famous and difficult to prove. To deal with this fact of Calculus, one should memorize what $$\frac{d}{dx}e^x$$ actually is. Luckily, this derivative is simply $$\frac{d}{dx}e^x = e^x$$, i.e. the derivative of $$e^x$$ is simply $$e^x$$. Thus, our final solution is: $$f'(x) = \frac{d}{dx} \bigg(2x^2 + \frac{1}{x^2} + e^{x}\bigg) = \frac{d}{dx}2x^2 + \frac{d}{dx}\frac{1}{x^2}+ \frac{d}{dx}e^{x} = 4x + \frac{-2}{x^{3}} + e^x.$$

### Subject:Statistics

TutorMe
Question:

Problem: A casino in Las Vegas has created a new game called "Flip & Roll" where a gambler has the opportunity to win money by flipping a coin and rolling a dice. First, the gambler flips a fair coin. If the coin lands tails, the gambler loses and has to pay $2. If the gambler flips a heads, she is allowed to roll a fair six-sided dice which determines the amount of money she wins -- i.e. if she rolls a 5, she wins$5. Question: What is the expected value of the amount of money a gambler playing the game will receive?

Inactive
Sam E.

First, we need to make sure we understand the rules "Flip & Roll" and what probabilities are involved in the game. It appears that we first flip a coin which has a 1/2 chance of landing heads and a 1/2 chance of landing tails. Next, if the coin lands heads (which happens with a probability of 1/2), we next roll a standard size-sided die (so, there is a 1/6 chance that we roll a 1, a 1/6 chance we roll s 2, a 1/6 chance we roll a three, ... etc, all the way to a 1/6 chance we roll a 6), and the face of the die which shows is the amount of money we earn. Next, let's make sure we know what the problem is asking. We are asked to find the expected value of the payoff from the game. Let $$X$$ represent the random variable which is the payment the gambler receives when playing the game and let $$C$$ represent the result of the coin toss which can either be a heads ($$H$$) or a tails ($$T$$). Thus, the questions is asking what is $$\mathbb{E}[X]$$. This can be found by using the formula for expectations $$\mathbb{E}[X] = \sum_x P(X = x) \cdot x$$. Since our chances of earning money are conditional on our coin toss, we calculate $$\mathbb{E}[X]$$ by using the conditional expectation formula $$\mathbb{E}[X] = P(C = H) \mathbb{E}[X | C = H] + P(C = T) \mathbb{E}[X | C = T]$$ which is conditional on the coin toss. Let's begin. First, remember that this game costs $2 to play, so if we do not win at least$2 while playing, we will actually lose money. Now, recall that the game ends if we roll a tails, and thus, $$P(X = -2 | C = T) = 1$$. Thus, $$\mathbb{E}[X | C=T] = -2$$. Since $$P(C=T) = P(C=H) = 1/2)$$, we have $$\mathbb{E}[X] = (1/2) \mathbb{E}[X | C = H] + 1/2 ( -2 )$$ . All that is left to find is $$\mathbb{E}[X | C = H]$$, which is simply the expected value of a dice roll minus 2 (since it costs $2 to play the game). This can be found using the definition of expectation shown above. Thus, $$\mathbb{E}[X | C = H] = \frac{1+2+3+4+5+6}{6} - 2 = 21/6 - 2 = 3/2$$. Thus, $$\mathbb{E}[X] = (1/2) (3/2)+ 1/2 ( -2 ) = -1/4 = -0.25$$. Thus, the gambler is expected to lose$0.25 on each play of the game on average.

## Contact tutor

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

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