Ch07 WS 01

Translate each expression into Racket. You can look up lots of arithmetic functions if you are interested. There’s more if you are into KAM or math team subjects.

  1. Does the test (check-within (sqrt 11) 3 0.3) pass?

    • In this statement, what is the expected answer?
    • In this statement, what is the tolerance (the amount of error allowed in a correct answer)?
  2. Write a check-within statement that says (sqrt 19) is $4.4 \pm 0.05$.

  3. Write an incorrect (and failing) check-within statement that says (sqrt 19) is $4.4 \pm 0.01$.

  4. $100 + 50$

  5. $200 + 800 + 900 + 80$

  6. $500 / 8$

  7. $1011 - 231$

  8. the whole number of times 2145 is divisible by 7 (“quotient”)

  9. the amount left over when 2145 is broken into groups of 7 (“remainder”)

  10. $\sqrt{17}$

  11. $11^8$

On the computer

  1. there is a shortcut for squaring, find it and compute $163^2$

  2. Find $\frac{13}{29} + \frac{31}{17}$ as a fraction.

  3. Write the function $f(x) = x^2 - 8x + 7$ and test it.

  4. What is the difference between $5 + \sqrt{169-256}$ and $5 - \sqrt{169+256}$. Carefully explain Racket’s response to each.

  5. Do 7.2.6: write a function to compute one of the solutions of $ax^2+bx+c=0$ using the quadratic formula.

  6. Write a function to compute the distance between (x0, y0) and (x1, y1). Include check-expects.

    (define (distance x0 y0 x1 y1) …)

Last modified August 18, 2023: 2022-2023 End State (7352e87)