numeric approximation
- Subject: numeric approximation
- From: Edwin Woollett
- Date: Tue, 07 Feb 2012 19:50:00 -0000
On Feb. 7, 2012, I wrote:
------------------------------------
(%i1) load(nint);
(%o1) "c:/work2/nint.mac"
(%i2) g : 1/(sin(x)^2 + log(x))$
(%i3) f(t) := nint(g,x,1,t)$
(%i4) f(5);
(%o4) 2.729767710374242
(%i5) goutL;
(%o5) [[qag,2.729767710374242,3.3769724748722686E-12,93,0]]
--------------------------------
then one can make a table, for example:
(%i6) ntable (func, x0, dx, xf):=
block([nL, fL, nfL, jj, ii],
nL : makelist (zz, zz, x0, xf, dx),
fL : map ('func, nL),
nfL : makelist ( [" ", nL[jj], " ", fL[jj] ], jj, length(nL)),
for ii thru length (nfL) do apply ('print, nfL[ii]))$
(%i7) ntable ( 'f, 2, 2, 10)$
2 0.80395247146645
4 2.307860373006648
6 3.188145387618254
8 4.049252091167718
10 4.843537149824256
(%i8) time(%);
(%o8) [1.64]
----------------------------
Ted Woollett