Grading for Statistical computing homework 5

Grading homework 5 (Spring 1998)

If you update your homepage, turn your grade sheet back into me and I'll regrade it.

First problem:

For each function, I wrote one test function. It is graded as: (Where you start with 8 points and work up/down from there):

Code that might cause problems Reason
1
test <- function(f) d(f)(1)
test(sq)
Does d() find the right lambda expression or just the name?
2
rootI({function(x) 10e-10 * (x - .5)},0,2)
does root test on x or on f(x)?
3
root({function(x) 100 - log(x^2/(1+abs(x)))})
Can root find large roots for a monotonic function?
4
nasty <- function(x) 1 - 1/(1+x^2);
max(nasty)
Can it find the max of an asymptote?
5
test.arg <- 5

test <- function(x) uniform(x)(1:5)

test(test.arg)
does uniform() handle arguments correctly?
6
CDF(norm(1000,1))(1500)
How is the "zero" function problem dealt with?
7
E(norm(3,4))(sq)
Syntax may vary. (should return 25)
8
d(MGF(norm(10,1)))(0)
An easy one?
9
chisq <- function(){
   g <- transform(normal,sq);
   g(3)}
Can transform be called from inside a function?

second problem: