# [Maxima] hgfred and generalized hypergeometric functions

Sat Apr 15 15:41:45 CDT 2006

```--=-wMwgu+bgzDahiWih8/1q
Content-Type: text/plain; charset=iso-8859-15
Content-Transfer-Encoding: 8bit

I am using Maxima 5.9.1 on Debian Linux 3.1. I have recently discovered
possible bugs in the hgfred function when applied to generalized
hypergeometric functions such as 3F2 function.
More specifically, I have compared the output of maxima with the
identities listed on functions.wolfram.com for the generalized
hypergeometric functions.

Generally, when the expressions reduce to a rational fraction,
maxima gives the correct denominator, but the numerator differs from
the formulas quoted in functions.wolfram.com except for the constant
term.

I am unsure whether these potential bugs are fixed in the more recent
versions of maxima (5.9.2/5.9.3) since I haven't seen bug reports
on the sourceforge site dealing with the generalized hypergeometric
functions.

Below is a copy of the maxima session.

Maxima restarted.
(%i1) batch(hypergeometric2);

batching #p/home/edmond/hypergeometric2
- 1	    1
(%i2) 			  HGFRED([---, 1], [-, 2], x)
2	    2
1	    1
(%o2) 			  %F    ([- -, 1], [-, 2], x)
2, 2    2	    2
5  5	    1  1
(%i3) 			 HGFRED([-, -, 3], [-, -], x)
2  2	    2  2
2
20 x	 8 x	     1
(%o3) 30 x (-------- + -------- + --------)
6	      5		 4
(1 - x)    (1 - x)	  (1 - x)

2				      2
2   30 x	    10 x        1	  12 x	      6 x	  1
+ 140 x  (-------- + -------- + --------) + -------- + -------- +
--------
7		 6	    5	        5	   4	      3
(1 - x)	  (1 - x)    (1 - x)	 (1 - x)    (1 - x)    (1 - x)
4	      3	       2
2557 x  + 1320 x  + 290 x  + 32 x + 1
(%o4) 	     - ---------------------------------------------------
7      6       5       4       3       2
x  - 7 x  + 21 x  - 35 x  + 35 x  - 21 x  + 7 x - 1
(%i5) 				   FACTOR(%)
4	      3	       2
2557 x  + 1320 x  + 290 x  + 32 x + 1
(%o5) 		    - -------------------------------------
7
(x - 1)
%
(%i6) 				       -
3
4	      3	       2
2557 x  + 1320 x  + 290 x  + 32 x + 1
(%o6) 		    - -------------------------------------
7
3 (x - 1)
5  5	    1  1
(%i7) 			 HGFRED([-, -, 3], [-, -], x)
2  2	    2  2
2
20 x	 8 x	     1
(%o7) 30 x (-------- + -------- + --------)
6	      5		 4
(1 - x)    (1 - x)	  (1 - x)

2				      2
2   30 x	    10 x        1	  12 x	      6 x	  1
+ 140 x  (-------- + -------- + --------) + -------- + -------- +
--------
7		 6	    5	        5	   4	      3
(1 - x)	  (1 - x)    (1 - x)	 (1 - x)    (1 - x)    (1 - x)
(%i8) 				  RATSIMP(%)
4	      3	       2
2557 x  + 1320 x  + 290 x  + 32 x + 1
(%o8) 	     - ---------------------------------------------------
7      6       5       4       3       2
x  - 7 x  + 21 x  - 35 x  + 35 x  - 21 x  + 7 x - 1
(%i9) 				   FACTOR(%)
4	      3	       2
2557 x  + 1320 x  + 290 x  + 32 x + 1
(%o9) 		    - -------------------------------------
7
(x - 1)
5  5	    1
(%i10) 			 HGFRED([-, -, 3], [-, 1], x)
2  2	    2
2
63 x	        7 x	      1
(%o10) 15 x (------------- + ---------- + ----------)
11/2	    9/2		 7/2
4 (1 - x)	     (1 - x)	  (1 - x)

2
2      99 x	       9 x	     1
105 x  (------------- + ----------- + ----------)
13/2	  11/2	        9/2	      2
4 (1 - x)	   (1 - x)	 (1 - x)	  35 x
+ ------------------------------------------------- + ------------
2				        9/2
4 (1 - x)

5 x	    1
+ ---------- + ----------
7/2	       5/2
(1 - x)      (1 - x)
(%i11) 				  RATSIMP(%)
4	    3	     2
5903 x  + 3458 x  + 898 x  + 128 x + 8
(%o11) ----------------------------------------------------------------
6       5        4	 3	  2
SQRT(1 - x) (8 x  - 48 x  + 120 x  - 160 x  + 120 x  - 48 x + 8)
(%i12) 				   FACTOR(%)
4	    3	     2
5903 x  + 3458 x  + 898 x  + 128 x + 8
(%o12) 		    --------------------------------------
6
8 SQRT(1 - x) (x - 1)
5  5	    1  3
(%i13) 			 HGFRED([-, -, 3], [-, -], x)
2  2	    2  2
4 x	   1	        2    5 x	 1	    3 x
(%o13) 10 x (-------- + --------) + 28 x  (-------- + --------) +
--------
5	       4		  6	     5		 4
(1 - x)    (1 - x)		   (1 - x)    (1 - x)	  (1 - x)

1
+ --------
3
(1 - x)
3       2
84 x  + 45 x  + 10 x + 1
(%o14) 		  -------------------------------------------
6	  5	  4	  3	  2
x  - 6 x  + 15 x  - 20 x  + 15 x  - 6 x + 1
(%i15) 				   FACTOR(%)
2
(4 x + 1) (21 x  + 6 x + 1)
(%o15) 			  ---------------------------
6
(x - 1)
6
(%i16) 				  % (x - 1)
2
(%o16) 			  (4 x + 1) (21 x  + 6 x + 1)
3       2
(%o17) 			   84 x  + 45 x  + 10 x + 1
5  5	    3  3
(%i18) 			 HGFRED([-, -, 3], [-, -], x)
2  2	    2  2
4 x	   1	      3 x	  1
(%o18) 	        5 x (-------- + --------) + -------- + --------
5	       4	   4	      3
(1 - x)    (1 - x)	    (1 - x)    (1 - x)
2
13 x  + 6 x + 1
(%o19) 		     - -----------------------------------
5      4       3       2
x  - 5 x  + 10 x  - 10 x  + 5 x - 1
(%i20) 				   FACTOR(%)
2
13 x  + 6 x + 1
(%o20) 			       - ---------------
5
(x - 1)
1
(%i21) 			 HGFRED([3, 3, 3], [-, 1], x)
2
[About a 1000 lines of output deleted]
- 1     5
(%i22) 		        HGFRED([---, 1, -], [2, 2], x)
2      2
1     5
(%o22) 		        %F    ([- -, 1, -], [2, 2], x)
3, 2	  2     2
- 1     5    3
(%i23) 		        HGFRED([---, 1, -], [-, 2], x)
2      2    2
2 - x				    2
3 SQRT(%PI) %I %Q      (-----)   %P	  (SQRT(1 - x)) x (x  - 1)
0, 3/2	 x	  - 2, - 2
(%o23) ------------------------------ -
----------------------------------
3/4	      1/4		        32
4 (x - 1)    (x + 1)
3/4	    1/4				  3
(%o24) - ((x - 1)    (x + 1)    (%P	   (SQRT(1 - x)) x
- 2, - 2

x - 2
- %P	     (SQRT(1 - x)) x) - 24 SQRT(%PI) %I %Q      (- -----))
- 2, - 2					  0, 3/2     x

3/4	       1/4
/(32 (x - 1)    (x + 1)	  )
- 1     5    3
(%i25) 		        HGFRED([---, 1, -], [-, 3], x)
2      2    2

SIMP2F1-WILL-CONTINUE-IN
2 - x
5 SQRT(%PI) %I %Q	    (-----) x
1				      1, 3/2   x
(%o25) 	  %F    ([- -, 1], [3], x) - --------------------------------
2, 1    2				   3/4	      5/4
48 (x - 1)    (x + 1)
- 1     5
(%i26) 		        HGFRED([---, 1, -], [3, 2], x)
2      2
1     5
(%o26) 		        %F    ([- -, 1, -], [3, 2], x)
3, 2	  2     2
(%i27) 			 HGFRED([a, b, c], [d, e], x)
(%o27) 			 %F    ([a, b, c], [d, e], x)
3, 2
(%i28) 			 HGFRED([a, b, c], [d, e], 1)
(%o28) 			 %F    ([a, b, c], [d, e], 1)
3, 2
1
(%i29) 		     HGFRED([-, b, 1 - b], [d, 2 - d], x)
2
1
(%o29) 		     %F	   ([-, b, 1 - b], [d, 2 - d], x)
3, 2  2
1	 1  3	    5  3  7
(%i30) 		      HGFRED([-, -, -, 1], [-, -, -], x)
4	 2  4	    4  2  4
1	 1  3	    5  3  7
(%o30) 		      %F    ([-, -, -, 1], [-, -, -], x)
4, 3  4	 2  4	    4  2  4
3	       5    7	  9
(%i31) 		      HGFRED([-, 1, 1, -], [-, 2, -], x)
4	       4    4	  4
3	       5    7	  9
(%o31) 		      %F    ([-, 1, 1, -], [-, 2, -], x)
4, 3  4	       4    4	  4
(%i32) 		      HGFRED([2, 2, 2, 2], [1, 1, 1], x)
4 x	       1
9 x (-------- + --------)
5	   4
(1 - x)    (1 - x)	  3 x	      1
(%o32) 8 x (------------------------- + -------- + --------)
2		       4	  3
(1 - x)	   (1 - x)

3 x	   1	      2 x	  1
+ 4 x (-------- + --------) + -------- + --------
4	       3	   3	      2
(1 - x)    (1 - x)	    (1 - x)    (1 - x)
(%i33) 				  RATSIMP(%)
3       2
85 x  + 47 x  + 11 x + 1
(%o33) 		     - -----------------------------------
5      4       3       2
x  - 5 x  + 10 x  - 10 x  + 5 x - 1
(%i34) 				   FACTOR(%)
2
(5 x + 1) (17 x  + 6 x + 1)
(%o34) 			 - ---------------------------
5
(x - 1)
5
(%i35) 				  % (x - 1)
2
(%o35) 			 - (5 x + 1) (17 x  + 6 x + 1)
(%i36) 				  RATSIMP(%)
3       2
(%o36) 			  - 85 x  - 47 x  - 11 x - 1
(%i37)
Process maxima processus arrêté

--=-wMwgu+bgzDahiWih8/1q
Content-Disposition: attachment; filename=maxima-bug
Content-Type: text/plain; name=maxima-bug; charset=iso-8859-15
Content-Transfer-Encoding: 8bit

Maxima restarted.
(%i1) batch(hypergeometric2);

batching #p/home/edmond/hypergeometric2
- 1	    1
(%i2) 			  HGFRED([---, 1], [-, 2], x)
2	    2
1	    1
(%o2) 			  %F    ([- -, 1], [-, 2], x)
2, 2    2	    2
5  5	    1  1
(%i3) 			 HGFRED([-, -, 3], [-, -], x)
2  2	    2  2
2
20 x	 8 x	     1
(%o3) 30 x (-------- + -------- + --------)
6	      5		 4
(1 - x)    (1 - x)	  (1 - x)

2				      2
2   30 x	    10 x        1	  12 x	      6 x	  1
+ 140 x  (-------- + -------- + --------) + -------- + -------- + --------
7		 6	    5	        5	   4	      3
(1 - x)	  (1 - x)    (1 - x)	 (1 - x)    (1 - x)    (1 - x)
4	      3	       2
2557 x  + 1320 x  + 290 x  + 32 x + 1
(%o4) 	     - ---------------------------------------------------
7      6       5       4       3       2
x  - 7 x  + 21 x  - 35 x  + 35 x  - 21 x  + 7 x - 1
(%i5) 				   FACTOR(%)
4	      3	       2
2557 x  + 1320 x  + 290 x  + 32 x + 1
(%o5) 		    - -------------------------------------
7
(x - 1)
%
(%i6) 				       -
3
4	      3	       2
2557 x  + 1320 x  + 290 x  + 32 x + 1
(%o6) 		    - -------------------------------------
7
3 (x - 1)
5  5	    1  1
(%i7) 			 HGFRED([-, -, 3], [-, -], x)
2  2	    2  2
2
20 x	 8 x	     1
(%o7) 30 x (-------- + -------- + --------)
6	      5		 4
(1 - x)    (1 - x)	  (1 - x)

2				      2
2   30 x	    10 x        1	  12 x	      6 x	  1
+ 140 x  (-------- + -------- + --------) + -------- + -------- + --------
7		 6	    5	        5	   4	      3
(1 - x)	  (1 - x)    (1 - x)	 (1 - x)    (1 - x)    (1 - x)
(%i8) 				  RATSIMP(%)
4	      3	       2
2557 x  + 1320 x  + 290 x  + 32 x + 1
(%o8) 	     - ---------------------------------------------------
7      6       5       4       3       2
x  - 7 x  + 21 x  - 35 x  + 35 x  - 21 x  + 7 x - 1
(%i9) 				   FACTOR(%)
4	      3	       2
2557 x  + 1320 x  + 290 x  + 32 x + 1
(%o9) 		    - -------------------------------------
7
(x - 1)
5  5	    1
(%i10) 			 HGFRED([-, -, 3], [-, 1], x)
2  2	    2
2
63 x	        7 x	      1
(%o10) 15 x (------------- + ---------- + ----------)
11/2	    9/2		 7/2
4 (1 - x)	     (1 - x)	  (1 - x)

2
2      99 x	       9 x	     1
105 x  (------------- + ----------- + ----------)
13/2	  11/2	        9/2	      2
4 (1 - x)	   (1 - x)	 (1 - x)	  35 x
+ ------------------------------------------------- + ------------
2				        9/2
4 (1 - x)

5 x	    1
+ ---------- + ----------
7/2	       5/2
(1 - x)      (1 - x)
(%i11) 				  RATSIMP(%)
4	    3	     2
5903 x  + 3458 x  + 898 x  + 128 x + 8
(%o11) ----------------------------------------------------------------
6       5        4	 3	  2
SQRT(1 - x) (8 x  - 48 x  + 120 x  - 160 x  + 120 x  - 48 x + 8)
(%i12) 				   FACTOR(%)
4	    3	     2
5903 x  + 3458 x  + 898 x  + 128 x + 8
(%o12) 		    --------------------------------------
6
8 SQRT(1 - x) (x - 1)
5  5	    1  3
(%i13) 			 HGFRED([-, -, 3], [-, -], x)
2  2	    2  2
4 x	   1	        2    5 x	 1	    3 x
(%o13) 10 x (-------- + --------) + 28 x  (-------- + --------) + --------
5	       4		  6	     5		 4
(1 - x)    (1 - x)		   (1 - x)    (1 - x)	  (1 - x)

1
+ --------
3
(1 - x)
3       2
84 x  + 45 x  + 10 x + 1
(%o14) 		  -------------------------------------------
6	  5	  4	  3	  2
x  - 6 x  + 15 x  - 20 x  + 15 x  - 6 x + 1
(%i15) 				   FACTOR(%)
2
(4 x + 1) (21 x  + 6 x + 1)
(%o15) 			  ---------------------------
6
(x - 1)
6
(%i16) 				  % (x - 1)
2
(%o16) 			  (4 x + 1) (21 x  + 6 x + 1)
3       2
(%o17) 			   84 x  + 45 x  + 10 x + 1
5  5	    3  3
(%i18) 			 HGFRED([-, -, 3], [-, -], x)
2  2	    2  2
4 x	   1	      3 x	  1
(%o18) 	        5 x (-------- + --------) + -------- + --------
5	       4	   4	      3
(1 - x)    (1 - x)	    (1 - x)    (1 - x)
2
13 x  + 6 x + 1
(%o19) 		     - -----------------------------------
5      4       3       2
x  - 5 x  + 10 x  - 10 x  + 5 x - 1
(%i20) 				   FACTOR(%)
2
13 x  + 6 x + 1
(%o20) 			       - ---------------
5
(x - 1)
1
(%i21) 			 HGFRED([3, 3, 3], [-, 1], x)
2
[About a 1000 lines of output deleted]
- 1     5
(%i22) 		        HGFRED([---, 1, -], [2, 2], x)
2      2
1     5
(%o22) 		        %F    ([- -, 1, -], [2, 2], x)
3, 2	  2     2
- 1     5    3
(%i23) 		        HGFRED([---, 1, -], [-, 2], x)
2      2    2
2 - x				    2
3 SQRT(%PI) %I %Q      (-----)   %P	  (SQRT(1 - x)) x (x  - 1)
0, 3/2	 x	  - 2, - 2
(%o23) ------------------------------ - ----------------------------------
3/4	      1/4		        32
4 (x - 1)    (x + 1)
3/4	    1/4				  3
(%o24) - ((x - 1)    (x + 1)    (%P	   (SQRT(1 - x)) x
- 2, - 2

x - 2
- %P	     (SQRT(1 - x)) x) - 24 SQRT(%PI) %I %Q      (- -----))
- 2, - 2					  0, 3/2     x

3/4	       1/4
/(32 (x - 1)    (x + 1)	  )
- 1     5    3
(%i25) 		        HGFRED([---, 1, -], [-, 3], x)
2      2    2

SIMP2F1-WILL-CONTINUE-IN
2 - x
5 SQRT(%PI) %I %Q	    (-----) x
1				      1, 3/2   x
(%o25) 	  %F    ([- -, 1], [3], x) - --------------------------------
2, 1    2				   3/4	      5/4
48 (x - 1)    (x + 1)
- 1     5
(%i26) 		        HGFRED([---, 1, -], [3, 2], x)
2      2
1     5
(%o26) 		        %F    ([- -, 1, -], [3, 2], x)
3, 2	  2     2
(%i27) 			 HGFRED([a, b, c], [d, e], x)
(%o27) 			 %F    ([a, b, c], [d, e], x)
3, 2
(%i28) 			 HGFRED([a, b, c], [d, e], 1)
(%o28) 			 %F    ([a, b, c], [d, e], 1)
3, 2
1
(%i29) 		     HGFRED([-, b, 1 - b], [d, 2 - d], x)
2
1
(%o29) 		     %F	   ([-, b, 1 - b], [d, 2 - d], x)
3, 2  2
1	 1  3	    5  3  7
(%i30) 		      HGFRED([-, -, -, 1], [-, -, -], x)
4	 2  4	    4  2  4
1	 1  3	    5  3  7
(%o30) 		      %F    ([-, -, -, 1], [-, -, -], x)
4, 3  4	 2  4	    4  2  4
3	       5    7	  9
(%i31) 		      HGFRED([-, 1, 1, -], [-, 2, -], x)
4	       4    4	  4
3	       5    7	  9
(%o31) 		      %F    ([-, 1, 1, -], [-, 2, -], x)
4, 3  4	       4    4	  4
(%i32) 		      HGFRED([2, 2, 2, 2], [1, 1, 1], x)
4 x	       1
9 x (-------- + --------)
5	   4
(1 - x)    (1 - x)	  3 x	      1
(%o32) 8 x (------------------------- + -------- + --------)
2		       4	  3
(1 - x)	   (1 - x)

3 x	   1	      2 x	  1
+ 4 x (-------- + --------) + -------- + --------
4	       3	   3	      2
(1 - x)    (1 - x)	    (1 - x)    (1 - x)
(%i33) 				  RATSIMP(%)
3       2
85 x  + 47 x  + 11 x + 1
(%o33) 		     - -----------------------------------
5      4       3       2
x  - 5 x  + 10 x  - 10 x  + 5 x - 1
(%i34) 				   FACTOR(%)
2
(5 x + 1) (17 x  + 6 x + 1)
(%o34) 			 - ---------------------------
5
(x - 1)
5
(%i35) 				  % (x - 1)
2
(%o35) 			 - (5 x + 1) (17 x  + 6 x + 1)
(%i36) 				  RATSIMP(%)
3       2
(%o36) 			  - 85 x  - 47 x  - 11 x - 1
(%i37)
Process maxima processus arrêté

--=-wMwgu+bgzDahiWih8/1q--

```