# HG changeset patch
# User KarlDieter Crisman <kcrisman@gmail.com>
# Date 1328846190 18000
# Node ID 4e2f0515cc40cd05fcfb5d4e700c136967caa3b9
# Parent b3a9e5be5393bc7d768f8870a1facefefb1ca6d8
Trac #9130: Reviewer patch
Fixes documentation building and viewing
Adds loads(dumps()) tests
diff git a/sage/functions/other.py b/sage/functions/other.py
a

b


102  102  sage: erf(x).diff(x) 
103  103  2*e^(x^2)/sqrt(pi) 
104  104  
105   TESTS:: 
 105  TESTS: 
106  106  
107  107  Check if #8568 is fixed:: 
108  108  
… 
… 

144  144  \mathrm{abs} 
145  145  sage: latex(abs(x)) 
146  146  {\left x \right} 
 147  
 148  Test pickling:: 
 149  
 150  sage: loads(dumps(abs(x))) 
 151  abs(x) 
147  152  """ 
148  153  GinacFunction.__init__(self, "abs", latex_name=r"\mathrm{abs}") 
149  154  
… 
… 

224  229  sage: a = numpy.linspace(0,2,6) 
225  230  sage: ceil(a) 
226  231  array([ 0., 1., 1., 2., 2., 2.]) 
 232  
 233  Test pickling:: 
 234  
 235  sage: loads(dumps(ceil)) 
 236  ceil 
227  237  """ 
228  238  BuiltinFunction.__init__(self, "ceil", 
229  239  conversions=dict(maxima='ceiling')) 
… 
… 

375  385  100000000000000000000000000000000000000000000000000 
376  386  
377  387  :: 
 388  
378  389  sage: import numpy 
379  390  sage: a = numpy.linspace(0,2,6) 
380  391  sage: floor(a) 
381  392  array([ 0., 0., 0., 1., 1., 2.]) 
 393  
 394  Test pickling:: 
 395  
 396  sage: loads(dumps(floor)) 
 397  floor 
382  398  """ 
383  399  BuiltinFunction.__init__(self, "floor") 
384  400  
… 
… 

477  493  def __init__(self): 
478  494  r""" 
479  495  The Gamma function. This is defined by 
480   `\Gamma(z) = \int_0^\infty t^{z1}e^{t} dt` 
 496  
 497  .. math:: 
 498  
 499  \Gamma(z) = \int_0^\infty t^{z1}e^{t} dt 
 500  
481  501  for complex input `z` with real part greater than zero, and by 
482  502  analytic continuation on the rest of the complex plane (except 
483  503  for negative integers, which are poles). 
… 
… 

580  600  
581  601  sage: latex(gamma(1/4)) 
582  602  \Gamma\left(\frac{1}{4}\right) 
 603  
 604  Test pickling:: 
 605  
 606  sage: loads(dumps(gamma(x))) 
 607  gamma(x) 
583  608  """ 
584  609  GinacFunction.__init__(self, "gamma", latex_name=r'\Gamma', 
585  610  ginac_name='tgamma', 
… 
… 

735  760  r""" 
736  761  Gamma and incomplete gamma functions. 
737  762  This is defined by the integral 
738   `\Gamma(a, z) = \int_z^\infty t^{a1}e^{t} dt`. 
 763  
 764  .. math:: 
 765  
 766  \Gamma(a, z) = \int_z^\infty t^{a1}e^{t} dt 
739  767  
740  768  EXAMPLES:: 
741  769  
… 
… 

813  841  The digamma function, `\psi(x)`, is the logarithmic derivative of the 
814  842  gamma function. 
815  843  
816   `\psi(x) = \frac{d}{dx} \log(\Gamma(x)) = \frac{\Gamma'(x)}{\Gamma(x)}` 
 844  .. math:: 
 845  
 846  \psi(x) = \frac{d}{dx} \log(\Gamma(x)) = \frac{\Gamma'(x)}{\Gamma(x)} 
817  847  
818  848  EXAMPLES:: 
819  849  
… 
… 

835  865  sage: psi(RealField(100)(.5)) 
836  866  1.9635100260214234794409763330 
837  867  
838   Tests:: 
 868  TESTS:: 
839  869  
840  870  sage: latex(psi1(x)) 
841  871  \psi\left(x\right) 
… 
… 

914  944  The digamma function, `\psi(x)`, is the logarithmic derivative of the 
915  945  gamma function. 
916  946  
917   `\psi(x) = \frac{d}{dx} \log(\Gamma(x)) = \frac{\Gamma'(x)}{\Gamma(x)}` 
 947  .. math:: 
 948  
 949  \psi(x) = \frac{d}{dx} \log(\Gamma(x)) = \frac{\Gamma'(x)}{\Gamma(x)} 
918  950  
919  951  We represent the `n`th derivative of the digamma function with 
920   `\psi(n, x)` or ``psi(n, x). 
 952  `\psi(n, x)` or `psi(n, x)`. 
921  953  
922  954  EXAMPLES:: 
923  955  
… 
… 

942  974  psi(1, 5) 
943  975  
944  976  TESTS:: 
 977  
945  978  sage: psi(2, x, 3) 
946  979  Traceback (most recent call last): 
947  980  ... 
… 
… 

964  997  
965  998  INPUT: 
966  999  
967   
968  1000   ``n``  any complex argument (except negative 
969  1001  integers) or any symbolic expression 
970  1002  
… 
… 

1053  1085  
1054  1086  sage: latex(factorial) 
1055  1087  {\rm factorial} 
 1088  
 1089  Test pickling:: 
 1090  
 1091  sage: loads(dumps(factorial)) 
 1092  factorial 
1056  1093  """ 
1057  1094  GinacFunction.__init__(self, "factorial", latex_name='{\\rm factorial}', 
1058  1095  conversions=dict(maxima='factorial', mathematica='Factorial')) 
… 
… 

1098  1135  
1099  1136  .. math:: 
1100  1137  
1101   \binom{x}{m} = x (x1) \cdots (xm+1) / m! 
 1138  \binom{x}{m} = x (x1) \cdots (xm+1) / m! 
1102  1139  
1103  1140  
1104  1141  which is defined for `m \in \ZZ` and any 
… 
… 

1144  1181  1 
1145  1182  
1146  1183  :: 
 1184  
1147  1185  sage: k, i = var('k,i') 
1148  1186  sage: binomial(k,i) 
1149  1187  binomial(k, i) 
… 
… 

1168  1206  binomial(n, k) 
1169  1207  sage: sage.functions.other.binomial._maxima_init_() # temporary workaround until we can get symbolic binomial to import in global namespace, if that's desired 
1170  1208  'binomial' 
 1209  
 1210  Test pickling:: 
 1211  
 1212  sage: loads(dumps(binomial(n,k))) 
 1213  binomial(n, k) 
1171  1214  """ 
1172  1215  GinacFunction.__init__(self, "binomial", nargs=2, 
1173  1216  conversions=dict(maxima='binomial', mathematica='Binomial')) 
… 
… 

1252  1295  sage: beta(2,1+5*I) 
1253  1296  0.0305039787798408  0.0198938992042440*I 
1254  1297  
 1298  Test pickling:: 
 1299  
 1300  sage: loads(dumps(beta)) 
 1301  beta 
1255  1302  """ 
1256  1303  GinacFunction.__init__(self, "beta", nargs=2, 
1257  1304  conversions=dict(maxima='beta', mathematica='Beta')) 
… 
… 

1588  1635  a 
1589  1636  sage: conjugate(a*sqrt(2)*sqrt(3)) 
1590  1637  conjugate(a)*conjugate(sqrt(3))*conjugate(sqrt(2)) 
 1638  
 1639  Test pickling:: 
 1640  
 1641  sage: loads(dumps(conjugate)) 
 1642  conjugate 
1591  1643  """ 
1592  1644  GinacFunction.__init__(self, "conjugate") 
1593  1645  