Jupyter notebook 2015-09-15-214225.ipynb
Arwa Ashi
MATH 640 Homework 1:
The Euclidean norm of an n−dimensional vector x is defined by:
implement a robust routine for computing this quantity for any given input vector x. Your routine should avoid overflow and harmful underflow.
A straight forward implementation potentially will result in errors in the computation.
A more robust implementation can be coded.
Find vectors that behave differently in the two implementations.
Discucc why you coded the robust implementation the way that you did.
Compare both the accuracy and performance of your robust routine with a more straight forward naive implementation.
the robust routine gives the exactly correct result for nearly the Euclidean norm (straight forward naive implementation)
the accuracy of the robust routine is close to the true solution
How much performance does the robust routine sacrifice?
the robsust routine is a well-condition since the relative change in the input data causes a resonably commensurate relative change in the solution.
Straight Forward Norm = 14.282856857085701
RobustNorm = 14.283108908427463
Can you devise a vector that produces significantly different results from the two routines?
vector x = np.arange(n) + 0.0001 for some k and the exp function will help to reduce the overflow and underflow.
The polynomial has the value zero at x = 1 and is positive elsewhere. The expanded form of the polynomial:
is mathematically equivalent but may not give the same results numerically.
Compute and plot the values of this polynomial, using each of the two forms, for n equally spaced values on the interval [1−a,1+a], where a ∈ (0,0.01).
Document some cases including the case where a = 0.005 and n = 101.
Be sure to scale the plot so that the values of x and for the polynomial use the full ranges of their respective axes.
Can you explain the behavior? has the value zero at x = 1 and is positive elsewhere. However, has the value zero at x = 0 and it is well-condition.
Write a program to generate the first n terms in the sequence given by the difference equation:
with starting values and Explore the value n. The exact solution is a monotonically increasing sequence converging to 6.
Document a plot of the sequence values for n > 20. Can you explain the results? The exact solution for the sequence is a monotonically increasing sequence converging to 6 and this happen for k 14. For k > 14 the sequence converges to 100 which can be assume as a roundoff error in the calculation appears to have rapidly amplified and severely contaminated the solution. This is an indication of numerical instabitily.
let change the value of from to
The solution converge to 100. This implies that the solution is highy sensitive to and . So, the mathematical problem is ill-conditioned and the numerical algorithm is unstable.