Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1a. How random number is generated in Matlab. C/C++, or Fortran? Write a Matlab

ID: 1716309 • Letter: 1

Question

1a. How random number is generated in Matlab. C/C++, or Fortran? Write a Matlab or C/C++ code to calculate constant Pi. Give an extra example random function that can be used.
1b. How does LONI scheduler work? State in your own words how LONI allocation works.
1c. Write a PBS script to use loni_mat_bio7 allocation with wall time 10 hours to run EXECUTE in LONI machine QB2.
1d. Prove the uniqueness of polynomial interpolation.
1e. Why do we need to use cubic spline? Write a Matlab or C/C++ to do cubic splines interpolation on the following data points: Data Point: (-2,13), (-1,5), (0,7), (1,12), (2,29). 1f. Why do we use least squares fitting? Write a Matlab or C/C++ code to do least square fitting function f(x)=x^0.7.

Explanation / Answer

1d. uniqueness of polynomial interpolation.

Suppose we interpolate through n + 1 data points with an at-most n degree polynomial p(x) (we need at least n + 1datapoints or else the polynomial cannot be fully solved for). Suppose also another polynomial exists also of degree at mostn that also interpolates the n + 1 points; call it q(x).

Consider . We know,

1.     r(x) is a polynomial

2.     r(x) has degree at most n, since p(x) and q(x) are no higher than this and we are just subtracting them.

3.     At the n + 1 data points, . Therefore r(x) has n + 1 roots.

But r(x) is an polynomial of degree n. It has one root too many. Formally, if r(x) is any non-zero polynomial, it must be writable as , for some constant A. By distributivity, the n + 1 x's multiply together to give leading term , i.e. one degree higher than the maximum we set. So the only way r(x) can exist is ifA = 0, or equivalently, r(x) = 0.

So q(x) (which could be any polynomial, so long as it interpolates the points) is identical with p(x), and p(x) is unique.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote