summary refs log tree commit diff
path: root/pkgs/applications/science/math/sage/patches/numpy-1.14.3.patch
blob: 5927bc116096c604115370d4d166e18dd6b1c6e2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
diff --git a/src/doc/en/faq/faq-usage.rst b/src/doc/en/faq/faq-usage.rst
index 79b4205fd3..9a89bd2136 100644
--- a/src/doc/en/faq/faq-usage.rst
+++ b/src/doc/en/faq/faq-usage.rst
@@ -338,7 +338,7 @@ ints. For example::
     sage: RealNumber = float; Integer = int
     sage: from scipy import stats
     sage: stats.ttest_ind(list([1,2,3,4,5]),list([2,3,4,5,.6]))
-    Ttest_indResult(statistic=0.076752955645333687, pvalue=0.94070490247380478)
+    Ttest_indResult(statistic=0.0767529..., pvalue=0.940704...)
     sage: stats.uniform(0,15).ppf([0.5,0.7])
     array([  7.5,  10.5])
 
diff --git a/src/doc/en/thematic_tutorials/numerical_sage/cvxopt.rst b/src/doc/en/thematic_tutorials/numerical_sage/cvxopt.rst
index 314811c42b..e5f54ec4c2 100644
--- a/src/doc/en/thematic_tutorials/numerical_sage/cvxopt.rst
+++ b/src/doc/en/thematic_tutorials/numerical_sage/cvxopt.rst
@@ -48,11 +48,13 @@ we could do the following.
     sage: B = numpy.array([1.0]*5)
     sage: B.shape=(5,1)
     sage: print(B)
-    [[ 1.]
-     [ 1.]
-     [ 1.]
-     [ 1.]
-     [ 1.]]
+    [[1.]
+     [1.]
+     [1.]
+     [1.]
+     [1.]]
+
+
     sage: print(A)
     [ 2.00e+00  3.00e+00     0         0         0    ]
     [ 3.00e+00     0      4.00e+00     0      6.00e+00]
diff --git a/src/doc/en/thematic_tutorials/numerical_sage/numpy.rst b/src/doc/en/thematic_tutorials/numerical_sage/numpy.rst
index 5b89cd75ee..e50b2ea5d4 100644
--- a/src/doc/en/thematic_tutorials/numerical_sage/numpy.rst
+++ b/src/doc/en/thematic_tutorials/numerical_sage/numpy.rst
@@ -84,7 +84,7 @@ well as take slices
     sage: l[3]
     3.0
     sage: l[3:6]
-    array([ 3.,  4.,  5.])
+    array([3., 4., 5.])
 
 You can do basic arithmetic operations
 
@@ -147,11 +147,11 @@ also do matrix vector multiplication, and matrix addition
     sage: n = numpy.matrix([[1,2],[3,4]],dtype=float)
     sage: v = numpy.array([[1],[2]],dtype=float)
     sage: n*v
-    matrix([[  5.],
-            [ 11.]])
+    matrix([[ 5.],
+            [11.]])
     sage: n+n
-    matrix([[ 2.,  4.],
-            [ 6.,  8.]])
+    matrix([[2., 4.],
+            [6., 8.]])
 
 If ``n`` was created with :meth:`numpy.array`, then to do matrix vector
 multiplication, you would use ``numpy.dot(n,v)``.
@@ -170,11 +170,11 @@ to manipulate
             22.,  23.,  24.])
     sage: n.shape=(5,5)
     sage: n
-    array([[  0.,   1.,   2.,   3.,   4.],
-           [  5.,   6.,   7.,   8.,   9.],
-           [ 10.,  11.,  12.,  13.,  14.],
-           [ 15.,  16.,  17.,  18.,  19.],
-           [ 20.,  21.,  22.,  23.,  24.]])
+    array([[ 0.,  1.,  2.,  3.,  4.],
+           [ 5.,  6.,  7.,  8.,  9.],
+           [10., 11., 12., 13., 14.],
+           [15., 16., 17., 18., 19.],
+           [20., 21., 22., 23., 24.]])
 
 This changes the one-dimensional array into a `5\times 5` array.
 
@@ -187,8 +187,8 @@ NumPy arrays can be sliced as well
     sage: n=numpy.array(range(25),dtype=float)
     sage: n.shape=(5,5)
     sage: n[2:4,1:3]
-    array([[ 11.,  12.],
-           [ 16.,  17.]])
+    array([[11., 12.],
+           [16., 17.]])
 
 It is important to note that the sliced matrices are references to
 the original
@@ -224,8 +224,8 @@ Some particularly useful commands are
 
     sage: x=numpy.arange(0,2,.1,dtype=float)
     sage: x
-    array([ 0. ,  0.1,  0.2,  0.3,  0.4,  0.5,  0.6,  0.7,  0.8,  0.9,  1. ,
-            1.1,  1.2,  1.3,  1.4,  1.5,  1.6,  1.7,  1.8,  1.9])
+    array([0. , 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1. , 1.1, 1.2,
+           1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9])
 
 You can see that :meth:`numpy.arange` creates an array of floats increasing by 0.1
 from 0 to 2. There is a useful command :meth:`numpy.r_` that is best explained by example
@@ -240,10 +240,11 @@ from 0 to 2. There is a useful command :meth:`numpy.r_` that is best explained b
     sage: Integer=int
     sage: n=r_[0.0:5.0]
     sage: n
-    array([ 0.,  1.,  2.,  3.,  4.])
+    array([0., 1., 2., 3., 4.])
     sage: n=r_[0.0:5.0, [0.0]*5]
     sage: n
-    array([ 0.,  1.,  2.,  3.,  4.,  0.,  0.,  0.,  0.,  0.])
+    array([0., 1., 2., 3., 4., 0., 0., 0., 0., 0.])
+
 
 :meth:`numpy.r_` provides a shorthand for constructing NumPy arrays efficiently.
 Note in the above ``0.0:5.0`` was shorthand for ``0.0, 1.0, 2.0, 3.0, 4.0``.
@@ -255,7 +256,7 @@ intervals. We can do this as follows
 ::
 
     sage: r_[0.0:5.0:11*j]
-    array([ 0. ,  0.5,  1. ,  1.5,  2. ,  2.5,  3. ,  3.5,  4. ,  4.5,  5. ])
+    array([0. , 0.5, 1. , 1.5, 2. , 2.5, 3. , 3.5, 4. , 4.5, 5. ])
 
 The notation ``0.0:5.0:11*j`` expands to a list of 11 equally space
 points between 0 and 5 including both endpoints. Note that ``j`` is the
@@ -287,23 +288,23 @@ an equally spaced grid with `\Delta x = \Delta y = .25` for
     sage: y=numpy.r_[0.0:1.0:5*j]
     sage: xx,yy= meshgrid(x,y)
     sage: xx
-    array([[ 0.  ,  0.25,  0.5 ,  0.75,  1.  ],
-           [ 0.  ,  0.25,  0.5 ,  0.75,  1.  ],
-           [ 0.  ,  0.25,  0.5 ,  0.75,  1.  ],
-           [ 0.  ,  0.25,  0.5 ,  0.75,  1.  ],
-           [ 0.  ,  0.25,  0.5 ,  0.75,  1.  ]])
+    array([[0.  , 0.25, 0.5 , 0.75, 1.  ],
+           [0.  , 0.25, 0.5 , 0.75, 1.  ],
+           [0.  , 0.25, 0.5 , 0.75, 1.  ],
+           [0.  , 0.25, 0.5 , 0.75, 1.  ],
+           [0.  , 0.25, 0.5 , 0.75, 1.  ]])
     sage: yy
-    array([[ 0.  ,  0.  ,  0.  ,  0.  ,  0.  ],
-           [ 0.25,  0.25,  0.25,  0.25,  0.25],
-           [ 0.5 ,  0.5 ,  0.5 ,  0.5 ,  0.5 ],
-           [ 0.75,  0.75,  0.75,  0.75,  0.75],
-           [ 1.  ,  1.  ,  1.  ,  1.  ,  1.  ]])
+    array([[0.  , 0.  , 0.  , 0.  , 0.  ],
+           [0.25, 0.25, 0.25, 0.25, 0.25],
+           [0.5 , 0.5 , 0.5 , 0.5 , 0.5 ],
+           [0.75, 0.75, 0.75, 0.75, 0.75],
+           [1.  , 1.  , 1.  , 1.  , 1.  ]])
     sage: f(xx,yy)
-    array([[ 0.    ,  0.0625,  0.25  ,  0.5625,  1.    ],
-           [ 0.0625,  0.125 ,  0.3125,  0.625 ,  1.0625],
-           [ 0.25  ,  0.3125,  0.5   ,  0.8125,  1.25  ],
-           [ 0.5625,  0.625 ,  0.8125,  1.125 ,  1.5625],
-           [ 1.    ,  1.0625,  1.25  ,  1.5625,  2.    ]])
+    array([[0.    , 0.0625, 0.25  , 0.5625, 1.    ],
+           [0.0625, 0.125 , 0.3125, 0.625 , 1.0625],
+           [0.25  , 0.3125, 0.5   , 0.8125, 1.25  ],
+           [0.5625, 0.625 , 0.8125, 1.125 , 1.5625],
+           [1.    , 1.0625, 1.25  , 1.5625, 2.    ]])
 
 You can see that :meth:`numpy.meshgrid` produces a pair of matrices, here denoted
 `xx` and `yy`, such that `(xx[i,j],yy[i,j])` has coordinates
@@ -324,7 +325,7 @@ equation `Ax=b` do
     sage: b=numpy.array(range(1,6))
     sage: x=linalg.solve(A,b)
     sage: numpy.dot(A,x)
-    array([ 1.,  2.,  3.,  4., 5.])
+    array([1., 2., 3., 4., 5.])
 
 This creates a random 5x5 matrix ``A``, and solves `Ax=b` where
 ``b=[0.0,1.0,2.0,3.0,4.0]``. There are many other routines in the :mod:`numpy.linalg`
diff --git a/src/sage/calculus/riemann.pyx b/src/sage/calculus/riemann.pyx
index df85cce43d..34ea164be0 100644
--- a/src/sage/calculus/riemann.pyx
+++ b/src/sage/calculus/riemann.pyx
@@ -1191,30 +1191,30 @@ cpdef complex_to_spiderweb(np.ndarray[COMPLEX_T, ndim = 2] z_values,
         sage: zval = numpy.array([[0, 1, 1000],[.2+.3j,1,-.3j],[0,0,0]],dtype = numpy.complex128)
         sage: deriv = numpy.array([[.1]],dtype = numpy.float64)
         sage: complex_to_spiderweb(zval, deriv,deriv, 4,4,[0,0,0],1,False,0.001)
-        array([[[ 1.,  1.,  1.],
-                [ 1.,  1.,  1.],
-                [ 1.,  1.,  1.]],
+        array([[[1., 1., 1.],
+                [1., 1., 1.],
+                [1., 1., 1.]],
         <BLANKLINE>
-               [[ 1.,  1.,  1.],
-                [ 0.,  0.,  0.],
-                [ 1.,  1.,  1.]],
+               [[1., 1., 1.],
+                [0., 0., 0.],
+                [1., 1., 1.]],
         <BLANKLINE>
-               [[ 1.,  1.,  1.],
-                [ 1.,  1.,  1.],
-                [ 1.,  1.,  1.]]])
+               [[1., 1., 1.],
+                [1., 1., 1.],
+                [1., 1., 1.]]])
 
         sage: complex_to_spiderweb(zval, deriv,deriv, 4,4,[0,0,0],1,True,0.001)
-        array([[[ 1.        ,  1.        ,  1.        ],
-                [ 1.        ,  0.05558355,  0.05558355],
-                [ 0.17301243,  0.        ,  0.        ]],
+        array([[[1.        , 1.        , 1.        ],
+                [1.        , 0.05558355, 0.05558355],
+                [0.17301243, 0.        , 0.        ]],
         <BLANKLINE>
-               [[ 1.        ,  0.96804683,  0.48044583],
-                [ 0.        ,  0.        ,  0.        ],
-                [ 0.77351965,  0.5470393 ,  1.        ]],
+               [[1.        , 0.96804683, 0.48044583],
+                [0.        , 0.        , 0.        ],
+                [0.77351965, 0.5470393 , 1.        ]],
         <BLANKLINE>
-               [[ 1.        ,  1.        ,  1.        ],
-                [ 1.        ,  1.        ,  1.        ],
-                [ 1.        ,  1.        ,  1.        ]]])
+               [[1.        , 1.        , 1.        ],
+                [1.        , 1.        , 1.        ],
+                [1.        , 1.        , 1.        ]]])
      """
     cdef Py_ssize_t i, j, imax, jmax
     cdef FLOAT_T x, y, mag, arg, width, target, precision, dmag, darg
@@ -1279,14 +1279,14 @@ cpdef complex_to_rgb(np.ndarray[COMPLEX_T, ndim = 2] z_values):
         sage: from sage.calculus.riemann import complex_to_rgb
         sage: import numpy
         sage: complex_to_rgb(numpy.array([[0, 1, 1000]], dtype = numpy.complex128))
-        array([[[ 1.        ,  1.        ,  1.        ],
-                [ 1.        ,  0.05558355,  0.05558355],
-                [ 0.17301243,  0.        ,  0.        ]]])
+        array([[[1.        , 1.        , 1.        ],
+                [1.        , 0.05558355, 0.05558355],
+                [0.17301243, 0.        , 0.        ]]])
 
         sage: complex_to_rgb(numpy.array([[0, 1j, 1000j]], dtype = numpy.complex128))
-        array([[[ 1.        ,  1.        ,  1.        ],
-                [ 0.52779177,  1.        ,  0.05558355],
-                [ 0.08650622,  0.17301243,  0.        ]]])
+        array([[[1.        , 1.        , 1.        ],
+                [0.52779177, 1.        , 0.05558355],
+                [0.08650622, 0.17301243, 0.        ]]])
 
 
     TESTS::
diff --git a/src/sage/combinat/fully_packed_loop.py b/src/sage/combinat/fully_packed_loop.py
index 61b1003002..4baee9cbbd 100644
--- a/src/sage/combinat/fully_packed_loop.py
+++ b/src/sage/combinat/fully_packed_loop.py
@@ -72,11 +72,11 @@ def _make_color_list(n, colors=None,  color_map=None, randomize=False):
         sage: _make_color_list(5, ['blue', 'red'])
         ['blue', 'red', 'blue', 'red', 'blue']
         sage: _make_color_list(5, color_map='summer')
-        [(0.0, 0.5, 0.40000000000000002),
-         (0.25098039215686274, 0.62549019607843137, 0.40000000000000002),
-         (0.50196078431372548, 0.75098039215686274, 0.40000000000000002),
-         (0.75294117647058822, 0.87647058823529411, 0.40000000000000002),
-         (1.0, 1.0, 0.40000000000000002)]
+        [(0.0, 0.5, 0.4),
+         (0.25098039215686274, 0.6254901960784314, 0.4),
+         (0.5019607843137255, 0.7509803921568627, 0.4),
+         (0.7529411764705882, 0.8764705882352941, 0.4),
+         (1.0, 1.0, 0.4)]
         sage: _make_color_list(8, ['blue', 'red'], randomize=True)
         ['blue', 'blue', 'red', 'blue', 'red', 'red', 'red', 'blue']
     """
diff --git a/src/sage/finance/time_series.pyx b/src/sage/finance/time_series.pyx
index c37700d14e..49b7298d0b 100644
--- a/src/sage/finance/time_series.pyx
+++ b/src/sage/finance/time_series.pyx
@@ -109,8 +109,8 @@ cdef class TimeSeries:
 
             sage: import numpy
             sage: v = numpy.array([[1,2], [3,4]], dtype=float); v
-            array([[ 1.,  2.],
-                   [ 3.,  4.]])
+            array([[1., 2.],
+                   [3., 4.]])
             sage: finance.TimeSeries(v)
             [1.0000, 2.0000, 3.0000, 4.0000]
             sage: finance.TimeSeries(v[:,0])
@@ -2098,14 +2098,14 @@ cdef class TimeSeries:
 
             sage: w[0] = 20
             sage: w
-            array([ 20. ,  -3. ,   4.5,  -2. ])
+            array([20. , -3. ,  4.5, -2. ])
             sage: v
             [20.0000, -3.0000, 4.5000, -2.0000]
 
         If you want a separate copy do not give the ``copy=False`` option. ::
 
             sage: z = v.numpy(); z
-            array([ 20. ,  -3. ,   4.5,  -2. ])
+            array([20. , -3. ,  4.5, -2. ])
             sage: z[0] = -10
             sage: v
             [20.0000, -3.0000, 4.5000, -2.0000]
diff --git a/src/sage/functions/hyperbolic.py b/src/sage/functions/hyperbolic.py
index 931a4b41e4..bf33fc483d 100644
--- a/src/sage/functions/hyperbolic.py
+++ b/src/sage/functions/hyperbolic.py
@@ -214,7 +214,7 @@ class Function_coth(GinacFunction):
             sage: import numpy
             sage: a = numpy.arange(2, 5)
             sage: coth(a)
-            array([ 1.03731472,  1.00496982,  1.00067115])
+            array([1.03731472, 1.00496982, 1.00067115])
         """
         return 1.0 / tanh(x)
 
@@ -267,7 +267,7 @@ class Function_sech(GinacFunction):
             sage: import numpy
             sage: a = numpy.arange(2, 5)
             sage: sech(a)
-            array([ 0.26580223,  0.09932793,  0.03661899])
+            array([0.26580223, 0.09932793, 0.03661899])
         """
         return 1.0 / cosh(x)
 
@@ -318,7 +318,7 @@ class Function_csch(GinacFunction):
             sage: import numpy
             sage: a = numpy.arange(2, 5)
             sage: csch(a)
-            array([ 0.27572056,  0.09982157,  0.03664357])
+            array([0.27572056, 0.09982157, 0.03664357])
         """
         return 1.0 / sinh(x)
 
@@ -586,7 +586,7 @@ class Function_arccoth(GinacFunction):
             sage: import numpy
             sage: a = numpy.arange(2,5)
             sage: acoth(a)
-            array([ 0.54930614,  0.34657359,  0.25541281])
+            array([0.54930614, 0.34657359, 0.25541281])
         """
         return arctanh(1.0 / x)
 
diff --git a/src/sage/functions/orthogonal_polys.py b/src/sage/functions/orthogonal_polys.py
index 017c85a96f..33fbb499c5 100644
--- a/src/sage/functions/orthogonal_polys.py
+++ b/src/sage/functions/orthogonal_polys.py
@@ -810,12 +810,12 @@ class Func_chebyshev_T(ChebyshevFunction):
             sage: z2 = numpy.array([[1,2],[1,2]])
             sage: z3 = numpy.array([1,2,3.])
             sage: chebyshev_T(1,z)
-            array([ 1.,  2.])
+            array([1., 2.])
             sage: chebyshev_T(1,z2)
-            array([[ 1.,  2.],
-                   [ 1.,  2.]])
+            array([[1., 2.],
+                   [1., 2.]])
             sage: chebyshev_T(1,z3)
-            array([ 1.,  2.,  3.])
+            array([1., 2., 3.])
             sage: chebyshev_T(z,0.1)
             array([ 0.1 , -0.98])
         """
@@ -1095,12 +1095,12 @@ class Func_chebyshev_U(ChebyshevFunction):
             sage: z2 = numpy.array([[1,2],[1,2]])
             sage: z3 = numpy.array([1,2,3.])
             sage: chebyshev_U(1,z)
-            array([ 2.,  4.])
+            array([2., 4.])
             sage: chebyshev_U(1,z2)
-            array([[ 2.,  4.],
-                   [ 2.,  4.]])
+            array([[2., 4.],
+                   [2., 4.]])
             sage: chebyshev_U(1,z3)
-            array([ 2.,  4.,  6.])
+            array([2., 4., 6.])
             sage: chebyshev_U(z,0.1)
             array([ 0.2 , -0.96])
         """
diff --git a/src/sage/functions/other.py b/src/sage/functions/other.py
index 679384c907..d63b295a4c 100644
--- a/src/sage/functions/other.py
+++ b/src/sage/functions/other.py
@@ -390,7 +390,7 @@ class Function_ceil(BuiltinFunction):
             sage: import numpy
             sage: a = numpy.linspace(0,2,6)
             sage: ceil(a)
-            array([ 0.,  1.,  1.,  2.,  2.,  2.])
+            array([0., 1., 1., 2., 2., 2.])
 
         Test pickling::
 
@@ -539,7 +539,7 @@ class Function_floor(BuiltinFunction):
             sage: import numpy
             sage: a = numpy.linspace(0,2,6)
             sage: floor(a)
-            array([ 0.,  0.,  0.,  1.,  1.,  2.])
+            array([0., 0., 0., 1., 1., 2.])
             sage: floor(x)._sympy_()
             floor(x)
 
@@ -840,7 +840,7 @@ def sqrt(x, *args, **kwds):
             sage: import numpy
             sage: a = numpy.arange(2,5)
             sage: sqrt(a)
-            array([ 1.41421356,  1.73205081,  2.        ])
+            array([1.41421356, 1.73205081, 2.        ])
         """
         if isinstance(x, float):
             return math.sqrt(x)
diff --git a/src/sage/functions/trig.py b/src/sage/functions/trig.py
index e7e7a311cd..e7ff78a9de 100644
--- a/src/sage/functions/trig.py
+++ b/src/sage/functions/trig.py
@@ -731,7 +731,7 @@ class Function_arccot(GinacFunction):
             sage: import numpy
             sage: a = numpy.arange(2, 5)
             sage: arccot(a)
-            array([ 0.46364761,  0.32175055,  0.24497866])
+            array([0.46364761, 0.32175055, 0.24497866])
         """
         return math.pi/2 - arctan(x)
 
@@ -787,7 +787,7 @@ class Function_arccsc(GinacFunction):
             sage: import numpy
             sage: a = numpy.arange(2, 5)
             sage: arccsc(a)
-            array([ 0.52359878,  0.33983691,  0.25268026])
+            array([0.52359878, 0.33983691, 0.25268026])
         """
         return arcsin(1.0/x)
 
@@ -845,7 +845,7 @@ class Function_arcsec(GinacFunction):
             sage: import numpy
             sage: a = numpy.arange(2, 5)
             sage: arcsec(a)
-            array([ 1.04719755,  1.23095942,  1.31811607])
+            array([1.04719755, 1.23095942, 1.31811607])
         """
         return arccos(1.0/x)
 
@@ -920,13 +920,13 @@ class Function_arctan2(GinacFunction):
             sage: a = numpy.linspace(1, 3, 3)
             sage: b = numpy.linspace(3, 6, 3)
             sage: atan2(a, b)
-            array([ 0.32175055,  0.41822433,  0.46364761])
+            array([0.32175055, 0.41822433, 0.46364761])
 
             sage: atan2(1,a)
-            array([ 0.78539816,  0.46364761,  0.32175055])
+            array([0.78539816, 0.46364761, 0.32175055])
 
             sage: atan2(a, 1)
-            array([ 0.78539816,  1.10714872,  1.24904577])
+            array([0.78539816, 1.10714872, 1.24904577])
 
         TESTS::
 
diff --git a/src/sage/matrix/constructor.pyx b/src/sage/matrix/constructor.pyx
index 19a1d37df0..5780dfae1c 100644
--- a/src/sage/matrix/constructor.pyx
+++ b/src/sage/matrix/constructor.pyx
@@ -494,8 +494,8 @@ class MatrixFactory(object):
         [7 8 9]
         Full MatrixSpace of 3 by 3 dense matrices over Integer Ring
         sage: n = matrix(QQ, 2, 2, [1, 1/2, 1/3, 1/4]).numpy(); n
-        array([[ 1.        ,  0.5       ],
-               [ 0.33333333,  0.25      ]])
+        array([[1.        , 0.5       ],
+               [0.33333333, 0.25      ]])
         sage: matrix(QQ, n)
         [  1 1/2]
         [1/3 1/4]
diff --git a/src/sage/matrix/matrix_double_dense.pyx b/src/sage/matrix/matrix_double_dense.pyx
index 48e0a8a97f..1be5d35b19 100644
--- a/src/sage/matrix/matrix_double_dense.pyx
+++ b/src/sage/matrix/matrix_double_dense.pyx
@@ -2546,7 +2546,7 @@ cdef class Matrix_double_dense(Matrix_dense):
             sage: P.is_unitary(algorithm='orthonormal')
             Traceback (most recent call last):
             ...
-            ValueError: failed to create intent(cache|hide)|optional array-- must have defined dimensions but got (0,)
+            error: ((lwork==-1)||(lwork >= MAX(1,2*n))) failed for 3rd keyword lwork: zgees:lwork=0
 
         TESTS::
 
@@ -3662,8 +3662,8 @@ cdef class Matrix_double_dense(Matrix_dense):
             [0.0 1.0 2.0]
             [3.0 4.0 5.0]
             sage: m.numpy()
-            array([[ 0.,  1.,  2.],
-                   [ 3.,  4.,  5.]])
+            array([[0., 1., 2.],
+                   [3., 4., 5.]])
 
         Alternatively, numpy automatically calls this function (via
         the magic :meth:`__array__` method) to convert Sage matrices
@@ -3674,16 +3674,16 @@ cdef class Matrix_double_dense(Matrix_dense):
             [0.0 1.0 2.0]
             [3.0 4.0 5.0]
             sage: numpy.array(m)
-            array([[ 0.,  1.,  2.],
-                   [ 3.,  4.,  5.]])
+            array([[0., 1., 2.],
+                   [3., 4., 5.]])
             sage: numpy.array(m).dtype
             dtype('float64')
             sage: m = matrix(CDF, 2, range(6)); m
             [0.0 1.0 2.0]
             [3.0 4.0 5.0]
             sage: numpy.array(m)
-            array([[ 0.+0.j,  1.+0.j,  2.+0.j],
-                   [ 3.+0.j,  4.+0.j,  5.+0.j]])
+            array([[0.+0.j, 1.+0.j, 2.+0.j],
+                   [3.+0.j, 4.+0.j, 5.+0.j]])
             sage: numpy.array(m).dtype
             dtype('complex128')
 
diff --git a/src/sage/matrix/special.py b/src/sage/matrix/special.py
index c698ba5e97..b743bab354 100644
--- a/src/sage/matrix/special.py
+++ b/src/sage/matrix/special.py
@@ -705,7 +705,7 @@ def diagonal_matrix(arg0=None, arg1=None, arg2=None, sparse=True):
 
         sage: import numpy
         sage: entries = numpy.array([1.2, 5.6]); entries
-        array([ 1.2,  5.6])
+        array([1.2, 5.6])
         sage: A = diagonal_matrix(3, entries); A
         [1.2 0.0 0.0]
         [0.0 5.6 0.0]
@@ -715,7 +715,7 @@ def diagonal_matrix(arg0=None, arg1=None, arg2=None, sparse=True):
 
         sage: j = numpy.complex(0,1)
         sage: entries = numpy.array([2.0+j, 8.1, 3.4+2.6*j]); entries
-        array([ 2.0+1.j ,  8.1+0.j ,  3.4+2.6j])
+        array([2. +1.j , 8.1+0.j , 3.4+2.6j])
         sage: A = diagonal_matrix(entries); A
         [2.0 + 1.0*I         0.0         0.0]
         [        0.0         8.1         0.0]
diff --git a/src/sage/modules/free_module_element.pyx b/src/sage/modules/free_module_element.pyx
index 230f142117..2ab1c0ae68 100644
--- a/src/sage/modules/free_module_element.pyx
+++ b/src/sage/modules/free_module_element.pyx
@@ -982,7 +982,7 @@ cdef class FreeModuleElement(Vector):   # abstract base class
             sage: v.numpy()
             array([1, 2, 5/6], dtype=object)
             sage: v.numpy(dtype=float)
-            array([ 1.        ,  2.        ,  0.83333333])
+            array([1.        , 2.        , 0.83333333])
             sage: v.numpy(dtype=int)
             array([1, 2, 0])
             sage: import numpy
@@ -993,7 +993,7 @@ cdef class FreeModuleElement(Vector):   # abstract base class
         be more efficient but may have unintended consequences::
 
             sage: v.numpy(dtype=None)
-            array([ 1.        ,  2.        ,  0.83333333])
+            array([1.        , 2.        , 0.83333333])
 
             sage: w = vector(ZZ, [0, 1, 2^63 -1]); w
             (0, 1, 9223372036854775807)
diff --git a/src/sage/modules/vector_double_dense.pyx b/src/sage/modules/vector_double_dense.pyx
index 39fc2970de..2badf98284 100644
--- a/src/sage/modules/vector_double_dense.pyx
+++ b/src/sage/modules/vector_double_dense.pyx
@@ -807,13 +807,13 @@ cdef class Vector_double_dense(FreeModuleElement):
 
             sage: v = vector(CDF,4,range(4))
             sage: v.numpy()
-            array([ 0.+0.j,  1.+0.j,  2.+0.j,  3.+0.j])
+            array([0.+0.j, 1.+0.j, 2.+0.j, 3.+0.j])
             sage: v = vector(CDF,0)
             sage: v.numpy()
             array([], dtype=complex128)
             sage: v = vector(RDF,4,range(4))
             sage: v.numpy()
-            array([ 0.,  1.,  2.,  3.])
+            array([0., 1., 2., 3.])
             sage: v = vector(RDF,0)
             sage: v.numpy()
             array([], dtype=float64)
@@ -823,11 +823,11 @@ cdef class Vector_double_dense(FreeModuleElement):
             sage: import numpy
             sage: v = vector(CDF, 3, range(3))
             sage: v.numpy()
-            array([ 0.+0.j,  1.+0.j,  2.+0.j])
+            array([0.+0.j, 1.+0.j, 2.+0.j])
             sage: v.numpy(dtype=numpy.float64)
-            array([ 0.,  1.,  2.])
+            array([0., 1., 2.])
             sage: v.numpy(dtype=numpy.float32)
-            array([ 0.,  1.,  2.], dtype=float32)
+            array([0., 1., 2.], dtype=float32)
         """
         if dtype is None or dtype is self._vector_numpy.dtype:
             from copy import copy
diff --git a/src/sage/numerical/optimize.py b/src/sage/numerical/optimize.py
index 17b5ebb84b..92ce35c502 100644
--- a/src/sage/numerical/optimize.py
+++ b/src/sage/numerical/optimize.py
@@ -486,9 +486,9 @@ def minimize_constrained(func,cons,x0,gradient=None,algorithm='default', **args)
                 else:
                     min = optimize.fmin_tnc(f, x0, approx_grad=True, bounds=cons, messages=0, **args)[0]
         elif isinstance(cons[0], function_type) or isinstance(cons[0], Expression):
-            min = optimize.fmin_cobyla(f, x0, cons, iprint=0, **args)
+            min = optimize.fmin_cobyla(f, x0, cons, disp=0, **args)
     elif isinstance(cons, function_type) or isinstance(cons, Expression):
-        min = optimize.fmin_cobyla(f, x0, cons, iprint=0, **args)
+        min = optimize.fmin_cobyla(f, x0, cons, disp=0, **args)
     return vector(RDF, min)
 
 
diff --git a/src/sage/plot/complex_plot.pyx b/src/sage/plot/complex_plot.pyx
index ad9693da62..758fb709b7 100644
--- a/src/sage/plot/complex_plot.pyx
+++ b/src/sage/plot/complex_plot.pyx
@@ -61,9 +61,9 @@ cdef inline double mag_to_lightness(double r):
 
         sage: from sage.plot.complex_plot import complex_to_rgb
         sage: complex_to_rgb([[0, 1, 10]])
-        array([[[ 0.        ,  0.        ,  0.        ],
-                [ 0.77172568,  0.        ,  0.        ],
-                [ 1.        ,  0.22134776,  0.22134776]]])
+        array([[[0.        , 0.        , 0.        ],
+                [0.77172568, 0.        , 0.        ],
+                [1.        , 0.22134776, 0.22134776]]])
     """
     return atan(log(sqrt(r)+1)) * (4/PI) - 1
 
@@ -82,13 +82,13 @@ def complex_to_rgb(z_values):
 
         sage: from sage.plot.complex_plot import complex_to_rgb
         sage: complex_to_rgb([[0, 1, 1000]])
-        array([[[ 0.        ,  0.        ,  0.        ],
-                [ 0.77172568,  0.        ,  0.        ],
-                [ 1.        ,  0.64421177,  0.64421177]]])
+        array([[[0.        , 0.        , 0.        ],
+                [0.77172568, 0.        , 0.        ],
+                [1.        , 0.64421177, 0.64421177]]])
         sage: complex_to_rgb([[0, 1j, 1000j]])
-        array([[[ 0.        ,  0.        ,  0.        ],
-                [ 0.38586284,  0.77172568,  0.        ],
-                [ 0.82210588,  1.        ,  0.64421177]]])
+        array([[[0.        , 0.        , 0.        ],
+                [0.38586284, 0.77172568, 0.        ],
+                [0.82210588, 1.        , 0.64421177]]])
     """
     import numpy
     cdef unsigned int i, j, imax, jmax
diff --git a/src/sage/plot/line.py b/src/sage/plot/line.py
index 23f5e61446..3b1b51d7cf 100644
--- a/src/sage/plot/line.py
+++ b/src/sage/plot/line.py
@@ -502,14 +502,12 @@ def line2d(points, **options):
     from sage.plot.all import Graphics
     from sage.plot.plot import xydata_from_point_list
     from sage.rings.all import CC, CDF
+    points = list(points) # make sure points is a python list
     if points in CC or points in CDF:
         pass
     else:
-        try:
-            if not points:
-                return Graphics()
-        except ValueError: # numpy raises a ValueError if not empty
-            pass
+        if len(points) == 0:
+            return Graphics()
     xdata, ydata = xydata_from_point_list(points)
     g = Graphics()
     g._set_extra_kwds(Graphics._extract_kwds_for_show(options))
diff --git a/src/sage/plot/plot_field.py b/src/sage/plot/plot_field.py
index 0025098a8d..23c80902f3 100644
--- a/src/sage/plot/plot_field.py
+++ b/src/sage/plot/plot_field.py
@@ -49,9 +49,10 @@ class PlotField(GraphicPrimitive):
             sage: r.xpos_array
             [0.0, 0.0, 1.0, 1.0]
             sage: r.yvec_array
-            masked_array(data = [0.0 0.70710678118... 0.70710678118... 0.89442719...],
-                         mask = [False False False False],
-                   fill_value = 1e+20)
+            masked_array(data=[0.0, 0.70710678118..., 0.70710678118...,
+                               0.89442719...],
+                         mask=[False, False, False, False],
+                   fill_value=1e+20)
 
         TESTS:
 
diff --git a/src/sage/plot/streamline_plot.py b/src/sage/plot/streamline_plot.py
index f3da57c370..3806f4b32f 100644
--- a/src/sage/plot/streamline_plot.py
+++ b/src/sage/plot/streamline_plot.py
@@ -38,16 +38,14 @@ class StreamlinePlot(GraphicPrimitive):
             sage: r.options()['plot_points']
             2
             sage: r.xpos_array
-            array([ 0.,  1.])
+            array([0., 1.])
             sage: r.yvec_array
-            masked_array(data =
-             [[1.0 1.0]
-             [0.5403023058681398 0.5403023058681398]],
-                         mask =
-             [[False False]
-             [False False]],
-                   fill_value = 1e+20)
-            <BLANKLINE>
+            masked_array(
+              data=[[1.0, 1.0],
+                    [0.5403023058681398, 0.5403023058681398]],
+              mask=[[False, False],
+                    [False, False]],
+              fill_value=1e+20)
 
         TESTS:
 
diff --git a/src/sage/probability/probability_distribution.pyx b/src/sage/probability/probability_distribution.pyx
index f66cd898b9..35995886d5 100644
--- a/src/sage/probability/probability_distribution.pyx
+++ b/src/sage/probability/probability_distribution.pyx
@@ -130,7 +130,17 @@ cdef class ProbabilityDistribution:
              0.0,
              1.4650000000000003]
             sage: b
-            [0.0, 0.20000000000000001, 0.40000000000000002, 0.60000000000000009, 0.80000000000000004, 1.0, 1.2000000000000002, 1.4000000000000001, 1.6000000000000001, 1.8, 2.0]
+            [0.0,
+             0.2,
+             0.4,
+             0.6000000000000001,
+             0.8,
+             1.0,
+             1.2000000000000002,
+             1.4000000000000001,
+             1.6,
+             1.8,
+             2.0]
         """
         import pylab
         l = [float(self.get_random_element()) for _ in range(num_samples)]
diff --git a/src/sage/rings/rational.pyx b/src/sage/rings/rational.pyx
index a0bfe080f5..7d95e7a1a8 100644
--- a/src/sage/rings/rational.pyx
+++ b/src/sage/rings/rational.pyx
@@ -1056,7 +1056,7 @@ cdef class Rational(sage.structure.element.FieldElement):
             dtype('O')
 
             sage: numpy.array([1, 1/2, 3/4])
-            array([ 1.  ,  0.5 ,  0.75])
+            array([1.  , 0.5 , 0.75])
         """
         if mpz_cmp_ui(mpq_denref(self.value), 1) == 0:
             if mpz_fits_slong_p(mpq_numref(self.value)):
diff --git a/src/sage/rings/real_mpfr.pyx b/src/sage/rings/real_mpfr.pyx
index 4c630867a4..64e2187f5b 100644
--- a/src/sage/rings/real_mpfr.pyx
+++ b/src/sage/rings/real_mpfr.pyx
@@ -1438,7 +1438,7 @@ cdef class RealNumber(sage.structure.element.RingElement):
 
             sage: import numpy
             sage: numpy.arange(10.0)
-            array([ 0.,  1.,  2.,  3.,  4.,  5.,  6.,  7.,  8.,  9.])
+            array([0., 1., 2., 3., 4., 5., 6., 7., 8., 9.])
             sage: numpy.array([1.0, 1.1, 1.2]).dtype
             dtype('float64')
             sage: numpy.array([1.000000000000000000000000000000000000]).dtype
diff --git a/src/sage/schemes/elliptic_curves/height.py b/src/sage/schemes/elliptic_curves/height.py
index 3d270ebf9d..1144f168e3 100644
--- a/src/sage/schemes/elliptic_curves/height.py
+++ b/src/sage/schemes/elliptic_curves/height.py
@@ -1623,18 +1623,18 @@ class EllipticCurveCanonicalHeight:
         even::
 
             sage: H.wp_on_grid(v,4)
-            array([[ 25.43920182,   5.28760943,   5.28760943,  25.43920182],
-            [  6.05099485,   1.83757786,   1.83757786,   6.05099485],
-            [  6.05099485,   1.83757786,   1.83757786,   6.05099485],
-            [ 25.43920182,   5.28760943,   5.28760943,  25.43920182]])
+            array([[25.43920182,  5.28760943,  5.28760943, 25.43920182],
+                   [ 6.05099485,  1.83757786,  1.83757786,  6.05099485],
+                   [ 6.05099485,  1.83757786,  1.83757786,  6.05099485],
+                   [25.43920182,  5.28760943,  5.28760943, 25.43920182]])
 
         The array of values on the half-grid::
 
             sage: H.wp_on_grid(v,4,True)
-            array([[ 25.43920182,   5.28760943],
-            [  6.05099485,   1.83757786],
-            [  6.05099485,   1.83757786],
-            [ 25.43920182,   5.28760943]])
+            array([[25.43920182,  5.28760943],
+                   [ 6.05099485,  1.83757786],
+                   [ 6.05099485,  1.83757786],
+                   [25.43920182,  5.28760943]])
         """
         tau = self.tau(v)
         fk, err = self.fk_intervals(v, 15, CDF)
diff --git a/src/sage/symbolic/ring.pyx b/src/sage/symbolic/ring.pyx
index 2dcb0492b9..2b1a06385c 100644
--- a/src/sage/symbolic/ring.pyx
+++ b/src/sage/symbolic/ring.pyx
@@ -1135,7 +1135,7 @@ cdef class NumpyToSRMorphism(Morphism):
         sage: cos(numpy.int('2'))
         cos(2)
         sage: numpy.cos(numpy.int('2'))
-        -0.41614683654714241
+        -0.4161468365471424
     """
     cdef _intermediate_ring