Skip to content

added lecture 18 #23

Merged
merged 1 commit into from
Apr 2, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
added lecture 18
rcc02007 committed Mar 30, 2017
commit 2a444b3f77e012410c12517bbc0d85f32a738cc1
Binary file added lecture_17/in-class_regression.pdf
Binary file not shown.
10 changes: 5 additions & 5 deletions lecture_17/lecture_17.ipynb
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 65,
"execution_count": 4,
"metadata": {
"collapsed": true
},
@@ -13,7 +13,7 @@
},
{
"cell_type": "code",
"execution_count": 66,
"execution_count": 5,
"metadata": {
"collapsed": true
},
@@ -2218,7 +2218,7 @@
},
{
"cell_type": "code",
"execution_count": 93,
"execution_count": 6,
"metadata": {
"collapsed": false
},
@@ -2385,7 +2385,7 @@
},
{
"cell_type": "code",
"execution_count": 94,
"execution_count": 7,
"metadata": {
"collapsed": false
},
@@ -2409,7 +2409,7 @@
},
{
"cell_type": "code",
"execution_count": 95,
"execution_count": 8,
"metadata": {
"collapsed": false
},
Binary file added lecture_18/.Newtint.m.swp
Binary file not shown.
6 changes: 6 additions & 0 deletions lecture_18/.ipynb_checkpoints/lecture_18-checkpoint.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 2
}
33 changes: 33 additions & 0 deletions lecture_18/Newtint.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
function yint = Newtint_bak(x,y,xx)
% Newtint: Newton interpolating polynomial
% yint = Newtint(x,y,xx): Uses an (n - 1)-order Newton
% interpolating polynomial based on n data points (x, y)
% to determine a value of the dependent variable (yint)
% at a given value of the independent variable, xx.
% input:
% x = independent variable
% y = dependent variable
% xx = value of independent variable at which
% interpolation is calculated
% output:
% yint = interpolated value of dependent variable

% compute the finite divided differences in the form of a
% difference table
n = length(x);
if length(y)~=n, error('x and y must be same length'); end
b = zeros(n,n);
% assign dependent variables to the first column of b.
b(:,1) = y(:); % the (:) ensures that y is a column vector.
for j = 2:n
for i = 1:n-j+1
b(i,j) = (b(i+1,j-1)-b(i,j-1))/(x(i+j-1)-x(i));
end
end
% use the finite divided differences to interpolate
xt = 1;
yint = b(1,1);
for j = 1:n-1
xt = xt*(xx-x(j));
yint = yint+b(1,j+1)*xt;
end
24 changes: 24 additions & 0 deletions lecture_18/challenger_oring.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Flight#,Temp,O-Ring Problem
1,53,1
2,57,1
3,58,1
4,63,1
5,66,0
6,66.8,0
7,67,0
8,67.2,0
9,68,0
10,69,0
11,69.8,1
12,69.8,0
13,70.2,1
14,70.2,0
15,72,0
16,73,0
17,75,0
18,75,1
19,75.8,0
20,76.2,0
21,78,0
22,79,0
23,81,0
1,882 changes: 1,882 additions & 0 deletions lecture_18/lecture_18.ipynb

Large diffs are not rendered by default.

Binary file added lecture_18/newton_interpolation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.