# Tutor profile: Kirsten S.

## Questions

### Subject: Python Programming

Write a program in python to check if a list of numbers is prime. Print out the prime numbers. Pick n random numbers and the user picks n.

Whenever writing a python script, make sure to comment your code. It is a good habit to develop if you use python in your career. I also use comments to organize steps in code before writing it. Let's write out our steps first together. # 1. Ask the user to input a number. #2. Create a list of n random numbers based on user input. #3. Loop through each number in the list, let's call it nums. For each number in the list: #3.a Check if the number is divisible by 2 #3.b If the number is not divisible by 2, print it out. Otherwise continue And that's it! That's our outline, so let's start to put code to it. # 1. Ask the user to input a number. n = int(input("Please enter a number from 1 to 99, no decimals please:") #2. Create a list of n random numbers based on user input. I decided to cap it from 1 to 100 nums = random.sample(range(1, 100), n) #3. Loop through each number in the list, let's call it nums. For each number in the list: for number in nums: #3.a Check if the number is divisible by 2 if number%2 == 0: print("") #3.b If the number is not divisible by 2, print it out. Otherwise continue else: print(number) 1. input is simply asking the user for input, and converting the datatype to an int. 2. Use the random package to pick a random list of numbers between 1 and 100, and will pick n numbers which comes from the user input. 3. Begin the for loop, reads as for each number in nums. Number refers to the item in the list. when the loop completes number then points to the next item in the list. 3.a. number%2 means divide by 2 and return the remainder. If the remainder is 0, then the number is divisible by 2.

### Subject: Calculus

Find the derivative of $$f(x)=e^{x-1}+ln(3x-1)+sin(2x+1)$$

This looks like a big derivative, let's break it up. Remember the sum rule of derivatives, if we are taking the derivative of a function comprised of sums of functions, we can take the derivative of each function and sum them together. Starting with $$e^{x-1}$$. We want to use the chain rule and split up $$e^x$$ and $$x-1$$. With the chain rule, first take the derivative of the outer function which is $$e^x$$. We know the derivative of $$e^x=e^x$$ so that stays the same. Now multiply by the derivative of $$x-1$$, which happens to be 1. Therefore the first term's derivative is the same as the function itself. Moving on to the second term, we know the derivative of $$ln(x)=\frac{1}{x}$$. We can apply the chain rule again and treat $$3x-1$$ as x in this case so that moves to the bottom of the denominator. Now multiply by the derivative of the inside which is 3, so we have $$\frac{3}{3x-1}$$. Finally the third term, we will use the chain rule again. First the outside derivative, $sin(x)$ is $cos(x)$. The derivative of the inside is 2, so we have $2cos(2x+1)$. Finally putting all three terms together: $$f'(x) = e^{x-1}+\frac{3}{3x-1}+2cos(2x+1)$$

### Subject: Algebra

Simplify $$\frac{(3x^2y^{-2})^3}{(9xy^3)^3}$$

Let's start by looking at the numerator, or top, of the fraction. Recall, when we have a variable raised to an exponent, such as $$x^2$$, then raised to another exponent, such as $$(x^2)^3$$, to simplify, you multiply the exponential values together, so from my example we would have $$(x^6)$$. Let's apply that to the numerator: $$\frac{(3x^6y^{-6})}{(9xy^3)^3}$$ Let's also apply that same principal to the denominator: $$\frac{3x^6y^{-6}}{9xy^9}$$ Now it's just simplifying a fraction. Let's look at the number values first (the 3 in the numerator and 9 in the denominator). Can you think of a number that both numbers are divisible by? Right! 3. Let's divide the numerator and denominator by 3. Since the numerator is left with 1, that can be left out since anything multiplied by 1 is itself. $$\frac{x^6y^{-6}}{3xy^9}$$ Now let's look at the exponential with a base of x. Recall when exponentials are divided with the same base (x in this case), the exponents can be subtracted, the denominator exponent value is subtracted from the top exponent value. Let's apply this to both the exponential with base x and the exponential with base y. $$\frac{x^5y^{-15}}{3}$$ Technically, this is correct. However this answer would also be correct: $$\frac{x^5}{3y^{15}}$$

## Contact tutor

needs and Kirsten will reply soon.