A file for simplifying fibonacci/lucas expressions



Hi,

the following file: http://baruchel.thomas.free.fr/fibsimplify.mac
implements the two functions:

  fibsimplify(expr);
  lucassimplify(expr);

for simplifying expressions involving Fibonacci/Lucas terms.
Here is an example of session:

Maxima 5.9.1 http://maxima.sourceforge.net
Using Lisp CMU Common Lisp 19a
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
This is a development version of Maxima. The function bug_report()
provides bug reporting information.
*** Reading the file maxima-init.mac *** 
(%i1) loadfile("session4.mac");

(%o1) 				 session4.mac
(%i2) load("fibsimplify.mac");

(%o2) 			        fibsimplify.mac
(%i3) c1;

	       2				      3
(%o3) 	 14 FIB (n) FIB(n + 1) + 8 FIB(n + 1) - 14 FIB (n) - 2 FIB(n)
(%i4) c1alt;

			 2
(%o4) 		   14 FIB (n - 1) FIB(n + 1) + 6 FIB(n - 2)
(%i5) fibsimplify(c1-c1alt);

			    n			  n
(%o5) 	        (7 - 7 (- 1) ) lucas(n) + (7 (- 1)  - 7) FIB(n)
(%i6) lucassimplify(c1);

		      2			        3
(%o6) 	        (7 FIB (n) + 4) lucas(n) - 7 FIB (n) + 2 FIB(n)
(%i7) c2;

			2		       3
(%o7) 	        - 30 FIB (n) FIB(n + 1) - 2 FIB (n) - 6 FIB(n)
(%i8) fibsimplify(c2);

		 3		       2	      n
(%o8) - (15 lucas (n) + 17 FIB(n) lucas (n) - 60 (- 1)  lucas(n)

								   n
						   + (30 - 68 (- 1) ) FIB(n))/5
(%i9) lucassimplify(%);

			 2		       3
(%o9) 		 - 15 FIB (n) lucas(n) - 17 FIB (n) - 6 FIB(n)
(%i10) fibsimplify(%o9-%o7);

(%o10) 				       0
(%i11) c3;

		       2	       2
(%o11)  - 20 FIB(n) FIB (n + 1) - 4 FIB (n) FIB(n + 1) - 12 FIB(n + 1)
(%i12) fibsimplify(%);

		  3		        2		     n
(%o12) - (12 lucas (n) + 32 FIB(n) lucas (n) + (30 - 48 (- 1) ) lucas(n)

								   n
						   + (30 - 28 (- 1) ) FIB(n))/5
(%i13) lucassimplify(%);

		2			   3		     n
(%o13) (- 12 FIB (n) - 6) lucas(n) - 32 FIB (n) + (- 20 (- 1)  - 6) FIB(n)
(%i14) quit();

Hope it can help you.

Regards,

-- 
Thomas Baruchel