Class Notes (808,549)
United States (313,136)
COMPSCI 61A (130)
De Nero (43)
Lecture

# CS61A Lecture 06: Newton's Method

3 Pages
44 Views

School
University of California - Berkeley
Department
Computer Science
Course
COMPSCI 61A
Professor
De Nero
Semester
Fall

Description
Lambda Expressions lambda x: x * x == Square(x) *Not common, cannot contain statements Def square = lambda x : x * x -- > return body ^ formal parameters square = lambda x: x*x VS def square(x) Both create function with same domain, range, behavior Both function have as parent the environment in which defined Both bind function to name square Only def gives statement intrinsic name Function Currying def curry2(f): def g(x): def h(y): return f(x, y) return h return g **Same as make_adder Currying: transform a multiargument function into a single argument, higher-order function Newton's Method Quickly find accurate approximations to zeroes of differentiable functions Zero = f(x) = 0 Application: method for compute square root, cube root Positive zero of f(x) = x^2 - a, = sqrt(a) (x^2 = a) Given a function f and initial guess x: Repeatedly improve X 1. Compute value of f at guess: f(x) 2. Compute derivative of f at guess: f'(x) 3. Update guess x to: x - f(x) / f'(x) Finish when f(x) = 0 Using Newton Method Find sqrt ( 2 ) f = lambda x: x*x - 2 --> f(x) = x^2 - 2 df = lambda x: 2x --> f'(
More Less

Related notes for COMPSCI 61A

OR

Don't have an account?

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Join to view

OR

By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.