# Tutor profile: Jack A.

## Questions

### Subject: MATLAB

How would you make a while loop that will run no matter what for the first time then check a certain condition to see if it should continue to run?

***NOTE: Code will be posted below the answer. In other programming languages, this is called a "do while" loop. The first iteration of the loop will run regardless of any condition then a condition will be checked at the end of the loop to see if the loop will run another iteration. We know that no matter what, the while loop has to run the first iteration. For this, we can put while 1. When matlab gets to this line, it will evaluate 1 as true and continue inside the while loop. Then you could insert the code you would want to run inside the while loop code block. The important part is the ending condition because this is how we will exit the loop and prevent an infinite loop. We need to use a break that will take us out of the loop we are in. But we only want to break out of the loop if a certain condition is met. For this, we will use an if statement. Inside of that if statement, we will type break which will take us out of the while loop. while 1 % Insert code you want to run if condition break; end % end of if statement end % end of while loop

### Subject: Trigonometry

Let's say I have a ladder that is 10 feet long and it is leaning against a vertical wall. Assume the angle between the ladder and the ground needs to be 75 degrees to ensure safe ladder operation. How far away from the wall does the ladder need to be placed to make sure it is safe to use.

Think of the ladder, the ground, and the wall making a triangle. The length of the ladder is going to be the hypotenuse of the triangle because it is the shortest distance between the two ends of a ladder. We know the length of the ladder and we know that the angle between the ladder and the ground needs to be 75 degrees. We can use this information to calculate how far away from the wall the ladder needs to be. We know that the opposite side of the angle is the vertical height (which we are not interested in for this problem). We know the horizontal distance between the bottom of the ladder and the wall is adjacent to the angle. And we know that the hypotenuse is the length of the ladder. Using the length of the ladder and the angle between the horizontal and the ladder, we can calculate the horizontal distance using the cosine function. We know that cosine(theta) = adjacent/hypotenuse and we want to solve for adjacent. Rearranging that equation, we get adjacent = cosine(theta) * hypotenuse. Plugging everything in we get adjacent = cosine(75degrees) * 10ft = 2.59 ft away from the wall.

### Subject: Algebra

If you're having a hard time finding the roots of a quadratic equation by factoring, what other methods can you use to solve the quadratic equation?

If you are having trouble factoring using the "X method" you could try completing the square. If you are still having trouble with completing the square, you can use the quadratic equation to solve for the zeros. The quadratic equation is nice because it takes the guessing out of solving for zeros and it also allows you to find imaginary zeros. Imaginary numbers are numbers you get from taking the square root of a number less than zero.

## Contact tutor

needs and Jack will reply soon.