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.
-
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)?
-
Write a
check-within
statement that says(sqrt 19)
is $4.4 \pm 0.05$. -
Write an incorrect (and failing)
check-within
statement that says(sqrt 19)
is $4.4 \pm 0.01$. -
$100 + 50$
-
$200 + 800 + 900 + 80$
-
$500 / 8$
-
$1011 - 231$
-
the whole number of times 2145 is divisible by 7 (“quotient”)
-
the amount left over when 2145 is broken into groups of 7 (“remainder”)
-
$\sqrt{17}$
-
$11^8$
On the computer
-
there is a shortcut for squaring, find it and compute $163^2$
-
Find $\frac{13}{29} + \frac{31}{17}$ as a fraction.
-
Write the function $f(x) = x^2 - 8x + 7$ and test it.
-
What is the difference between $5 + \sqrt{169-256}$ and $5 - \sqrt{169+256}$. Carefully explain Racket’s response to each.
-
Do 7.2.6: write a function to compute one of the solutions of $ax^2+bx+c=0$ using the quadratic formula.
-
Write a function to compute the distance between (x0, y0) and (x1, y1). Include check-expects.
(define (distance x0 y0 x1 y1) …)