Source/New Derivatives and Integrals

From J Wiki
Jump to: navigation, search

As an experiment in understanding/modifying the J source I propose the following exercise:

Professor John Randall has suggested extending the table of derivatives and integrals encoded in the J source.

You (y'all) can try to implement the new derivatives and integrals, including the changes in the associated test scripts targeting the changes in the code.

For example, John has suggested that 4&o. d. 1 should be % 4&o. .  To implement this, modify file cd.c, function jtdiffamp0 , in the case CCIRCLE section, add the case (between case 3 and case 5):

case 4: R hook(ds(CDIV),w);

After you rebuild, you should get the desired result:

   4&o. d. 1
% 4&o.

And you should add some new assertions in the test script gddot.ijs:

4&o. d. 1 equ (% 4&o.)
1e_6 > | (4&o. d. 1 - 1e_6&(4&o."0 D: 1)) 2 3 ?@$ 0

Originally posted to the Jsource Forum on 2011-03-06 by Roger Hui.