# HG changeset patch
# User Francois Bissey <francois.bissey@canterbury.ac.nz>
# Date 1363859472 46800
# Node ID 04672e3f53435618ce58a87ac95d677962edec26
# Parent d5f2dfc014530707f8a3744f4867c0073e08c0b9
trac 11334: fix all numpy's divide warning
diff git a/sage/calculus/interpolators.pyx b/sage/calculus/interpolators.pyx
a

b


50  50  sage: fy = lambda x: ps.value(x).imag 
51  51  sage: show(parametric_plot((fx, fy), (0, 2*pi))) 
52  52  sage: m = Riemann_Map([lambda x: ps.value(real(x))], [lambda x: ps.derivative(real(x))],0) 
 53  doctest:1: RuntimeWarning: divide by zero encountered in divide 
53  54  sage: show(m.plot_colored() + m.plot_spiderweb()) 
54  55  
55  56  Polygon approximation of an circle:: 
… 
… 

181  182  sage: fy = lambda x: cs.value(x).imag 
182  183  sage: show(parametric_plot((fx, fy), (0, 2*pi))) 
183  184  sage: m = Riemann_Map([lambda x: cs.value(real(x))], [lambda x: cs.derivative(real(x))], 0) 
 185  doctest:1: RuntimeWarning: divide by zero encountered in divide 
184  186  sage: show(m.plot_colored() + m.plot_spiderweb()) 
185  187  
186  188  Polygon approximation of a circle:: 
diff git a/sage/calculus/riemann.pyx b/sage/calculus/riemann.pyx
a

b


109  109  sage: f(t) = e^(I*t) 
110  110  sage: fprime(t) = I*e^(I*t) 
111  111  sage: m = Riemann_Map([f], [fprime], 0) # long time (4 sec) 
 112  doctest:1: RuntimeWarning: divide by zero encountered in divide 
112  113  
113  114  The unit circle with a small hole:: 
114  115  
… 
… 

161  162  sage: f(t) = e^(I*t)  0.5*e^(I*t) 
162  163  sage: fprime(t) = I*e^(I*t) + 0.5*I*e^(I*t) 
163  164  sage: m = Riemann_Map([f], [fprime], 0) 
 165  doctest:1: RuntimeWarning: divide by zero encountered in divide 
164  166  """ 
165  167  a = np.complex128(a) 
166  168  if N <= 2: 
… 
… 

212  214  sage: f(t) = e^(I*t)  0.5*e^(I*t) 
213  215  sage: fprime(t) = I*e^(I*t) + 0.5*I*e^(I*t) 
214  216  sage: isinstance(Riemann_Map([f], [fprime], 0)._repr_(), str) # long time 
 217  doctest:1: RuntimeWarning: divide by zero encountered in divide 
215  218  True 
216  219  """ 
217  220  return "A Riemann mapping of a figure to the unit circle." 
… 
… 

226  229  sage: f(t) = e^(I*t)  0.5*e^(I*t) 
227  230  sage: fprime(t) = I*e^(I*t) + 0.5*I*e^(I*t) 
228  231  sage: m = Riemann_Map([f], [fprime], 0) 
 232  doctest:1: RuntimeWarning: divide by zero encountered in divide 
229  233  """ 
230  234  cp = self.cps.flatten() 
231  235  dp = self.dps.flatten() 
… 
… 

332  336  sage: f(t) = e^(I*t)  0.5*e^(I*t) 
333  337  sage: fprime(t) = I*e^(I*t) + 0.5*I*e^(I*t) 
334  338  sage: m = Riemann_Map([f], [fprime], 0) 
 339  doctest:1: RuntimeWarning: divide by zero encountered in divide 
335  340  sage: sz = m.get_szego(boundary=0) 
336  341  sage: points = m.get_szego(absolute_value=True) 
337  342  sage: list_plot(points) 
… 
… 

402  407  sage: f(t) = e^(I*t)  0.5*e^(I*t) 
403  408  sage: fprime(t) = I*e^(I*t) + 0.5*I*e^(I*t) 
404  409  sage: m = Riemann_Map([f], [fprime], 0) 
 410  doctest:1: RuntimeWarning: divide by zero encountered in divide 
405  411  sage: points = m.get_theta_points() 
406  412  sage: list_plot(points) 
407  413  
… 
… 

445  451  sage: f(t) = e^(I*t)  0.5*e^(I*t) 
446  452  sage: fprime(t) = I*e^(I*t) + 0.5*I*e^(I*t) 
447  453  sage: m = Riemann_Map([f], [fprime], 0) 
 454  doctest:1: RuntimeWarning: divide by zero encountered in divide 
448  455  """ 
449  456  cdef int N = self.N 
450  457  cdef double complex coeff = 3*I / (8*N) 
… 
… 

513  520  sage: f(t) = e^(I*t)  0.5*e^(I*t) 
514  521  sage: fprime(t) = I*e^(I*t) + 0.5*I*e^(I*t) 
515  522  sage: m = Riemann_Map([f], [fprime], 0) 
 523  doctest:1: RuntimeWarning: divide by zero encountered in divide 
516  524  sage: m.riemann_map(0.25 + sqrt(0.5)) 
517  525  (0.137514...+0.87669602...j) 
518  526  sage: m.riemann_map(1.3*I) 
… 
… 

541  549  sage: f(t) = e^(I*t)  0.5*e^(I*t) 
542  550  sage: fprime(t) = I*e^(I*t) + 0.5*I*e^(I*t) 
543  551  sage: m = Riemann_Map([f], [fprime], 0) 
 552  doctest:1: RuntimeWarning: divide by zero encountered in divide 
544  553  """ 
545  554  cdef int N = self.N 
546  555  cdef int B = self.B 
… 
… 

593  602  sage: f(t) = e^(I*t)  0.5*e^(I*t) 
594  603  sage: fprime(t) = I*e^(I*t) + 0.5*I*e^(I*t) 
595  604  sage: m = Riemann_Map([f], [fprime], 0) 
 605  doctest:1: RuntimeWarning: divide by zero encountered in divide 
596  606  sage: m.inverse_riemann_map(0.5 + sqrt(0.5)) 
597  607  (0.406880548363...+0.361470279816...j) 
598  608  sage: m.inverse_riemann_map(0.95) 
… 
… 

645  655  sage: f(t) = e^(I*t)  0.5*e^(I*t) 
646  656  sage: fprime(t) = I*e^(I*t) + 0.5*I*e^(I*t) 
647  657  sage: m = Riemann_Map([f], [fprime], 0) 
 658  doctest:1: RuntimeWarning: divide by zero encountered in divide 
648  659  
649  660  Default plot:: 
650  661  
… 
… 

710  721  sage: f(t) = e^(I*t)  0.5*e^(I*t) 
711  722  sage: fprime(t) = I*e^(I*t) + 0.5*I*e^(I*t) 
712  723  sage: m = Riemann_Map([f], [fprime], 0) 
 724  doctest:1: RuntimeWarning: divide by zero encountered in divide 
713  725  
714  726  Default plot:: 
715  727  
… 
… 

799  811  sage: f(t) = e^(I*t)  0.5*e^(I*t) 
800  812  sage: fprime(t) = I*e^(I*t) + 0.5*I*e^(I*t) 
801  813  sage: m = Riemann_Map([f], [fprime], 0) 
 814  doctest:1: RuntimeWarning: divide by zero encountered in divide 
802  815  sage: m.plot_colored() 
803  816  
804  817  Plot zoomed in on a specific spot:: 
… 
… 

865  878  sage: f(t) = e^(I*t)  0.5*e^(I*t) 
866  879  sage: fprime(t) = I*e^(I*t) + 0.5*I*e^(I*t) 
867  880  sage: m = Riemann_Map([f], [fprime], 0) 
 881  doctest:1: RuntimeWarning: divide by zero encountered in divide 
868  882  sage: m.plot_spiderweb() 
869  883  """ 
870  884  list2 = range(len(clist) + 1) if loop else range(len(clist)) 
diff git a/sage/functions/hyperbolic.py b/sage/functions/hyperbolic.py
a

b


608  608  sage: import numpy 
609  609  sage: a = numpy.linspace(0,1,3) 
610  610  sage: arcsech(a) 
611   Warning: divide by zero encountered in divide 
 611  doctest:614: RuntimeWarning: divide by zero encountered in divide 
612  612  array([ inf, 1.3169579, 0. ]) 
613  613  """ 
614  614  return arccosh(1.0 / x) 
… 
… 

658  658  sage: import numpy 
659  659  sage: a = numpy.linspace(0,1,3) 
660  660  sage: arccsch(a) 
661   Warning: divide by zero encountered in divide 
 661  doctest:664: RuntimeWarning: divide by zero encountered in divide 
662  662  array([ inf, 1.44363548, 0.88137359]) 
663  663  """ 
664  664  return arcsinh(1.0 / x) 
diff git a/sage/modules/vector_double_dense.pyx b/sage/modules/vector_double_dense.pyx
a

b


710  710  0.953760808... 
711  711  sage: w = vector(CDF, [1,0,1]) 
712  712  sage: w.norm(p=1.6) 
713   Warning: divide by zero encountered in power 
 713  doctest:1992: RuntimeWarning: divide by zero encountered in power 
714  714  0.0 
715  715  
716  716  Return values are in ``RDF``, or an integer when ``p = 0``. :: 
diff git a/sage/symbolic/function.pyx b/sage/symbolic/function.pyx
a

b


622  622  sage: import numpy 
623  623  sage: a = numpy.arange(5) 
624  624  sage: csc(a) 
625   Warning: divide by zero encountered in divide 
 625  doctest:270: RuntimeWarning: divide by zero encountered in divide 
626  626  array([ inf, 1.18839511, 1.09975017, 7.0861674 , 1.32134871]) 
627  627  
628  628  sage: factorial(a) 