09-17-2013 HW p

posted Sep 17, 2013, 5:29 AM by Samuel Konstantinovich   [ updated Oct 3, 2013, 5:15 AM ]
Goal: The internet: websites, lots of cats, and trolls

Host:  The computer.
IP Address: The numerical address of a computer on the internet, or even a local network. Format: 4 numbers ranging from 0-255 separated by periods.
Domain Name: The name you use to connect to a website instead of the address. 
Domain Name Server: The computer that stores the Domain Name to IP Address look up tables. You need access to this in order to user the names.

lisa.stuy.edu 149.89.160.100
homer.stuy.edu 149.89.150.100
bart.stuy.edu 149.89.151.100
marge.stuy.edu 149.89.161.100

rm251: 160.xxx  cslab3-1 ... cslab3-31  where xxx is 101-131
rm307: 150.xxx  cslab1-1 ... cslab1-30  where xxx is 101-130
rm325: 151.xxx  cslab2-1 ... cslab2-30  where xxx is 101-130
rm451: 161.xxx  cslab4-1 ... cslab4-32  where xxx is 101-132

SSH a way to connect to any host remotely so you can work on the 
Mac or linix command: ssh user@host
Windows: puTTY

File transfer SFTP: Filezilla


Problem set in class:

Convert to infix notation:
a) (+ (- (* 3 4)(/ 10 2)) (+ 1 3))
b) (/ (- 3 10) (+ (* 4 2)(* 8 (/ 1 2))))
Convert to Scheme notation:
c) 5(x+2) / (x - 1)^2


Homework Assignment Print it out and Bring in to class on Friday September 20th:

1. Convert the infix expression to prefix.
 a.   ( 5 - 4 * 2 ) / ( 10 - 5 ) + 3
 b.   ( 2 +  3 ( 4 - 2) / ( 1 - 3 / 5 ) )
2. Evaluate the expressions (show the steps you took line by line) You may verify your result using DrScheme. Parts f and g require you to refer back to Part1 of the assignment. 
 a. ( * (+ 4 7 9) (/ 15 5) (- 3 -1) )
 b. (/ (- 20 -4)   (* -3 2 -1))

Part C onward requires the lecture from Wednesday.
    (define a 4)
    (define b 5)
    (define c  (+ a b -1) )
 c. ( - (+ a (* -1 c) b) (* a b))
 d. (+ (quotient c b) (remainder a 4)) 
 e. (+ (* a b -1) (- c (* b 2)))

3. Write scheme functions, and show the results of a few tests:
 a. Write a scheme function (volumeSphere r) that evaluates to the volume of a sphere with radius r.
 b. Write a scheme function (sumofsquare a b) that evaluates to the sum of the squares of a and b.

ANSWERS
1a.   (+ (/ (- 5(* 4 2)) (- 10 5) ) 3) 
 b.  (/ (+ 2 (* 3(- 4 2))) (- 1 (/ 3 5)) ) 
2. Evaluate the expressions (show the steps you took line by line) You may verify your result using DrScheme. Parts f and g require you to refer back to Part1 of the assignment. 
 a. ( * (+ 4 7 9) (/ 15 5) (- 3 -1) )
    (* 20 3 4)
     240
 b. (/ (- 20 -4)   (* -3 2 -1))
    (/ 24 6)
    4

 c. ( - (+ 4 (* -1 8) 5) (* 4 5))
    ( - (+ 4 -8 5) 20)
    ( - 1 20)
    -19

 d. (+ (quotient 8 5) (remainder 4 4)) 
    (+ 1 0)
    1

 e. (+ (* 4 5 -1) (- 8 (* 5 2)))
    (+ -20 (-8 10)) 
    (+ -20 -2) 
    -22
        
3. Write scheme functions, and show the results of a few tests:
a. (define (volumeSphere r) (/ 3 (* 4 r r r 3.1415926535)))
b. (define (sumofsquares a b) (+ (* a a) (* b b) ))
Comments