CS 61A/CS 98-52
Mehrdad Niknami
University of California, Berkeley
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 1 / 25
CS 61A/CS 98-52 Mehrdad Niknami University of California, Berkeley - - PowerPoint PPT Presentation
CS 61A/CS 98-52 Mehrdad Niknami University of California, Berkeley Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 1 / 25 Warning Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 2 / 25 Warning FYI: Mehrdad Niknami (UC Berkeley) CS 61A/CS
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 1 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 2 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 2 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 2 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 2 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 2 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 2 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 2 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 2 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 3 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 3 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 3 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 3 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 4 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 4 / 25
1 Drop a ball on a ramp Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 4 / 25
1 Drop a ball on a ramp 2 Let it roll down Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 4 / 25
1 Drop a ball on a ramp 2 Let it roll down 3 What shape minimizes the travel time? Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 4 / 25
1 Drop a ball on a ramp 2 Let it roll down 3 What shape minimizes the travel time?
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 4 / 25
1 Drop a ball on a ramp 2 Let it roll down 3 What shape minimizes the travel time?
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 4 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 5 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 5 / 25
1 Math is hard Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 5 / 25
1 Math is hard 2 Physics is hard Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 5 / 25
1 Math is hard 2 Physics is hard 3 We’re lazy Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 5 / 25
1 Math is hard 2 Physics is hard 3 We’re lazy 4 Why learn something new when you can burn electricity instead? Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 5 / 25
1 Math is hard 2 Physics is hard 3 We’re lazy 4 Why learn something new when you can burn electricity instead?
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 5 / 25
1 Math is hard 2 Physics is hard 3 We’re lazy 4 Why learn something new when you can burn electricity instead?
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 5 / 25
1 Math is hard 2 Physics is hard 3 We’re lazy 4 Why learn something new when you can burn electricity instead?
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 5 / 25
1 Math is hard 2 Physics is hard 3 We’re lazy 4 Why learn something new when you can burn electricity instead?
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 5 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 6 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 6 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 6 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 6 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 6 / 25
1 Chop up the ramp into line
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 6 / 25
1 Chop up the ramp into line
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 6 / 25
1 Chop up the ramp into line
2 Move around the anchors to
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 6 / 25
1 Chop up the ramp into line
2 Move around the anchors to
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 6 / 25
1 Chop up the ramp into line
2 Move around the anchors to
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 6 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 7 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 7 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 7 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 7 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 7 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 7 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 7 / 25
1Why are quadratics common? Energy/cost are quadratic (K = 1 2mv 2, P = I 2R...) 2You’ll see linearization ALL the time in engineering Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 8 / 25
1 Assume F is approximately quadratic1 (so f = F ′ approx. linear) 1Why are quadratics common? Energy/cost are quadratic (K = 1 2mv 2, P = I 2R...) 2You’ll see linearization ALL the time in engineering Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 8 / 25
1 Assume F is approximately quadratic1 (so f = F ′ approx. linear) 2 Guess some x0 intelligently 1Why are quadratics common? Energy/cost are quadratic (K = 1 2mv 2, P = I 2R...) 2You’ll see linearization ALL the time in engineering Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 8 / 25
1 Assume F is approximately quadratic1 (so f = F ′ approx. linear) 2 Guess some x0 intelligently 3 Repeatedly solve linear approximation2 of f = F ′:
1Why are quadratics common? Energy/cost are quadratic (K = 1 2mv 2, P = I 2R...) 2You’ll see linearization ALL the time in engineering Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 8 / 25
1 Assume F is approximately quadratic1 (so f = F ′ approx. linear) 2 Guess some x0 intelligently 3 Repeatedly solve linear approximation2 of f = F ′:
1Why are quadratics common? Energy/cost are quadratic (K = 1 2mv 2, P = I 2R...) 2You’ll see linearization ALL the time in engineering Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 8 / 25
1 Assume F is approximately quadratic1 (so f = F ′ approx. linear) 2 Guess some x0 intelligently 3 Repeatedly solve linear approximation2 of f = F ′:
1Why are quadratics common? Energy/cost are quadratic (K = 1 2mv 2, P = I 2R...) 2You’ll see linearization ALL the time in engineering Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 8 / 25
1 Assume F is approximately quadratic1 (so f = F ′ approx. linear) 2 Guess some x0 intelligently 3 Repeatedly solve linear approximation2 of f = F ′:
1Why are quadratics common? Energy/cost are quadratic (K = 1 2mv 2, P = I 2R...) 2You’ll see linearization ALL the time in engineering Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 8 / 25
1 Assume F is approximately quadratic1 (so f = F ′ approx. linear) 2 Guess some x0 intelligently 3 Repeatedly solve linear approximation2 of f = F ′:
4 ...Profit? 1Why are quadratics common? Energy/cost are quadratic (K = 1 2mv 2, P = I 2R...) 2You’ll see linearization ALL the time in engineering Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 8 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 9 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 9 / 25
1 Fully multivariate Newton-Raphson:
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 9 / 25
1 Fully multivariate Newton-Raphson:
2 Newton coordinate-descent Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 9 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 10 / 25
1 Take x1, use it to minimize F, holding others fixed Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 10 / 25
1 Take x1, use it to minimize F, holding others fixed 2 Take y1, use it to minimize F, holding others fixed Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 10 / 25
1 Take x1, use it to minimize F, holding others fixed 2 Take y1, use it to minimize F, holding others fixed 3 Take x2, use it to minimize F, holding others fixed Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 10 / 25
1 Take x1, use it to minimize F, holding others fixed 2 Take y1, use it to minimize F, holding others fixed 3 Take x2, use it to minimize F, holding others fixed 4 Take y2, use it to minimize F, holding others fixed Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 10 / 25
1 Take x1, use it to minimize F, holding others fixed 2 Take y1, use it to minimize F, holding others fixed 3 Take x2, use it to minimize F, holding others fixed 4 Take y2, use it to minimize F, holding others fixed 5 . . . Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 10 / 25
1 Take x1, use it to minimize F, holding others fixed 2 Take y1, use it to minimize F, holding others fixed 3 Take x2, use it to minimize F, holding others fixed 4 Take y2, use it to minimize F, holding others fixed 5 . . . 6 Cycle through again Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 10 / 25
1 Take x1, use it to minimize F, holding others fixed 2 Take y1, use it to minimize F, holding others fixed 3 Take x2, use it to minimize F, holding others fixed 4 Take y2, use it to minimize F, holding others fixed 5 . . . 6 Cycle through again
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 10 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 11 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 11 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 11 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 11 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 11 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 11 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 12 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 12 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 12 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 12 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 12 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 13 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 13 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 14 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 14 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 15 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 15 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 16 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 17 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 17 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 17 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 17 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 17 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 17 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 18 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 18 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 18 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 18 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 18 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 18 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 18 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 19 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 19 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 19 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 19 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 19 / 25
3Equivalent to complex-differentiability: f ′(x) = lim h→0
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 20 / 25
3Equivalent to complex-differentiability: f ′(x) = lim h→0
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 20 / 25
3Equivalent to complex-differentiability: f ′(x) = lim h→0
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 20 / 25
3Equivalent to complex-differentiability: f ′(x) = lim h→0
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 20 / 25
3Equivalent to complex-differentiability: f ′(x) = lim h→0
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 20 / 25
3Equivalent to complex-differentiability: f ′(x) = lim h→0
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 20 / 25
3Equivalent to complex-differentiability: f ′(x) = lim h→0
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 20 / 25
3Equivalent to complex-differentiability: f ′(x) = lim h→0
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 20 / 25
3Equivalent to complex-differentiability: f ′(x) = lim h→0
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 20 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 21 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 21 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 21 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 21 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 21 / 25
4If n k=0 an−kxk = 0 then |x| ≤ 2 maxk
k
CS 61A/CS 98-52 22 / 25
4If n k=0 an−kxk = 0 then |x| ≤ 2 maxk
k
CS 61A/CS 98-52 22 / 25
4If n k=0 an−kxk = 0 then |x| ≤ 2 maxk
k
CS 61A/CS 98-52 22 / 25
4If n k=0 an−kxk = 0 then |x| ≤ 2 maxk
k
CS 61A/CS 98-52 22 / 25
4If n k=0 an−kxk = 0 then |x| ≤ 2 maxk
k
CS 61A/CS 98-52 22 / 25
4If n k=0 an−kxk = 0 then |x| ≤ 2 maxk
k
CS 61A/CS 98-52 22 / 25
4If n k=0 an−kxk = 0 then |x| ≤ 2 maxk
k
CS 61A/CS 98-52 22 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 23 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 23 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 23 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 23 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 23 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 24 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 24 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 24 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 24 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 24 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 24 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 24 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 24 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 25 / 25
Mehrdad Niknami (UC Berkeley) CS 61A/CS 98-52 25 / 25