1.
Linear
equationsystem
We
are going to solve the linear equationsystem Ax=b In Matlab:
a)
Count the
vector x with matlab
b)
Count the
residual vector r=b-Ax with matlab
c)
Why is the
residual vector r not exactly 0(zero)?
2.
Non-linear scalar equation with Newtons method
We want to determine the two positive roots to the
equation f(x)=0 where
with
a relative inaccuracy less than 10^-8.
ß relative inaccuracy (relative wrongness?).
a)
How can
you with paper, pen and non-graphicwriting calculator roughly localize the two
positive roots?
b)
Display
now the function f(x) in matlab in two separate windows. In the first part
window, f(x) should be displayed within the interval [0,a] where a is chosen so
the smaller of the two roots is visible(you should be able to see 1-2 digits in
the root). In the second part window, display f(x) in a bigger interval [0,A]
so the bigger root of the two roots is visible. Use the subplot commando
subplot(2,1,j) to display the j-th part window. Both graphs should have
suitable names.
c)
Then write
matlab code to determine the roots carefully with Newton method
Also let the program write as much intermediate results that you can answer
these:
d)
Which are
the roots?
e)
How is quadratic
convergence defined for an iterative method for equation solutions?
f)
How can we
see quadratic convergence in our printing? (Easiest to see in the bigger
root)
g)
How do you
check that the relative inaccuracy is small enough in your calculated
roots-approximations?
h)
Does the
function have any negative roots? If so, how many? (Don’t forget to motivate
the answers)
3.
Same
non-linear scalar equation with secant method
Determine
the two positive roots of the equation (f(x) in the previous assignment) with
secant method.
a)
What are
the roots? Are they same?
b)
Do you
have quick and regular convergence?
c)
Is your convergence
quadratic? Is it linear?
d)
Does your
convergence match/suit the theory for the method?
e)
Which of
the methods do you prefer? Why?
4.
Interpolation
and linear least squares method
The
table below displays the amount of time the sun is expected being up in
Stockholm during different days in 2020. (First column is number of hours,
second column is number of minutes and third column is the date),
We are now going to do some adaptations to these datas, with both
interpolation and least square method, to
1)
Calculate
the adaptations largest value and for which ‘’x-value’’ this occurs
2)
Calculate
the adaptations value for Christmas eve(Swedish Christmas eve), 24/12
3)
Plot how
the adaptation looks like for the whole year, together with all given points.
The different adaptations that should be done:
A)
An
interpolation polynomial that passes through every point.
B)
‘’Piece by
piece’’ linear interpolation through every point.
C)
Splines-approximation
through every point.
D)
A
quadratic polynomial that only uses data from 1 jun to 1 aug.
E)
A least
square adapted quadratic polynomial that only uses data from 1 apr to 1 sep.
F)
A least
square adapted quadratic polynomial that only uses data from 1 jan to 31 dec.
G)
The
function y = c1 + c2*cos(w*x) + c3*sin(w*x) least square adapted from 1 jan to
31 dec, where w=2*pi/365 (ie one year periodic time).
H)
Which
adaptation did you find was the best? Does it depend on which part of the curve
you were interested in?
I)
If we
represent the coefficients with c_i for the polynomials
y(x)=c_1+c_2*x+c_3*x^2+….
and
y(x)=c_1+c_2*cos(w*x)+c_3*sin(w*x)+…
Which ‘’run-up’’ needed to calculate the most coefficients?
Which ‘’run-up’’ needed the least amount coefficients?
Four of the ‘’run-ups’’ needed three coefficients, which one or ones did you
find was the best? Did the best one/ones depend on what you had to calculate?
In these questions, it is difficult to define the correct answer; the important
thing is to be able to motivate your opinion. You should be able to show the
teacher that you understand and know which method should be used in different
situations.
Get Free Quote!
260 Experts Online