--- title: "Arbitrary Functions" type: "article" slug: "arbitrary-functions" url: "http://localhost/article/arbitrary-functions/" markdown_url: "http://localhost/article/arbitrary-functions.md" published_at: "2026-11-03T10:18:23+00:00" modified_at: "2026-11-03T10:20:00+00:00" featured_image: url: "http://localhost/wp-content/uploads/2022/04/20230809-041332.jpg" excerpt: "Not all real functions can be conveniently expressed as an algebraic formula, of course. Sometimes we only have values from a graph or table that we have to integrate. In this case, we can store a function values in an array; with a 2K machine it is not unreasonable to store a function with 100…" post_tag: - name: "TS 1000" slug: "ts1000" taxonomy: "post_tag" url: "http://localhost/tag/ts1000/" model: - name: "Timex/Sinclair 1000" slug: "ts-1000" taxonomy: "model" url: "http://localhost/model/ts-1000/" publication_r: id: 10245 title: "SyncWare News" type: "periodical" url: "http://localhost/periodical/syncware-news/" volume: "1" issues_articles: - id: 38991 title: "SyncWare News v1" type: "issue" url: "http://localhost/issue/syncware-v1/" pages: "109" pubdate: "June 1983 – June 1984" archive_link: false --- # Arbitrary Functions Not all real functions can be conveniently expressed as an algebraic formula, of course. Sometimes we only have values from a graph or table that we have to integrate. In this case, we can store a function values in an array; with a 2K machine it is not unreasonable to store a function with 100 data points. The following program will integrate an arbitrary function, with resolution limited only be available memory space. After the program is a sample run illustrating a possible application. You can SAVE the program and data to tape by pressing “S” when output appears. ``` 2 SLOW 5 PRINT TAB 11;"[illegible]";TAB 10;"[illegible]" 10 PRINT ,,"NO. OF DIVS (MUST BE EVEN)="; 15 INPUT D 20 IF INT (D/2)<>D/2 THEN GOTO 15 25 PRINT D 30 DIM A(D+1) 40 PRINT "X(0)="; 50 INPUT X0 60 PRINT X0 70 PRINT "X(F)="; 80 INPUT XF 90 PRINT XF 100 PRINT ,,"INPUT FUNCTION VALUES";AT 20,0;"DIV X=","Y=" 110 FOR B=0 TO D 115 LET X=X0+(XF-X0)*B/D 120 SCROLL 130 PRINT AT 21,31;" ";AT 21,0;B;TAB 4;X;AT 21,16;"?" 140 INPUT A(B+1) 145 PRINT AT 21,16;A(B+1) 150 NEXT B 160 FAST 170 PAUSE 40000 200 LET C=0 210 LET A=0 220 LET Y=A(1) 230 LET A=Y+A 240 LET C=C+1 250 LET Y=A(C+1) 260 LET A=Y*4+A 270 LET C=C+1 280 LET Y=A(C+1) 290 LET A=Y+A 300 IF C