The Manipulations Of Bilinear Sequences By Macsyma 2.2

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 - 1st released: 5/2/98, Revised:5/2)


Abstract

This paper describes the algebra of bilinear sequences and its manipulations by a symbolic algebra package called Macsyma 2.2. Macsyma was chosen purely because it has a very rich set of functions which can be called upon to manipulate these sequences. A bilinear sequence is defined as a sequence which hosts two independent sets of numerator sequences which are identically ordered as these share the same ordered variables in the denominators. The general form is to present the coefficient pairs in list format with their functional relation separately predefined. For examples, the two numerator sequences can form linear sequence product, sum, difference or even operations which cannot be modelled using conventional arithmetic operations.


1. Introduction

Sequence algebra is intuitive since one can find applications in several real world problems. It originated from the theory of z-transform which was already successfully used by applied scientists in sampled-data control systems and impulse signal analyses for decades [1]. The author found it odd that textbooks on discrete mathematics tended to give emphasis on generating functions by the Euler's form rather than the z-tranform formulation [2,3]. Some new operations will need to be defined since these cannot be modelled by limiting oneself to the use of conventional arithmetic operations.


2. Definition Of Bilinear Sequence

A Bilinear Sequence is defined to take the general form given by equation (1):

Bilinear_seq:makelist([a(i),b(i)]/z^i,i,1,4);

.................................a(1) b(1).....a(2) b(2)....a(3) b(3).....a(4) b(4)
....Bilinear_seq := [[----, ----], [----, ----], [----, ----], [----, ----]].................(1).
....................................z....z.............2....2.........3......3..........4.....4
.......................................................z....z.........z......z..........z.....z

The reason for adopting the list format for individual pair of numerator coefficients is to ensure that these are order-sensitive. This is because the two sequences are taken as independent, i.e., A=[a(1),a(2),....] and B=[b(1),b(2),....]. The ordering of terms is controlled entirely by the denominator z-order variables which are shared by the two numerator seuqences in the denominators. Unless otherwise stated, it is assumed the order shall be conserved in sequence manipulations.

Methods of accessing array elements of the two numerator sequences and the z-order variables of the denominators are demonstrated by program lines written in Macsyma 2.2. Readers interested are advised to copy these program lines into their own symbolic softwares to witness these in actions. All manipulations are based on the bilinear sequence form given by equation (1).

(i) Accessing Elements Of A Sublist

first(Bilinear_seq);
Comments:Bilinear_seq is represented as sublists within a list. To access the first sublist, one uses the first function. Another way which is more general is to access any specific sublist using part(Bilinear_seq,k) where k is the kth sublist.

..................................a(1)..b(1)
.................................[----, ----]......................................(2a).
.....................................z......z

part(Bilinear_seq,3);
..................................a(3)..b(3)
.................................[----, ----]......................................(2b)
.......................................3......3
.....................................z......z

first(first(x1));

......................................a(1)
......................................----............................................(2c).
........................................z

denom(%);

........................................z................................................(2d).

first(first(x1));
%*denom(%);

........................................a(1).........................................(2e).

(ii) Swapping Within A Sublist

Each sublist in a bilinear sequence contains two array elements. Macsyma 2.2 has a function called ratsubst(a,b,c) which substitutes a for b in c. The example demonstrates how to swap the two elements in the third term.

x1:makelist([a(i),b(i)]/z^i,i,1,4);
Please see equation (1) for the bilinear sequence.

x2:[first(part(x1,3))*b(3)/a(3),second(part(x1,3))*a(3)/b(3)];
This line will swap the two numerator elements shown in bold fonts.

.................................b(3)..a(3)
................................[----, ----].........................................(3a).
....................................3.......3
..................................z........z

ratsubst(x2,part(x1,3),x1);
This line will substitue the affect sublist back into the third term (shown in bold fonts) in equation (3b).

....................a(1)..b(1)...a(2)..b(2)....b(3)..a(3)...a(4)..b(4)
.................[[----, ----], [----, ----], [----, ----], [----, ----]]....................(3b).
......................z......z.........2.......2.........3.......3.......4.......4
.......................................z.......z..........z.......z.......z......z

The above operation can be written as a function as follows:

swap(x1,k):=ratsubst([first(part(x1,k))*b(k)/a(k),second(part(x1,k))*a(k)/b(k)],part(x1,k),x1); .......................................................................................................................................(3c).

Equation (3c) can be written in a more intuitive form as shown in equation (3d):
.......................................first(part(x1, k))*b(k)..second(part(x1, k))*a(k)
swap(x1, k) := ratsubst([-----------------------, ------------------------], part(x1, k), x1)
...................................................a(k)................................b(k).........................................(3d).

x4:swap(x1,4);

.........a(1)..b(1)....a(2)..b(2)....a(3)..b(3)....b(4)..a(4)
.......[[----, ----], [----, ----], [----, ----], [----, ----]].....................................................(3e).
...........z......z...........2......2..........3.....3.........4......4
..............................z......z..........z.....z..........z.......z

An alternative Macsyma program line suggested by Dr. J.P.Golden of Macsyma Inc. is even more elegant.

swapp(x1,k):=substpart(reverse(piece),x1,k);
x1:swapp(x1,3);..........................................................................................(3f).

The orginal sequence in equation (3f) now has it third sublist reversed as shown in equation (3g).

....................a(1)..b(1)...a(2)..b(2)....b(3)..a(3)...a(4)..b(4)
.................[[----, ----], [----, ----], [----, ----], [----, ----]]..............................(3g).
......................z......z.........2.......2.........3.......3.......4.......4
.......................................z.......z..........z.......z.......z......z

(iii) Splitting A Bilinear Sequence Into Two Linear Sequences

Given the bilinear form in equation (1), splitting it into two linear sequences is quite straightforward. This is defined as two related functions as split_A and split_B respectively:

split_A(x1,k):=makelist(first(part(x1,k)),k,1,k);.................(4a).
split_B(x1,k):=makelist(second(part(x1,k)),k,1,k);...........(4b).

Seq_A:apply("+",split_A(x1,4));

......................a(1)...a(2)...a(3)...a(4)
......................---- + ---- + ---- + ----....................................................(4c).
........................z........2........3.......4
................................z........z.......z

Seq_B:apply("+",split_B(x1,4));

......................b(1)...b(2)...b(3)...b(4)
......................---- + ---- + ---- + ----...................................................(4d).
........................z........2........3.......4
................................z........z.......z

Although not relevent to this section, if one is interested to take the outer sequence product then simply take Seq_A*Seq_B which is a standard operation in any symbolic package.

(iv) Splicing Two Linear Sequences Back Into Its Bilinear Form

This is the exact reverse of the previous example. So we start with the two linear sequences given by equations (4c) and (4d).

Num_set1(Seq_A):=block([args:args(Seq_A)],args*map('denom,args))$
Seq_Alist:Num_set1(Seq_A);

...................................[a(1), a(2), a(3), a(4)]..........................(5a).

Num_set2(Seq_B):=block([args:args(Seq_B)],args*map('denom,args))$
Seq_Blist:Num_set1(Seq_B);

...................................[b(1), b(2), b(3), b(4)]..........................(5b).

Bilinear_seq:makelist([part(Seq_Alist,k),part(Seq_Blist,k)]/z^k,k,1,4);

...................................a(1) b(1).....a(2) b(2)....a(3) b(3).....a(4) b(4)
......Bilinear_seq := [[----, ----], [----, ----], [----, ----], [----, ----]].................(5c).
......................................z....z.............2....2.........3......3..........4.....4
........................................................z.....z.........z......z..........z.....z

(v) Filling In The Complementary DNA Sequence

This is a problem more familiar to workers in genetics. Since the two sequences of a double helix are complementary, once we know the sequence in one strand, we can work out the complementary strand based on the complementary relations of A<-->C and G<-->T. However the symbols used in the complementary sequence must be different from those in the template sequence. We use repeated characters to represent the four nucleotides in the complementary sequence as AA, CC, GG and TT. Note that Macsyma is not case-sensitive.

Seq_A:A/z+C/z^2+A/z^3+g/z^4+T/z^5+G/z^6+A/z^7+A/z^8;

.................a.....c.....a.....g......t......g......a......a
................-- + -- + -- + -- + -- + -- + -- + ---............................................(6a).
.................z.......2.....3.....4.....5.....6.......7.....8
........................z.....z......z.....z......z.......z......z

Num_set1(Seq_A):=block([args:args(Seq_A)],args*map('denom,args))$
linear_seqA::Num_set1(Seq_A);


.................[a, c, a, g, t, g, a, a].....................................(6b).

Comple_seq(linear_seqA):=ratsubst(tt,g,ratsubst(gg,t,ratsubst(cc,a,ratsubst(aa,c,linear_seqA))));

linear_seqB:Comple_seq(linear_seqA);


................[cc, aa, cc, tt, gg, tt, cc, cc]..........................(6c).

Bilinear_seq:makelist([part(linear_seqA,k),part(linear_seqB,k)]/z^k,k,1,8);

...a...cc....c...aa....a...cc.....g...tt......t...gg....g...tt......a...cc....a...cc
[[--, --], [--, --], [--, --], [--, --], [--, --], [--, --], [--, --], [--, --]].................(6d).
...z....z......2....2.....3....3.....4...4.....5....5.....6...6.....7...7.....8...8
...............z....z......z....z......z...z......z....z.....z....z......z....z.....z....z

(vi) Mathematical Functions Between Numerator Sequences

Mathematical functions can be easily defined between the two numerator sequences in the bilinear form so long as these proceed linearly on a term-by- term basis. We show here how to define the sum and the linear sequence product between the numerator sequencs based on equation (1).

x1:makelist([a(i),b(i)]/z^i,i,1,4);
summ(x1,k):=sum((first(part(x1,k))+second(part(x1,k))),k,1,4);
summ(x1,4);

..............b(1)....a(1)....b(2)....a(2)...b(3)....a(3)...b(4)....a(4)
..............---- + ---- + ---- + ---- + ---- + ---- + ---- + ----.................................(7a).
................z.........z...........2........2........3........3........4........4
.....................................z........z.........z........z.........z........z

linear_prod(x1,k):=sum((first(part(x1,k))*second(part(x1,k))),k,1,4);
linear_prod(x1,4);

............a(1) b(1)....a(2) b(2)....a(3) b(3)....a(4) b(4)
............--------- + --------- + --------- + ---------..............................................(7b).
....................2...............4................6................8
..................z...............z................z................z

3. Summary

In this paper, the bilinear sequence form is defined. Using Macsyma 2.2, some sequence operations are demonstrated by examples. The most likely applications of this form is in genetic where the double helix can be modelled as a bilinear form. Some algebraic operations such as the swap function cannot be defined using only arithmetic operations. It is obvious that as mathematics develops, existing arithmetic operators will hit its limit of expressivity so that one will have to accept that further extensions can only be obtained with the aid of modern symbolic algebra packages. Since these packages are now ported to the PC level, these are readily accessible to mathematicians. Computer aided algebraic operations are rapidly becoming the norm rather than the exception. There is justification to consider that the computer is the extension of the brains.

5. Acknowledgements

The author thanks Dr. J.P.Golden of Macsyma Inc., for his valuable advice on some of the program lines used in this paper.

4. References

Comments: Not all references in this list are directly referred in the main paper. Most are provided for readers not familiar with sequence algebra. These papers can be easily hyperlinked whilst you are in the web.

1. Luyben W.L. : Process Modeling, Simulation And Control For Chemical Engineers,1990 (second edition), International Edition, MacGraw-Hill Publishing Company, pp 402 to 404.

2. Brualdi A. Richard (1977): Introductory Combinatorics, Chapter 7, Generating Functions, North Holland, pp 127 to 139.

3. Liu C.L. (1985): Elements Of Discrete Mathematics, McGRAW-HILL INTERNATIONAL EDITIONS, computer science series, pp 290 to 295.

4. 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.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

16. Unsolved Problems In Sequence Algebra - by Huen Y.K. (date released : 6.6.97) (29.4 KBytes, 9*A4s).

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

17. 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).

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

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

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

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

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

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

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

21. 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 ).

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

30.Sequence Algebra - A Tutorial Paper - by Huen Y.K. (date released : 2.2.98, Revised 3.2.98 ) (46 Kbytes).

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