Numerical Analysis in Engineering ME 140A, Fall 2007 Midterm #2 solutions
Problem 1. Solve through separation of variables: x2 dy = dx 1 + y2 Separate the variables and integrate (1 + y 2 ) dy = y+ x2 dx (1)
y3 x3 = +c 3 3
where c is a constant of integra
Numerical Analysis in Engineering ME 140A, Fall 2007 Homework #3 Solution
By: Mohamad Nasr-Azadani mmnasr@engr.ucsb.edu October 19, 2007
Problem 1 (19.1) One can use Figures 19.3, 19.4 and 19.5 to nd Forward dierence, Backward dierence and Central dierenc
Numerical Analysis in Engineering ME 140A, Fall 2007 Homework #6 Solution
Dec 6, 2007 By: Mohamad Nasr-Azadani: mmnasr@engr.ucsb.edu
1. a) One can integrate dy = (1 + 2x) y, y (0) = 1 (1) dx using separation of variables technique. Toward this goal, we ma
Numerical Analysis in Engineering ME 140A, Fall 2008 Midterm #1 Solution
By: Mohamad M. Nasr-Azadani mmnasr@engr.ucsb.edu December 3, 2008
Problem 1 a) Since h = h(r) (only a function of r), volume of the given shape can be found as V V =
A R
h(r)dA h(r)2
Numerical Analysis in Engineering ME 140A, Fall 2008 Midterm #1
October 30, 2008
1. (10 points) Imagine a water reservoir of circular shape, with radius R = 1 km and depth h(r). There is a pollutant in the water with concentration c(r). a) Which integral
Numerical Analysis in Engineering ME 140A, Fall 2007 Homework #6
Due: Thursday Dec 6, 8 am. November 29, 2007
1. (35 Points) Solve the following problem over the interval from x = 0 to x = 1 using step sizes of x =0.5, 0.25, 0.1, 0.05 and 0.025. Plot all
Numerical Analysis in Engineering ME 140A, Fall 2008 Midterm #2
November 18, 2008
Instructions Clearly indicate your nal solutions. You should show your work, but if you make a mistake make it clear that you do not want it considered.
1. (30 points) Solve
Numerical Analysis in Engineering ME 140A, Fall 2007 Final Solution
December 15, 2007
Problem 1 Use the trapezoidal rule to integrate
2 3
I=
0 0
xy dx dy
(1)
Use 3 intervals of equal size in the x-direction, and 2 intervals of equal size in the y-directio
Discrete Least Squares Approximation and
Data Fitting
Hector D. Ceniceros
Suppose that we are given the data (x1 , f1 ), (x2 , f2 ), , (xn , fN ) obtained
from an experiment. Can we nd a simple function that can appropriately
t these data? Suppose that e
Numerical Dierentiation
Hector D. Ceniceros
1
Numerical Dierentiation
Suppose f is a dierentiable function. We would like to approximate f (x0 )
given values of f at x0 and at neighboring points x1 , x2 , ., xn . We could
approximate f by its interpolatin
Computer Arithmetic
Hector D. Ceniceros
1
Floating Point Numbers
Floating point numbers are based on scientic notation in binary (base 2).
For example
(1.0101)2 22 = (1 20 + 0 21 + 1 22 + 0 23 + 1 24 ) 22
1
1
= (1 + + ) 4 = 5.2510 .
4 16
We can write any
Hermite Interpolation
Hector D. Ceniceros
Let Pk be the interpolation polynomial of degree at most k which interpolates f at the nodes x0 , x1 , . . . , xk . Consider the remainder or error
r(x) = f (x) Pk (x).
(1)
It has k + 1 zeros (x0 , x1 , . . . , xk
Introduction to Numerical Analysis
Hector D. Ceniceros
1
What is Numerical Analysis?
This is an introductory course of Numerical Analysis (NA). But what is NA?
In 1964, P. Henrici denes it as the theory of constructive methods in mathematical analysis. An
Convergence and Accuracy of Polynomial
Interpolation
Hector D. Ceniceros
From the Cauchy Remainder formula
(1)
f (x) Pn (x) =
1
f (n+1) (x)(x x0 )(x x1 ) (x xn )
(n + 1)!
and the examples in the rst homework, it is clear that the accuracy and
convergence
Least Squares Approximation
Hector D. Ceniceros
1
Least Squares Approximation
Let f be a continuous function on [a, b]. We would like to nd the best
approximation to f by a polynomial of degree at most n in the L2 notm. We
have already studied this proble
Problems: Computer Arithmetic and Round-o
Errors 1
1. Consider a reduced system where oating point numbers are represented in binary
as S 2E where S = 1.b1 b2 and the exponent can only be 1, 0, 1. (a) How many
numbers can this system represent? (b) Displa
Piece-wise Linear Interpolation and Splines
Hector D. Ceniceros
1
Piece-wise Linear Interpolation
One way to reduce the error in linear interpolation is to divide [a, b] into
small subintervals [x0 , x1 ], ., [xn1 , xn ]. In each of the subintervals [xj ,
Problem 5 Part C
In the solving.m file of solving a matrix
clc
clear
%Matrixs A from part b
A = [1 1 1 1 1;-2 -1 0 1 2;2 1/2 0 1/2 2;-8/6 -1/6 0 1/6 8/6 ;
16/24 1/24 0 1/24 16/24; ];
%Vector b of the output
b = [0;0;0;2;0];
%Solving for a vector of C0 to
Problem 3 Part (b)
Code Used for this problem is presented below:
clc
clear
dx=0.01;
%Value dx
x=0:dx:2;
%x increasing from 0 to 2 with increament by dx
y= x.^3/6-x.^2/2; % expression of y
yderiv= x-1;
% Analysitical expression of y
yderivest=(y(3:end)-2*
Problem 3: Part (a) Eulers forward method with h = 0.25
In Forwad_Euler.m m-file,
Ts = 100;
% in seconds
h = 0.25;
% step size
N= Ts/h;
% number of steps to simulate
x=zeros(2,N);
% prelocating
t = zeros(1,N);
% prelocating
x(1,1)= 0;
% initial condition
Approximation of Periodic Functions
Hector D. Ceniceros
1
Approximation by Trigonometric Polynomials
We now consider the problem of approximating a periodic function f . Without loss of generality we can assume that f is of period 2 (if it is of period
p
Study Problems for the Midterm, Math 104 A
1
Instructor: Prof. Hector D. Ceniceros
1. Consider the data (0, 1), (1, 3), (2, 7). Let P2 (x) be the polynomial of degree at most
two which interpolates these points.
(a) Find the Lagrange form of P2 (x).
(b) F
Numerical Analysis in Engineering ME 140A, Fall 2007 Homework #2 Solution
By: Mohamad Nasr-Azadani mmnasr@engr.ucsb.edu October 18, 2007
Problem 1 (18.2) a) The given integral can be solved analytically as following:
8
I
=
0
0.0547x4 + 0.8646x3 4.1562x2 +
Numerical Analysis in Engineering ME 140A, Fall 2007 Homework #3
Due: Tuesday Oct 23, 8 am.(Note the due date !) (Drop HWs in the assigned box outside CAD lab) October 17, 2007
Reminder First midterm on thursday, 25th October during class time. Open book
Numerical Analysis in Engineering ME 140A, Fall 2007 Homework #4
Due: Thursday Nov 8, 8 am. (Drop HWs in the assigned box outside CAD lab) November 1, 2007
1. Consider the rst order linear equation ( is a non-zero constant) dy = 1 y, dt y (0) = 0. (1)
a)
Numerical Analysis in Engineering ME 140A, Fall 2007 HW #4 solutions 1. Problem 1. Consider the rst order linear equation SOLUTION: y+ Multiply with an integrating factor (t) : y + Add and subtract y (y + y ) + ( Need ( ) = 0 y = )y = t + c1
t
dy =1y dt
Numerical Analysis in Engineering ME 140A, Fall 2007 Homework #5
Due: Thursday Nov 15, 8 am. November 8, 2007
Consider the logistic dierence equation: un+1 = un (1 un ). (1)
1. For = 3.2 plot the solution for the initial conditions u0 = 0.2, 0.4, 0.6 and
Numerical Analysis in Engineering ME 140A, Fall 2007 Homework #5 Solution
November 14, 2007 By: Mohamad Nasr-Azadani: mmnasr@engr.ucsb.edu
1. For the given value of = 3.2, the solution of logistic dierence equation will converge to a steady 2-cycle behavi
Numerical Analysis in Engineering ME 140A, Fall 2008 Midterm #2 Solution
By: Mohamad M. Nasr-Azadani mmnasr@engr.ucsb.edu December 3, 2008
Problem 1 Using separation of variables, the given ODE can be re-arranged as y 2 dy = 2dx . x (1)
Integrating both s
Problem 1 a) Volume of the given shape can be found as
1 1
V =
0 1
h(x, y)dxdy
(1)
Note that h(x, y)dxdy is the dierential volume of a rectangular cube of dimensions dx, dy and h(x, y). b) Total mass the given shape can be found as
1 1 1 0 h(x,y)
M=
0
(x,