(modulo 21 6)
(modulo 57 13)
(modulo 23 2)
(modulo 24 2)
(modulo 0 2)
Note 1: in a
Scheme arithmetic calculation, if any one (or more)
of the numbers contain a decimal point, then the calculation will
be done using
decimals (and will probably be approximate). If all of the
numbers are
integers or fractions, and none of them contain a decimal point,
then the answer
will be exact, and may contain a fractional part. For
instance:
(/ 7 (+ 2 3)) ; -> 1 2/5
(/ 7 (+ 2.0 3)) ; -> 1.4
Note 2: Scientific notation can also be entered: for instance, 300.0 can be written 3e2
Note 3: Use
the semi-colon character ";" to start a comment in the upper
(definitions) pane. The comment will last unto the end of
the line. Example:
; This is problem # 47.89B
(define (justin bieber) (* bieber bieber))
; That was problem # 7.89B======================= Homework exercises to hand in ==================================
1. Below, you'll see an object called a "continued
fraction". Evaluate the fraction in Scheme, and get the
result in
decimal.
Place the decimal answer (rounded to 5 decimal places) in the
comments-to-teacher section. (BTW, does the answer look familiar?)
2. Let's create a mathematical (not Scheme)
notation: "A (mod B)" is the
remainder when A is divided by B. Now let's notice a pattern
found by the
great mathematician Pierre de Fermat back in 1640. Evaluate
the 4 examples
below, each of which is in the form: XY (mod Z).
There's
nothing special about the choice of X, but there is something
special about the
choice of Z and of Y. Guess what's special about the
relationship between
Y and Z, and what's special about Z? Write a quick answer in
the
comments-to-teacher.
2a) evaluate 212 (mod 13)
2b) evaluate 522 (mod 23)
2c) evaluate 556 (mod 7)
2d) evaluate 1842 (mod 43)
3. One "Astronomical Unit" is defined to be the average distance from the Earth to the Sun. It is approximately 93 million miles. If light travels at approximately 186,000 miles/second, about how many minutes will it take light from the Sun to reach the Earth? Create the variables: c (speed of light in miles/sec), au (astronomical unit in miles). Write and evaluate a Scheme expression using these variables (in the upper-pane), and put the answer into the Comments-to-teacher..
4. Write two expressions to solve the quadratic equation below (use the quadratic formula). Put the two roots into the Comments-to-Teacher.
X2 - 6X + 13 = 0