Consider two ways of creating n 1 equally spaced points betw

Consider two ways of creating n+ 1 equally spaced points between two numbers a and b. Call the spacing h = (ba)/ n .

a) x0 = a, xk = xk1 + h (k=1,2,...,n)

b) xk = a + kh (k=1,2,...,n)

Which is better and why? (first, do some tests in Matlab, say with a=0 and b=1, are varying n)

Solution

The method (b) is better.

In method (a) , at every stage k , a new more floating point calculations are involved.

Consider two ways of creating n+ 1 equally spaced points between two numbers a and b. Call the spacing h = (ba)/ n . a) x0 = a, xk = xk1 + h (k=1,2,...,n) b) xk

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site