define
,lambda
expt
to calculate exponents; its two arguments are
the base and the exponent. Racket also has a built-in variable
pi
containing the (approximate) value of \(\pi\). Define a function that takes one
argument, radius
, and computes the volume of a sphere with
that radius.let
,
cond
Write a function plus-root
to compute one root (the
one resulting from the + of the \(\pm\)) of the quadratic formula.
(reproduced below, in case you don’t presently have it memorized). Use
let
(or let*
) to help you make it as readable
as possible.
\[ x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \]
Here’s a couple test cases in case you try it out:
(plus-root 0.5 -3 2.5) 5.0 (plus-root 0.5 -3 5) 3.0+1.0i
Modify your function from #2 to return false if there is no real root. So now it should behave as follows:
(plus-root 0.5 -3 2.5)
5.0
(plus-root 0.5 -3 5)
#f