Accuracy of numsolve in TI, CASIO
03-26-2021, 09:55 PM
Post: #2
 Albert Chan Senior Member Posts: 2,517 Joined: Jul 2018
RE: Accuracy of numsolve in TI, CASIO

Is there a general formula for estimating the step size h in numerical differentiation formulas ?

Example, estimate (ln(x))' at x=2:

lua> function D(x,h) return (log(x+h)-log(x-h))/(2*h) end
lua> for i=4,8 do print(i, D(2, 10^-i)) end
4﻿ ﻿ ﻿ ﻿ ﻿ ﻿ 0.5000000004168335
5﻿ ﻿ ﻿ ﻿ ﻿ ﻿ 0.5000000000088269
6﻿ ﻿ ﻿ ﻿ ﻿ ﻿ 0.5000000000143777
7﻿ ﻿ ﻿ ﻿ ﻿ ﻿ 0.49999999973682185
8﻿ ﻿ ﻿ ﻿ ﻿ ﻿ 0.49999999696126407

Interestingly, optimal h for this example is also about 1e-5:

At the cost of more computation, we can use bigger h, and extrapolate for slope.
(similar to Romberg's integration, extrapolate from raw trapezoids, or rectangles)

lua> h = 1e-3
lua> d1 = D(2,h)
lua> d2 = D(2,h/2)
lua> d1, d2, d2+(d2-d1)/3
0.500000041666615 ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ 0.5000000104167235 ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ 0.5000000000000929
 « Next Oldest | Next Newest »

 Messages In This Thread Accuracy of numsolve in TI, CASIO - lrdheat - 03-26-2021, 07:35 PM RE: Accuracy of numsolve in TI, CASIO - Albert Chan - 03-26-2021 09:55 PM RE: Accuracy of numsolve in TI, CASIO - robve - 03-26-2021, 10:23 PM

User(s) browsing this thread: 1 Guest(s)