Tutor profile: Muhammed Ç.
How many times will the word 'Hi' be output in the following code? x=1; while x<9 fprintf('Hi \n'); x=x+4; end
The loop will run as long as the value of x is less than 9. For the first iteration, we have x=1, so the loop will output the word Hi. At the end of this loop, the value of x becomes the current value of x plus 4 which turns out to be 5. The loop will run for a second time and output the word Hi again. At the end of the seconds loop, the value of x becomes 9. After the second iteration, the loop will not run again because the while condition is not met. The value of x is not less than 9, so the code will terminate after outputting the word Hi two times.
Subject: Basic Math
Find the sum of the first 5 prime numbers.
A prime number is defined as a number greater than 1 that has no positive divisors besides the number 1 and itself. The first 5 prime numbers are: 2, 3, 5, 7, 11. If we add these numbers together we get 2+3+5+7+11=28.
In many physics problems, we are told to neglect the effect of friction or air resistance. In real life applications, this is most likely never reasonable. If a ball is thrown up into the air, compare the initial throwing velocity to the final velocity of the ball as it returns to the throwers hand. Assume that the initial and final height is the same and that the ball is thrown completely vertically.
If we were ignoring friction, we would easily say that the initial and final velocities would be the same. However, things change when friction is present. The direction of the force of friction is always against the motion of the object. When the ball is traveling upwards, the effects of friction and gravity are acting in the same direction; downwards, However, as the ball descends, gravity is acting downwards again but friction is acting upwards. Thus the net acceleration on the ball on the way back down is smaller. This results in a smaller velocity at the end of the path. Thus, the final velocity of the ball is less than the initial throwing velocity.
needs and Muhammed will reply soon.