Functional Problem Solving (CSC 151 2015S) : EBoards
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] - [FAQ] [Teaching & Learning] [Grading] [Taking Notes] [Rubric] - [Calendar]
Current: [Assignment] [EBoard am] [EBoard pm] [Lab] [Outline] [Reading]
Sections: [Assignments] [EBoards am] [EBoards pm] [Labs] [Outlines] [Readings] - [Examples] [Handouts]
Reference: [Setup] [VM] [Errors] - [Functions A-Z] [Functions By Topic] - [Racket] [Scheme Report (R5RS)] [R6RS] [TSPL4]
Related Courses: [Davis (2013F)] [Rebelsky (2014F)] [Weinman (2014F)]
Misc: [Submit Questions] - [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] - [Book Office Hours] - [Issue Tracker (Course)]
Overview
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
moduloas 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.
/home/rebelsky/bin/csc151-setup#lang racket, use (require gigls/unsafe).Normal preparation
Key Points
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)))))