Manipulations Of Nested Lists In Sequence Algebra

by

Huen Y.K.

CAHRC, P.O.Box 1003, Singapore 911101
http://web.singnet.com.sg/~huens/
email: huens@mbox3.singnet.com.sg

(A short communication - 26/2/98)

Abstract

Few symbolic packages offer intrinsic functions for manipulating lists with deeply nested levels. This paper shows how one could write one's own function using Macsyma 2.2.1. Multiply nested lists can be used to access and manipulate multidimensional array elements which suggest many potential applications. This paper only presents the programming lines and demonstrates output results but avoids any discussions on potential applications.


1. Mutiply Nested Lists

(i) Linear lists


To access terms in the 1-dimensional list, an intrinsic function from Macsyma called part(exp,i) is used. The part function makes it possible to reference or replace any part of any expression. However, in multiply nested lists, the part function is also nested which makes its usage in the present paper different from the original objective set down by the developer. In equation (1b), we defined partx1(x1,i) to be equal to part(x1,i). The order of list elements is determined by the power indices of f(i). Accessing the 3rd term of the list is shown in equation (1c).

partx1(x1,i):=part(x1,i)$.....................................................(1b).
partx1(x1,3);

(ii) 2-level nested lists

Take x as the first level list and y and the second level list. We can think of x as representing row i of a matrix and y as the column j of a matrix. Therefore to access any (i,j)th term, we use a defined function called partx2(x2,i,j) as shown in equation (2b). We thus make indices i,j,k... follow the orders of x,y,z,... .



To access terms in the 2-dimensional list, partx2 function is defined as shown in equation (2b) and a demonstration of accessing the last term is shown in equation (2c).

(ii) 3-level nested lists

x3:makelist(1/x^f3(k)*makelist(1/y^f2(j)*makelist(1/z^f1(i),i,1,3),j,1,3),k,1,3);


To access terms in the 3-dimensional list, partx3 function is defined as shown in equation (3b) and a demonstration of accessing the last term is shown in equation (3c).

partx3(x3,i,j,k):=part(part(part(x3,i),j),k)$.......................(3b).
partx3(x3,3,3,3);

2. Summary

This short paper shows you could establish a multiply nested list which could be adapted to represent a multidimensional matrix so that arrayed elements can be easily accessed and manipulated.

3 References

1. Sequence Algebra - A Tutorial Paper - Huen Y.K. (Date Released 2/2/98, 46 Kbytes)

================================================
2. Macsyma: Symbolic/numeric/graphical mathematics software, Mathematics and System Reference Manual, 16th edition, relevant sections.

Published Papers:

3. Huen Y.K.: A Matrix Map for Prime and Non-prime Numbers, INT. J. Math. Educ. Sci. Technol., 1994, VOL. 25, NO.6, pp 913-920.

4. Huen Y.K.: Some Interesing Properties Of The Natural Number System, Int. J. Math. Educ. Sci. Technol., 1996, VOL.27, NO. 5, 685-691.

5. Huen Y.K.: Visual algebra and its applications, INT. J. Math. Educ. Sci. Technol., 1997, VOL.28, NO.3, pp 333-344.

6. Huen Y.K.: The twin prime problem revisited, INT. J. Math. Educ. Sci. Technol.,1997, VOL.28, NO. 6, pp 825-834.

7. Huen Y.K.: Is Pie Periodic?, INT. J. Math. Educ. Sci. Technol.,199?,VOL.??,NO.?,???-???. (in the press).

8. Huen Y.K.: Final value theorem in number sequences., INT. J. Math. Educ. Sci. Technol.,199?,VOL.-??,NO.?,???-???. (accepted).

Papers posted in this website.

Comments: References from this point onward are not referred in the main paper. Most are provided for readers not familiar with sequence algebra. These papers can be easily hyperlinked whilst you surf into this URLsite.

9. A Simple Introduction To Sequence Algebra - by Huen Y.K. (date release: 15.3.97) (38 KBytes, 11*A4 pages).

========================================================

10. Evaluations Of Normc( ) Function In Macsyma 2.2 - Huen Y.K. (Date Released 17/12/97, 14 Kbytes)

================================================

11. List Processing In Sequence Algebra - Huen Y.K. (Date Released 23/12/97, 20 Kbytes)

================================================

12. The Canonical Generating Function or CGF(z) ... - by Huen Y.K. (date released : 27.5..97) (24 KBytes, 7*A4s).

========================================================

13. Visual Solutions Of Number Theoretic Problems ..... - by Huen Y.K. (date released : 3.6.97) (38.3 KBytes, 10*A4s).

========================================================

14. Final Value Theorem Applied To Number Sequences... - by Huen Y.K. (date released : 5.6.97) (29.4 KBytes, 9*A4s).

========================================================

15. Methods Of Developing Sequence Algebraic Formulations For Comp(z) and Prime(z) - by Huen Y.K. (date released : 20.6.97) (36.8 KBytes, 10*A4s).

========================================================

16. Composite Number Sequence Challenge 1/97 - by Huen Y.K. (date released : 28.6.97) (24.8 KBytes, 7*A4s).

========================================================

17. Lemmata, Corollaries, And Theorems In Sequence Order Analysis. - by Huen Y.K. (date released : 6.7.97) (38.3 KBytes, 12*A4s).

========================================================

18. Improved Formulations For Comp(z) and Prime(z) - by Huen Y.K. (date released : 16.9.97) (17 KBytes ).

========================================================

19. Detecting False Reports in Primality Tests By The Oddcomp(z) Method. - by Huen Y.K. (date released : 18.9.97, Revised 20/9) (26 KBytes ).

========================================================

20. The Throwing Power Of Oddcomp(z). - by Huen Y.K. (date released : 24.9.97 ) (15 Kbytes).

========================================================

21. Sequence Algebraic Approach To Prime Number Theorem - by Huen Y.K. (date released : 28.9.97 ) (21 Kbytes).

========================================================

22. Generating Functions - Closed Forms vs Open Forms - by Huen Y.K. (date released : 1.10.97 ) (21 Kbytes).

========================================================

23. Generating Large Odd Composite With Two Prime Factors - by Huen Y.K. (date released : 3.10.97 ) (13.5 Kbytes).

========================================================

24. In Search Of Counter- Examples In Maple's Isprime Function. - by Huen Y.K. (date released : 4.10.97 ) (18 Kbytes).

========================================================

25. A Sequence Algebraist's View Of Lehmann's Primality Test - by Huen Y.K. (date released : 6.10.97 ) (26 Kbytes).

========================================================

26. On Odd(z), Oddcomp(z), Seq1(z) and Seq2(z) - by Huen Y.K. (date released : 10.10.97 ) (17 Kbytes).

========================================================

27. How To Generate A Short And Contiguous Oddcomp(z) Sequence? - by Huen Y.K. (date released : 15.10.97 ) (13 Kbytes).

========================================================

28.The Manipulations Of Bilinear Sequences By Macsyma 2.2- by Huen Y.K. (date released : 5.2.98, 22 Kbytes).

========================================================
=====================END OF PAPER ======================