What is the difference between = and <- in R programming?
Most programming languages use the = sign to show that a variable is given a new value. This is not the case in R Programming. For example, in many other programming languages, x = x + 3, means the value assigned to x will be the previous value of x, plus 3. In R Programming, this would be rewritten as x<- x+ 3. So at this point, assume <- does the same job as =. Other examples of variable assignment in R: myName<- "Bob Smith" howManyletters<- nchar("Jane Doe") age<- 30 loveMath<- 3*r+1000 We use the = sign for parameter assignment when calling or defining a function. Let's say you want to use the substr function to return the first 3 letters of someone's birth month, given their entire birthday. For example: birthMonth<- substr(x= "April 25, 1986", start = 1, stop = 3) would return "Apr" The parameters in this function are x, start, and stop. The arguments are "April 25, 1986", 1, and 3. When assigning an argument to a parameter, we use the equals sign. Another example: round(25.789, digits = 2) would return 25.79. We use = to assign the value of 2 to the digits parameter.
Explain the trigonometric identity sin(x)^2 + cos(x)^2 = 1.
I am going to probe the student to tell me as much as they know about sine and cosine and hopefully encourage them to discover the answer. I will ask questions to lead them to the answer, and give them hints along the way. First, tell me the trigonometric ratio for sine of an angle and write that down: opposite/hypotenuse (abbreviate as o/h) Now, tell me the trigonometry ratio for cosine of an angle and write that down: adjacent/hypotenuse (abbreviate as a/h) Now, substitute o/h and a/h in for sine and cosine in the equation, respectively: (we will probably do substitution or re-write the equation more than once throughout this process, so I am going to label each time) sin(x)^2 + cos(x)^2 = 1 now becomes: #1: (o/h)^2 + (a/h)^2 = 1 Now think for a minute about how you changed the equation. You may be stuck still at this point. You could rewrite the equation by actually performing the squaring of o/h and a/h. You don’t have anything to lose! Try it: multiply (o/h)*(o/h) and (a/h)*(a/h). Now the equation looks like this: #2: (o^2)/(h^2) + (a^2)/(h^2) = 1 Do you notice another way to “simplify” or rewrite the equation? You could also rewrite it by adding the two fractions on the left side since they have a common denominator: #3: (o^2 + a^2)/(h^2) = 1 Again, take a minute to think about the previous 2 equations. Still stuck? Think about a famous formula that involves powers of 2. Yep, it’s Pythagorean Theorem: a^2 + b^2 = c^2. This is one of the most commonly taught formulas in high school and always seems to pop it's head into trigonometry problems. Let’s draw out this formula. First, draw a right triangle and label the sides o, a, and h, in reference to one of the non-right angles. Pythagorean theorem tells us that o^2 + a^2= h^2. Think about what you can do with this information and your equation in #3. Since h^2 equals (o^2 + a^2), you can replace the numerator on the left side of the equation for h^2: #4: h^2/h^2 = 1. So dividing something by itself, equals 1. Therefore, the left side simplifies to 1 and we are left with 1=1. We have proven the identity! Additional resources I would try: color-coding, underlining key concepts, & using the microphone.
Given that the area of an isosceles right triangle is 60 inches squared, find the height. Round to the nearest tenth..
First, let's write down what we KNOW, what we need to FIND, and ANALYZE this information. Then we will perform the mathematical steps to SOLVE the problem. KNOW: The triangle is an isosceles right triangle and we know basic information about triangles. The area of the triangle is 75 in. squared and we know the area formula for a triangle to be Area = (1/2)*base*height. FIND: The length of the height of the triangle. ANALYZE: 1. We know triangles consist of 3 sides, and a right triangle has 2 sides which make up the base and height (they are perpendicular to each other, which means they form a 90 degree angle). The other side of the right triangle, which is across from the right angle, is called the hypotenuse, and it is the longest side. We do not know the length of the base, height, or the hypotenuse at this point. (During this step, I would draw a picture of the right triangle.) 2. An isosceles triangle has two congruent sides (aka they have equal lengths). Since the hypotenuse of any right triangle is THE longest side, then you can’t have 2 of them. Therefore, the 2 congruent sides must be the base and height. 3. Formula for area of a triangle is Area = (1/2)*base*height. Since the base and height are unknown and they are the SAME length, let's call them BOTH x. Now let's substitute x into the formula and substitute (aka “plug in”) 75 in for Area. Rewrite the formula after substituting: 75 = (1/2)*x*x. SOLVE: Since we only have one unknown variable, we can use algebraic steps to solve this problem. Our goal is to get x by itself. Since x represents the height and base, if we find its value, then we have the answer! First, isolate x on the right side of the equation by multiplying both sides by 2. If you’re wondering why I’m choosing 2, it’s because (1/2)*2 is now on the right side and (1/2)*2 equals 1, so we’ve eliminated the (1/2) from the problem (no more fractions, yay!). Now the equation reads: 75*2 = (1/2)* 2*x*x which simplifies to 150 = x*x. Then, let's rewrite x*x as x^2: 150 = x^2. In order to "cancel out" the power of 2, we need to square root. If we square root the right-side, then the power of 2 goes away. So now we square root both sides, and rewrite: Square root (150) =x. In a calculator, we square root 150 and round to the nearest tenth: 12.2 inches is the final answer.