CS 261 Midterm Exam November 9, 2011
This exam is worth 50 points.
This exam has 1 problem with 5 parts on 1 numbered page. All parts are equally
weighted.
You have 50 minutes to complete this exam. Please read all instructions carefully, and check
your a
assign7sol.txt
%=
Assignment 7 Code for Cubic Spline
%=
function [a,b,c,d]=ncs(x,a)
%Natural Cubic Spline
%input n values x and a is the vector f(x)
%output the n-1 coefficients for the cubic polynomials
%
a, b,c,d
n=length(x);
h=zeros(n-1,1);
alpha = zer
Mi In M
CG-{Ah 55) m (errFYre
éréif,
by MW-47v 0% 5' >9 rm cf 33;,
By awn/La M km
W _ (quo) A X'E/i1) = Sf! (-r) A _
lgFin
/
707/33: 33h (0")th(11/3/
£67,
Sfih( (ft): Snla) Sni't]
7 0:7:F Sh )3; X1 va 7th ><2\"I- /tw
55M (2 22,» ; -4_. New urn/aka CL/wj
W
Math 261 Fall 2011
The Bisection Method
Suppose that we would like to estimate the root of the function f (x) between x = a and x = b
using the bisection method. We can implement this in MATLAB (or OCTAVE) as follows. First
create a le named f.m whose con
Math 261 Fall 2011
Solutions to Assignment #4
The following four algorithms are used to implement the bisection method, Newtons method, the
secant method, and the method of false position, respectively. In order to apply these algorithms,
an extra le name
Math 261 Fall 2011
Solutions to Assignment #1
Suppose that f (x) =
1
1 x2 so that = 4
f (x) dx. Thus, in order to approximate , we will
0
approximate
1
f (x) dx
()
0
and multiply by 4.
(a) Using n partition points, we nd the left-hand Riemann sum (LHS) ap
assign8.txt
Computer Science/Mathematics 261 Assignment 8 Solutions
Question 1.
Matlab Octave Code
function A = relax4(r,c,m)
% create an rXc matrix with 1 top and boundary = 1
% zeros on the left and right boundary
% with 1's in the corners
% relax the i
Math 261 Midterm Exam November 9, 2011
This exam is worth 50 points.
This exam has 1 problem with 5 parts on 1 numbered page. All parts are equally
weighted.
You have 50 minutes to complete this exam. Please read all instructions carefully, and check
your
Computer Science 261 Final Exam
Wednesday, December 14, 2011
This exam is worth 150 points.
This exam has 9 problems on 3 numbered pages.
You have 3 hours to complete this exam. Please read all instructions carefully, and check
your answers. Use the exam
Math 261 Fall 2011
Solutions to Assignment #6
1. You can check your answers with mine. On OCTAVE, one gets
> format long
> rand(seed,123456789)
> y=secret(BUBBLEGUM,6)
ans y = 369789376274 369790779302 369795773986 369808264640 369833872346 369880145434
Y
Mathematics 261 Final Exam December 14, 2011
This exam is worth 150 points.
This exam has 9 problems on 3 numbered pages.
You have 3 hours to complete this exam. Please read all instructions carefully, and check
your answers. Use the exam booklet for all
CS 261 Fall 2011
Solutions to Assignment #5
1. The following commands load the data and create separate vectors for x and y.
load data.m
x=data(:,1)
y=data(:,2)
Note that if you are using MATLAB, you want to load data.mat instead. Now dene xbar and
ybar t
Math 261 Fall 2011
Solutions to Assignment #5
1. The following commands load the data and create separate vectors for x and y.
load data.m
x=data(:,1)
y=data(:,2)
Note that if you are using MATLAB, you want to load data.mat instead. Now dene xbar and
ybar
CS 261 Fall 2011
Solutions to Assignment #6
1. You can check your answers with mine. On OCTAVE, one gets
> format long
> rand(seed,123456789)
> y=secret(BUBBLEGUM,6)
ans y = 369789376274 369790779302 369795773986 369808264640 369833872346 369880145434
You