What is the distance between the following 2 coordinates: (1,2,3) and (5,2,6)?
To find the distance, plug in the coordinates into the distance formula which is: distance = sqrt((x-x1)^2 + (y-y1)^2 + (z-z1)^2). In this case: Distance = sqrt((1-5)^2 + (2-2)^2 + (3-6)^2) Distance = sqrt(4^2 + (0)^2 +(-3)^2) Distance = sqrt(16 + 0 + 9) Distance = 5
Consider the following scenario: (Box is of type Object) x = new Box; y = x; If I change anything in y, will it also change x?
In this scenario, we equate x to a Box or x = Box. We then equate y to x or y = x = Box. In java, x and y are actually a reference to the same Box in memory. Since we did not declare new Box when assigning y a value, changing the properties in y will also affect x.
You are given the equation P(x) = (x - 2)^2 + 3. What does the new equation look like if it is shifted by 5 to the right and down by 2?
The given equation, P(x) = (x - 2)^2 + 3, comes in the generic format of P(x) = (x - k)^2 + n. This tells us the two things: First, the power of 2 to the right of parenthesis indicates that this will be a parabola and secondly, (k,n) represents the lowest point of this specific parabola. To find the newly shifted parabola, we simply add k + 5 to obtain the new 'k' and we subtract n - 2 to get the new 'n'. Thus the new lowest point of parabola is (2 + 5, 3 - 2) = (7 , 1). We then plug this new coordinate into the generic format to get P'(x) = (x - 7)^2 - 1.