
/** Hypergeometric Function in R representation **/
/*A: K McIsaac*/
/*S: University of Western Australia, Nedlands 6009, Australia*/
/*D: October 1985*/
/*K: Hypergeometric, R */

<XCvgt
<XR
SGhgtoR_:Ghg_:Tier; #_:Comm;

/*: SGhgtoR:
	Subtitution to convert hypergeometeric notation to R notation*/
SGhgtoR[4] :\
Ghg[$p,$q,#[$$b],#[$$c],$z] -->\
	R[Ap['Mult,Map[($1+%i-1),{$$b}]] $z/(Ap['Mult,Map[($1+%i-1),{$$c}]] %i)\
		,{%i,1,Nterms[Ghg[$p,$q,#[$$b],#[$$c],$z]]}]
SGhgtoR[3] :\
Ghg[$p,0,#[$$b],#[$$c],$z] -->\
	R[Ap['Mult,Map[($1+%i-1),{$$b}]] $z/ %i\
		,{%i,1,Nterms[Ghg[$p,0,#[$$b],#[$$c],$z]]}]
SGhgtoR[2] :\
Ghg[0,$q,#[$$b],#[$$c],$z] -->\
	R[$z/(Ap['Mult,Map[($1+%i-1),{$$c}]] %i)\
		,{%i,1,Nterms[Ghg[0,$q,#[$$b],#[$$c],$z]]}]
SGhgtoR[1] :\
Ghg[0,0,#[],#[],$z] -->\
	R[$z/ %i\
		,{%i,1,Nterms[Ghg[0,0,#[$$b],#[$$c],$z]]}]

/* This form is a very efficent way to write hypergeometric functions*/

/*E:

SMP 1.5.0

#I[1]::  <XGhgtoR

#I[2]::  <XGhgPR

#I[3]::  Ghg[2,1,#[-9,1/2],#[4],1/2]

	    |-9,1/2   |
#O[3]:*   F |      1/2|
	 2 1|4        |

#I[4]::  S[%,SGhgtoR]

#O[4]:   0.658231

#I[5]::  Ghg[2,1,#[-2,a],#[b],z]

	    |-2,a |
#O[5]:*   F |    z|
	 2 1|b    |

#I[6]::  S[%,SGhgtoR]

		       2
	     2a z   a z  (1 + a)
#O[6]:   1 - ---- + ------------
	      b      b (1 + b)

#I[7]::  Ghg[3,2,#[a,b,c],#[d,e],z]

	    |a,b,c |
#O[7]:*   F |     z|
	 3 2|d,e   |

#I[8]::  S[%,SGhgtoR]

	   z (-1 + a + %i) (-1 + b + %i) (-1 + c + %i)
#O[8]:   R[-------------------------------------------,1,{%i,1,Inf,1}]
		 %i (-1 + d + %i) (-1 + e + %i)

#I[9]::  <end>

*/
/*W: A Hypergeometric that terminates at n arbitary integer, ie

     	Natp[n=1] : 1; Ghg[2,1,#[-n,a],#[b],z],

     will form an infinite loop due to a fault in the defn of R (see XR).*/
