# Tutor profile: Grace A.

## Questions

### Subject: MATLAB

How can you optimize this for loop: X = [ 1, 2, 3; 4, 5, 6; 7, 8, 9; 8, 7, 6]; Y = [0.5, 0.5, 0.2; 1, 2, 1; 0.4, 0.4, 0.4; 1, 1, 1]; for row = size(X,1) for col = size(X,2) Z = X(row, col) * Y(row,col); end end

You can use element wise multiplication by adding a '.' before the '*'. Z = X.*Y; You can use the element wise '.' operator for division too!

### Subject: Physics

While playing air hockey with a friend, you decide to test what happens when your friend throws a puck and you throw your paddle directly at each other. The puck has a mass of 0.05kg. The paddle has a mass 3 times that of the puck. You both throw your item at 2m/s. In which direction (towards you is negative, away from you is positive) and how fast does the puck move if the paddle remains still at point of contact? Friction is negligible.

This is a question of momentum(p) where $(p = mass(m) * velocity(v)$) Momentum is conserved when two objects collide (with no outside force), so momentum before = momentum after: $( (m_{puck} * v_{puck before}) + (m_{paddle} * v_{paddle before}) = (m_{puck} * v_{puck after}) + (m_{paddle} * v_{paddle after})$) Before: $( 0.05 kg * 2 m/s + (3 * 0.05 kg) * -2 m/s = 0.1 Ns - 0.3 Ns = -0.2 Ns $) After: $( 0.05 kg * x m/s + (3 * 0.05 kg) * 0 m/s = 0.05x Ns + 0 Ns = 0.05x Ns $) $(-0.2 Ns = 0.05x Ns$) $(x = -0.2 (kg m/s) / 0.05 (kg) = -4m/s$) Answer: 4 m/s toward you OR -4m/s

### Subject: Algebra

Find the roots for this equation: $(y = -2x^2 - 7x - 6$)

In order to do this, there are different levels of expertise, but to start I'd suggest factoring using guess and check. We know we need to have the first elements multiply to $$-2x^2$$ and the second two elements need to multiply to -6, so we could try: $((-2x + 6)(x - 1)$) To check we would expand that back out, which gives us $(-2x^2 + 8x -6$) which is incorrect so we'd keep trying until we found the correct factors: $( (2x + 3)(-x-2) $) Then to find the roots we can each factor equal to zero: $(2x+3 = 0$) $(2x = -3$) $(x = -3/2$) and $(-x-2 = 0$) $(-x = 2$) $(x = -2$) If this still doesn't make sense or we get stuck trying to factor, we can always try the quadratic formula $( x = (-b ± sqrt(b^2 - 4ac))/2a$)

## Contact tutor

needs and Grace will reply soon.