Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
A student guesses three formulas for : , and . A program tests each on random angles with np.allclose. How many of the three are true identities, and which formula, numbered , or in this order, fails?
An identity holds for every angle. np.allclose(left, right) tests arrays; np.max(np.abs(left - right)) is the worst miss. One counterexample proves an identity false. Avoid angles where for and . Random angles from rng.uniform(0, 2 * np.pi, n) test an identity everywhere.
Have you tried it?
Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.
Step 1. The test. The program finds True for the first two and False for the third.
Step 2. By hand. At , , but . One counterexample proves the third formula false.
Step 3. The first two. Both follow from and .
Answer: true identities. The third formula, , fails.
Log in to join the discussion.
Loading…