Join StudySoup for FREE

Get Full Access to
UA - MATH 300 - Class Notes - Week 10

Description

Reviews

3/29/2016Don't forget about the age old question of How can you determine relationships between two variables?

Head start on Project 2

Matlab:

F = at x 1 / (1 + 4*x^ 2)j

N = 10j i = [0:n]j

We also discuss several other topics like What is an organizational cognition?

% equally spaced points

X = -1 + 2* i / nj y = f(x)j nx = length(x)

The basic interpolation is: Lagrange

x

X0 x1 x2

y

Y0 y1 y2

Basic: P(x1) = y1 = f(x1)We also discuss several other topics like Describe the characteristics of a moon jellyfish?

If you want to learn more check out What are unattainable and therefore discouraging to most employees?

Hermite: P(x) = y1 = f(xi) - this will be a higher degree

The hard part is coding the lagrange polynomialsIf you want to learn more check out What were the consequences of a single global economy?

P(a) = yi Li(a) li(a) = If you want to learn more check out synaptic knob

% Graphing points

Xx = [-1: 0.01:1]; nxx = length(xx)j

For k = 1:nxx

A = xx (k);

%Good(k) = P(a) = P(xx(k))

Pa = 0;

For i = 1:nx

Ax = a-x;

J = [1:i - 1, i + 1:nx];

Li = prod(ax(j)./(x(i) - x(j)))

Pa = Pa + y(i)*Li

end(k) = Pa;

plot(x,y,’*’,xx,f(xx),’r’,xx,pp,’b’)

Note:

A = (x0)then ax = a - x = (a - x0) vector in Matlab

(x1) (a - x1)

(...) (,... )

- This is showing that we assume out function approximation will always get better as we increase the degree, but that’s not the case

Part 2 is the same code, but you use Chebyshev nodes (but the part (III) of both of these part 1 and 2 are different

% Chebyshev Nodes

X = cos((2*i + 1)*Pi)/(2*n + 2))i

Note: for n = 10, the function and polynomial look to be about the same

**the way the points are spaced makes a huge difference

For Chebyshev nodes, increasing the n values actually does improve the approximation polynomial

Up to a certain point / number of n then it will diverge from the function

**There may be something wrong with his code, or it’s just the error when you enter n = 1000 for Chebyshev nodes

Most likely it is the error because the polynomial

Error is shown below and it is fine at n = 500

norm(f(x).PP(x))

Example of Hermite Polynomial in book

x

x0

...

xn

y

C10

...

Cn0

y1

C11

...

Cn1

P(x) =C10Ai(x) + Ci1Bi(x)

Ai(xj) = Fis Fis = 1 if i = j

A1(xj) = 0 0 if ij

B1(xj) = 0

Bj(xj) = 0

**Note: you do not have to use this form, you can look Lpn easier one online

Ai(x) = [1 - 2(x - xi)li1(xi)li2(x)

Bi(x) = (x - xi)li2(x)

How do we get li1(x). Take the derivative of li(x)

Example:

l0(x) =

(x) = [(x - x1) + (x - x2)

X

Y

y1

X0

Y0

yi

X1

Y1

yi

X2

Y2

y2i

3/31/2016

Hermite Polynomial in Matlab

P(x) = yiAi(x) + yi1Bi(x) li(x) =