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
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. P
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 polynomi
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
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 OC
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, respectivel
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
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.
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 instru
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 36979077930
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
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
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, yo
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 par