Functional Problem Solving (CSC 151 2015S) : EBoards

CSC151.01 2015S, Class 05: Drawings as Values


Overview

Preliminaries

Admin

Upcoming Work

Extra Credit Opportunities

Academic

Peer Support (Morning Section)

Recommended Events (no EC unless mentioned above)

Questions

You briefly mentioned this in one of the readings, but when using these procedures with inexact numbers, Scheme generates a seemingly random, large value. For instance, (denominator 2.1) generates 2251799813685248.0. Why does this happen?

They aren't random. They are just strange. Scheme represents every exact number as a sum of up to about 53 powers of two. So, 2.1 is 1x2^1 + 0x2^0 + 0x2^-1 + 0x2^-2 + 0x2^-3 + 1x2^-4 + 1x2^-5 + .... Alternately, you can think of that as 1x2 + 0x1 + 0x1/2 + 0x1/4 + 0x1/8 + 1x1/16 + 1x1/32 + 0x1/64 + 0x1/128 + .... The lcm of those denominators is 2^51, or 2251799813685248.0.

What should we know about modulo

In general, you can think of modulo as a procedure you use when you want to get a "cycle" of values. The basic cycle is 0 1 2 ... n-1 0 1 2 ... n-1 0 1 2 .... But we can add to those values to get different cycles, so you can just think of it as "cycle of length n".

Why is a unit circle diameter 1 rather than radius 1?

So that it's similar to the unit square?

Bad design on Sam's part.

Preparation

Normal preparation

Key Points

Lab

The carriage return (enter key) can be your friend

> (define sample-ellipse 
    (vshift-drawing
     1
     (hshift-drawing
      2
      (vscale-drawing
       3
       (hscale-drawing
        5
        drawing-unit-circle)))))

Reflection