passagemath-standard-no-symbolics 10.6.31rc3__cp314-cp314-macosx_13_0_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of passagemath-standard-no-symbolics might be problematic. Click here for more details.

Files changed (82) hide show
  1. passagemath_standard_no_symbolics-10.6.31rc3.data/scripts/sage-grep +5 -0
  2. passagemath_standard_no_symbolics-10.6.31rc3.data/scripts/sage-grepdoc +5 -0
  3. passagemath_standard_no_symbolics-10.6.31rc3.data/scripts/sage-list-packages +103 -0
  4. passagemath_standard_no_symbolics-10.6.31rc3.dist-info/METADATA +151 -0
  5. passagemath_standard_no_symbolics-10.6.31rc3.dist-info/RECORD +82 -0
  6. passagemath_standard_no_symbolics-10.6.31rc3.dist-info/WHEEL +6 -0
  7. passagemath_standard_no_symbolics-10.6.31rc3.dist-info/top_level.txt +1 -0
  8. sage/all.py +207 -0
  9. sage/all_cmdline.py +36 -0
  10. sage/cli/__init__.py +61 -0
  11. sage/cli/__main__.py +5 -0
  12. sage/cli/eval_cmd.py +45 -0
  13. sage/cli/eval_cmd_test.py +25 -0
  14. sage/cli/interactive_shell_cmd.py +28 -0
  15. sage/cli/notebook_cmd.py +51 -0
  16. sage/cli/notebook_cmd_test.py +39 -0
  17. sage/cli/options.py +26 -0
  18. sage/cli/run_file_cmd.py +50 -0
  19. sage/cli/version_cmd.py +26 -0
  20. sage/databases/all.py +83 -0
  21. sage/databases/cubic_hecke_db.py +1527 -0
  22. sage/dynamics/all.py +31 -0
  23. sage/dynamics/surface_dynamics_deprecation.py +32 -0
  24. sage/ext_data/kenzo/CP2.txt +45 -0
  25. sage/ext_data/kenzo/CP3.txt +349 -0
  26. sage/ext_data/kenzo/CP4.txt +4774 -0
  27. sage/ext_data/kenzo/README.txt +49 -0
  28. sage/ext_data/kenzo/S4.txt +20 -0
  29. sage/ext_data/mwrank/PRIMES +1 -0
  30. sage/ext_data/nbconvert/postprocess.py +48 -0
  31. sage/ext_data/nbconvert/rst_sage.tpl +99 -0
  32. sage/ext_data/nodoctest +0 -0
  33. sage/ext_data/notebook-ipython/kernel.json.in +11 -0
  34. sage/ext_data/notebook-ipython/logo-64x64.png +0 -0
  35. sage/ext_data/notebook-ipython/logo.svg +352 -0
  36. sage/ext_data/valgrind/pyalloc.supp +58 -0
  37. sage/ext_data/valgrind/sage-additional.supp +417 -0
  38. sage/ext_data/valgrind/sage.supp +43 -0
  39. sage/ext_data/valgrind/valgrind-python.supp +480 -0
  40. sage/geometry/all.py +12 -0
  41. sage/groups/matrix_gps/pickling_overrides.py +110 -0
  42. sage/homology/tests.py +66 -0
  43. sage/interacts/algebra.py +20 -0
  44. sage/interacts/all.py +25 -0
  45. sage/interacts/calculus.py +24 -0
  46. sage/interacts/fractals.py +18 -0
  47. sage/interacts/geometry.py +19 -0
  48. sage/interacts/library.py +1950 -0
  49. sage/interacts/library_cython.cpython-314-darwin.so +0 -0
  50. sage/interacts/statistics.py +19 -0
  51. sage/interfaces/axiom.py +1002 -0
  52. sage/interfaces/kash.py +834 -0
  53. sage/interfaces/lie.py +950 -0
  54. sage/interfaces/matlab.py +413 -0
  55. sage/interfaces/mupad.py +686 -0
  56. sage/interfaces/octave.py +858 -0
  57. sage/interfaces/phc.py +943 -0
  58. sage/interfaces/psage.py +189 -0
  59. sage/interfaces/qsieve.py +4 -0
  60. sage/interfaces/r.py +2096 -0
  61. sage/interfaces/read_data.py +46 -0
  62. sage/interfaces/scilab.py +576 -0
  63. sage/interfaces/tests.py +81 -0
  64. sage/libs/all.py +11 -0
  65. sage/libs/cremona/__init__.py +0 -0
  66. sage/libs/mwrank/__init__.py +0 -0
  67. sage/logic/all.py +3 -0
  68. sage/logic/booleval.py +160 -0
  69. sage/logic/boolformula.py +1490 -0
  70. sage/logic/logic.py +856 -0
  71. sage/logic/logicparser.py +696 -0
  72. sage/logic/logictable.py +272 -0
  73. sage/logic/propcalc.py +311 -0
  74. sage/misc/all.py +28 -0
  75. sage/misc/lazy_attribute.pyi +11 -0
  76. sage/rings/all.py +48 -0
  77. sage/rings/commutative_algebra.py +38 -0
  78. sage/rings/finite_rings/all.py +21 -0
  79. sage/rings/numbers_abc.py +58 -0
  80. sage/rings/polynomial/all.py +22 -0
  81. sage/rings/polynomial/convolution.py +421 -0
  82. sage/symbolic/all__sagemath_standard_no_symbolics.py +0 -0
@@ -0,0 +1,46 @@
1
+ """
2
+ An interface to read data files
3
+ """
4
+ ###############################################################################
5
+ # Sage: Open Source Mathematical Software
6
+ # Copyright (C) 2010 Paul Zimmermann
7
+ # Distributed under the terms of the GNU General Public License (GPL),
8
+ # version 2 or later. The full text of the GPL is available at:
9
+ # https://www.gnu.org/licenses/
10
+ ###############################################################################
11
+
12
+
13
+ def read_data(f, t):
14
+ r"""
15
+ Read data from file ``f`` and class ``t`` (one element per line),
16
+ and returns a list of elements.
17
+
18
+ INPUT:
19
+
20
+ - ``f`` -- a file name
21
+ - ``t`` -- a class (objects will be coerced to that class)
22
+
23
+ OUTPUT: list of elements of class ``t``
24
+
25
+ EXAMPLES::
26
+
27
+ sage: indata = tmp_filename()
28
+ sage: f = open(indata, "w")
29
+ sage: _ = f.write("17\n42\n")
30
+ sage: f.close()
31
+ sage: l = read_data(indata, ZZ); l
32
+ [17, 42]
33
+ sage: f = open(indata, "w")
34
+ sage: _ = f.write("1.234\n5.678\n")
35
+ sage: f.close()
36
+ sage: l = read_data(indata, RealField(17)); l
37
+ [1.234, 5.678]
38
+ """
39
+ with open(f) as fp:
40
+ l = []
41
+ while True:
42
+ s = fp.readline().strip()
43
+ if not s:
44
+ break
45
+ l.append(t(s))
46
+ return l
@@ -0,0 +1,576 @@
1
+ r"""
2
+ Interface to Scilab
3
+
4
+ Scilab is a scientific software package for numerical computations
5
+ providing a powerful open computing environment for engineering and
6
+ scientific applications. Scilab includes hundreds of mathematical
7
+ functions with the possibility to add interactively programs from
8
+ various languages (C, C++, Fortran...). It has sophisticated data
9
+ structures (including lists, polynomials, rational functions, linear
10
+ systems...), an interpreter and a high level programming language.
11
+
12
+ The commands in this section only work if you have the "scilab"
13
+ interpreter installed and available in your PATH. It's not necessary
14
+ to install any special Sage packages.
15
+
16
+ EXAMPLES::
17
+
18
+ sage: # optional - scilab
19
+ sage: scilab.eval('2+2')
20
+ 'ans =\n \n 4.'
21
+ sage: scilab('2+2')
22
+ 4.
23
+ sage: a = scilab(10)
24
+ sage: a**10
25
+ 1.000D+10
26
+
27
+ Tutorial based the MATLAB interface tutorial:
28
+
29
+ EXAMPLES::
30
+
31
+ sage: # optional - scilab
32
+ sage: scilab('4+10')
33
+ 14.
34
+ sage: scilab('date')
35
+ 15-Feb-2010
36
+ sage: scilab('5*10 + 6')
37
+ 56.
38
+ sage: scilab('(6+6)/3')
39
+ 4.
40
+ sage: scilab('9')^2
41
+ 81.
42
+ sage: a = scilab(10); b = scilab(20); c = scilab(30)
43
+ sage: avg = (a+b+c)/3
44
+ sage: avg
45
+ 20.
46
+ sage: parent(avg)
47
+ Scilab
48
+
49
+ sage: # optional - scilab
50
+ sage: my_scalar = scilab('3.1415')
51
+ sage: my_scalar
52
+ 3.1415
53
+ sage: my_vector1 = scilab('[1,5,7]')
54
+ sage: my_vector1
55
+ 1. 5. 7.
56
+ sage: my_vector2 = scilab('[1;5;7]')
57
+ sage: my_vector2
58
+ 1.
59
+ 5.
60
+ 7.
61
+ sage: my_vector1 * my_vector2
62
+ 75.
63
+
64
+ sage: # optional - scilab
65
+ sage: row_vector1 = scilab('[1 2 3]')
66
+ sage: row_vector2 = scilab('[3 2 1]')
67
+ sage: matrix_from_row_vec = scilab('[%s; %s]'%(row_vector1.name(), row_vector2.name()))
68
+ sage: matrix_from_row_vec
69
+ 1. 2. 3.
70
+ 3. 2. 1.
71
+
72
+ sage: # optional - scilab
73
+ sage: column_vector1 = scilab('[1;3]')
74
+ sage: column_vector2 = scilab('[2;8]')
75
+ sage: matrix_from_col_vec = scilab('[%s %s]'%(column_vector1.name(), column_vector2.name()))
76
+ sage: matrix_from_col_vec
77
+ 1. 2.
78
+ 3. 8.
79
+
80
+ sage: my_matrix = scilab('[8, 12, 19; 7, 3, 2; 12, 4, 23; 8, 1, 1]') # optional - scilab
81
+ sage: my_matrix # optional - scilab
82
+ 8. 12. 19.
83
+ 7. 3. 2.
84
+ 12. 4. 23.
85
+ 8. 1. 1.
86
+
87
+ sage: combined_matrix = scilab('[%s, %s]'%(my_matrix.name(), my_matrix.name())) # optional - scilab
88
+ sage: combined_matrix # optional - scilab
89
+ 8. 12. 19. 8. 12. 19.
90
+ 7. 3. 2. 7. 3. 2.
91
+ 12. 4. 23. 12. 4. 23.
92
+ 8. 1. 1. 8. 1. 1.
93
+
94
+ sage: tm = scilab('0.5:2:10') # optional - scilab
95
+ sage: tm # optional - scilab
96
+ 0.5 2.5 4.5 6.5 8.5
97
+
98
+ sage: # optional - scilab
99
+ sage: my_vector1 = scilab('[1,5,7]')
100
+ sage: my_vector1(1)
101
+ 1.
102
+ sage: my_vector1(2)
103
+ 5.
104
+ sage: my_vector1(3)
105
+ 7.
106
+
107
+ Matrix indexing works as follows::
108
+
109
+ sage: my_matrix = scilab('[8, 12, 19; 7, 3, 2; 12, 4, 23; 8, 1, 1]') # optional - scilab
110
+ sage: my_matrix(3,2) # optional - scilab
111
+ 4.
112
+
113
+ One can also use square brackets::
114
+
115
+ sage: my_matrix[3,2] # optional - scilab
116
+ 4.
117
+
118
+
119
+ Setting using parenthesis cannot work (because of how the Python
120
+ language works). Use square brackets or the set function::
121
+
122
+ sage: # optional - scilab
123
+ sage: my_matrix = scilab('[8, 12, 19; 7, 3, 2; 12, 4, 23; 8, 1, 1]')
124
+ sage: my_matrix.set(2,3, 1999)
125
+ sage: my_matrix
126
+ 8. 12. 19.
127
+ 7. 3. 1999.
128
+ 12. 4. 23.
129
+ 8. 1. 1.
130
+ sage: my_matrix[2,3] = -126
131
+ sage: my_matrix
132
+ 8. 12. 19.
133
+ 7. 3. - 126.
134
+ 12. 4. 23.
135
+ 8. 1. 1.
136
+
137
+ TESTS::
138
+
139
+ sage: # optional - scilab
140
+ sage: M = scilab(x)
141
+ Traceback (most recent call last):
142
+ ...
143
+ TypeError: ..._interface_init_() takes exactly one argument (0 given)
144
+ sage: M = scilab(matrix(3,range(9))); M
145
+ 0. 1. 2.
146
+ 3. 4. 5.
147
+ 6. 7. 8.
148
+ sage: M(10)
149
+ Traceback (most recent call last):
150
+ ...
151
+ TypeError: Error executing code in Scilab
152
+ ...
153
+ Invalid index.
154
+ sage: M[10]
155
+ Traceback (most recent call last):
156
+ ...
157
+ TypeError: Error executing code in Scilab
158
+ ...
159
+ Invalid index.
160
+ sage: M(4,2)
161
+ Traceback (most recent call last):
162
+ ...
163
+ TypeError: Error executing code in Scilab
164
+ ...
165
+ Invalid index.
166
+ sage: M[2,4]
167
+ Traceback (most recent call last):
168
+ ...
169
+ TypeError: Error executing code in Scilab
170
+ ...
171
+ Invalid index.
172
+ sage: M(9) = x
173
+ Traceback (most recent call last):
174
+ ...
175
+ SyntaxError: can...t assign to function call (..., line 1)
176
+
177
+ AUTHORS:
178
+
179
+ - Ronan Paixao (2008-11-26), based on the MATLAB tutorial by
180
+ William Stein (2006-10-11)
181
+ """
182
+ # ****************************************************************************
183
+ # Copyright (C) 2006 William Stein <wstein@gmail.com>
184
+ # Copyright (C) 2008 Ronan Paixao <ronanpaixao@yahoo.com.br>
185
+ #
186
+ # Distributed under the terms of the GNU General Public License (GPL).
187
+ #
188
+ # This code is distributed in the hope that it will be useful,
189
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
190
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
191
+ # General Public License for more details.
192
+ #
193
+ # The full text of the GPL is available at:
194
+ #
195
+ # https://www.gnu.org/licenses/
196
+ # ****************************************************************************
197
+
198
+ import os
199
+
200
+ from .expect import Expect, ExpectElement
201
+ from sage.misc.instancedoc import instancedoc
202
+
203
+
204
+ class Scilab(Expect):
205
+ """
206
+ Interface to the Scilab interpreter.
207
+
208
+ EXAMPLES::
209
+
210
+ sage: # optional - scilab
211
+ sage: a = scilab('[ 1, 1, 2; 3, 5, 8; 13, 21, 33 ]')
212
+ sage: b = scilab('[ 1; 3; 13]')
213
+ sage: c = a * b
214
+ sage: print(c)
215
+ 30.
216
+ 122.
217
+ 505.
218
+ """
219
+ def __init__(self, maxread=None, script_subdirectory=None,
220
+ logfile=None, server=None, server_tmpdir=None,
221
+ seed=None):
222
+ """
223
+ Initialize the Scilab class.
224
+
225
+ EXAMPLES::
226
+
227
+ sage: from sage.interfaces.scilab import Scilab
228
+ sage: sci_obj = Scilab()
229
+ sage: del sci_obj
230
+ """
231
+ Expect.__init__(self,
232
+ name='scilab',
233
+ prompt='-->',
234
+ command="scilab -nw",
235
+ server=server,
236
+ server_tmpdir=server_tmpdir,
237
+ script_subdirectory=script_subdirectory,
238
+ restart_on_ctrlc=False,
239
+ verbose_start=False,
240
+ logfile=logfile,
241
+ eval_using_file_cutoff=100)
242
+ self._seed = seed
243
+
244
+ def set_seed(self, seed=None):
245
+ """
246
+ Set the seed for gp interpreter.
247
+
248
+ The seed should be an integer.
249
+
250
+ EXAMPLES::
251
+
252
+ sage: # optional - scilab
253
+ sage: from sage.interfaces.scilab import Scilab
254
+ sage: s = Scilab()
255
+ sage: s.set_seed(1)
256
+ 1
257
+ sage: [s.rand() for i in range(5)]
258
+ [
259
+ <BLANKLINE>
260
+ 0.6040239,
261
+ <BLANKLINE>
262
+ 0.0079647,
263
+ <BLANKLINE>
264
+ 0.6643966,
265
+ <BLANKLINE>
266
+ 0.9832111,
267
+ <BLANKLINE>
268
+ 0.5321420]
269
+ """
270
+ if seed is None:
271
+ seed = self.rand_seed()
272
+ self.eval("rand('seed',%d)" % seed)
273
+ self._seed = seed
274
+ return seed
275
+
276
+ def _quit_string(self):
277
+ """
278
+ Return the string used to quit the pexpect interface.
279
+
280
+ EXAMPLES::
281
+
282
+ sage: scilab._quit_string() # optional - scilab
283
+ 'quit;'
284
+ """
285
+ return 'quit;'
286
+
287
+ def _install_hints(self):
288
+ """
289
+ Hints for installing Scilab.
290
+
291
+ EXAMPLES::
292
+
293
+ sage: print(scilab._install_hints()) # optional - scilab
294
+ You must ...
295
+ """
296
+ return """
297
+ You must obtain the Scilab program in order to use Scilab
298
+ from Sage. You can read all about Scilab at
299
+ http://www.scilab.org/
300
+ The executable must be accessible system-wide.
301
+ """
302
+
303
+ def _start(self):
304
+ """
305
+ Starts Scilab and sets some options.
306
+
307
+ EXAMPLES::
308
+
309
+ sage: scilab._start() # optional - scilab
310
+ """
311
+ Expect._start(self)
312
+ self.eval("mode(0)")
313
+
314
+ # set random seed
315
+ self.set_seed(self._seed)
316
+
317
+ def eval(self, command, *args, **kwds):
318
+ """
319
+ Evaluates commands.
320
+
321
+ EXAMPLES::
322
+
323
+ sage: scilab.eval("5") # optional - scilab
324
+ 'ans =\n \n 5.'
325
+ sage: scilab.eval("d=44") # optional - scilab
326
+ 'd =\n \n 44.'
327
+ """
328
+ s = Expect.eval(self, command, **kwds)
329
+ return s.replace("\x1b[?1l\x1b>", "").strip()
330
+
331
+ def whos(self, name=None, typ=None):
332
+ """
333
+ Return information about current objects.
334
+ Arguments:
335
+ nam: first characters of selected names
336
+ typ: name of selected Scilab variable type
337
+
338
+ EXAMPLES::
339
+
340
+ sage: scilab.whos("core") # optional - scilab
341
+ 'Name Type Size Bytes...'
342
+ sage: scilab.whos(typ='function') # optional - scilab
343
+ 'Name Type Size Bytes...'
344
+ """
345
+ parameters = ""
346
+ if name:
347
+ parameters += " -name %s" % (str(name))
348
+ if typ:
349
+ parameters += " -type %s" % (str(typ))
350
+ return self.eval('whos' + parameters)
351
+
352
+ def set(self, var, value):
353
+ """
354
+ Set the variable var to the given value.
355
+
356
+ EXAMPLES::
357
+
358
+ sage: scilab.set('a', 123) # optional - scilab
359
+ sage: scilab.get('a') # optional - scilab
360
+ '\n \n 123.'
361
+ """
362
+ cmd = '%s=%s;' % (var, value)
363
+ out = self.eval(cmd)
364
+ if out.find("error") != -1:
365
+ raise TypeError("Error executing code in Scilab\nCODE:\n\t%s\nScilab ERROR:\n\t%s" % (cmd, out))
366
+
367
+ def get(self, var):
368
+ """
369
+ Get the value of the variable ``var``.
370
+
371
+ EXAMPLES::
372
+
373
+ sage: scilab.eval('b=124;') # optional - scilab
374
+ ''
375
+ sage: scilab.get('b') # optional - scilab
376
+ '\n \n 124.'
377
+ """
378
+ s = self.eval(f'{var}')
379
+ i = s.find('=')
380
+ return s[i+1:]
381
+
382
+ def console(self):
383
+ """
384
+ Starts Scilab console.
385
+
386
+ EXAMPLES::
387
+
388
+ sage: scilab.console() # optional - scilab; not tested
389
+ """
390
+ scilab_console()
391
+
392
+ def version(self):
393
+ """
394
+ Return the version of the Scilab software used.
395
+
396
+ EXAMPLES::
397
+
398
+ sage: scilab.version() # optional - scilab
399
+ 'scilab-...'
400
+ """
401
+ return scilab_version()
402
+
403
+ def sage2scilab_matrix_string(self, A):
404
+ """
405
+ Return a Scilab matrix from a Sage matrix.
406
+
407
+ INPUT:
408
+
409
+ - ``A`` -- Sage matrix with entries in the rationals or reals
410
+
411
+ OUTPUT: string that evaluates to a Scilab matrix
412
+
413
+ EXAMPLES::
414
+
415
+ sage: M33 = MatrixSpace(QQ,3,3) # optional - scilab
416
+ sage: A = M33([1,2,3,4,5,6,7,8,0]) # optional - scilab
417
+ sage: scilab.sage2scilab_matrix_string(A) # optional - scilab
418
+ '[1, 2, 3; 4, 5, 6; 7, 8, 0]'
419
+ """
420
+ s = str(A.rows())
421
+ return s.replace('), (', '; ').replace('(', '').replace(')', '')
422
+
423
+ def _object_class(self):
424
+ """
425
+ Return the class of the object.
426
+
427
+ EXAMPLES::
428
+
429
+ sage: scilab._object_class() # optional - scilab
430
+ <class 'sage.interfaces.scilab.ScilabElement'>
431
+ sage: type(scilab(2)) # optional - scilab
432
+ <class 'sage.interfaces.scilab.ScilabElement'>
433
+ """
434
+ return ScilabElement
435
+
436
+
437
+ @instancedoc
438
+ class ScilabElement(ExpectElement):
439
+ def __getitem__(self, n):
440
+ """
441
+ Use parenthesis for Scilab matrices instead.
442
+
443
+ EXAMPLES::
444
+
445
+ sage: # optional - scilab
446
+ sage: M = scilab('[1,2,3;4,5,6;7,8,9]')
447
+ sage: M[1]
448
+ 1.
449
+ sage: M[7]
450
+ 3.
451
+ sage: M[3,2]
452
+ 8.
453
+ """
454
+ if isinstance(n, tuple):
455
+ index = str(n)[1:-1]
456
+ else:
457
+ index = str(n)
458
+ return self.parent()('%s(%s)' % (self._name, index))
459
+
460
+ def __setitem__(self, n, value):
461
+ """
462
+ Set an element of a matrix.
463
+
464
+ EXAMPLES::
465
+
466
+ sage: # optional - scilab
467
+ sage: M = scilab('[1,2,3;4,5,6;7,8,9]')
468
+ sage: M[6] = 0
469
+ sage: M
470
+ 1. 2. 3.
471
+ 4. 5. 6.
472
+ 7. 0. 9.
473
+ sage: M[3,2] = 10
474
+ sage: M
475
+ 1. 2. 3.
476
+ 4. 5. 6.
477
+ 7. 10. 9.
478
+ """
479
+ if isinstance(n, tuple):
480
+ index = str(n)[1:-1]
481
+ else:
482
+ index = str(n)
483
+ self.parent().eval('%s(%s) = %s' % (self._name, index, value))
484
+
485
+ def _matrix_(self, R):
486
+ r"""
487
+ Return \sage matrix from this scilab element.
488
+
489
+ EXAMPLES::
490
+
491
+ sage: # optional - scilab
492
+ sage: A = scilab('[1,2;3,4]')
493
+ sage: matrix(ZZ, A)
494
+ [1 2]
495
+ [3 4]
496
+ sage: A = scilab('[1,2;3,4.5]')
497
+ sage: matrix(RR, A)
498
+ [1.00000000000000 2.00000000000000]
499
+ [3.00000000000000 4.50000000000000]
500
+ """
501
+ from sage.matrix.matrix_space import MatrixSpace
502
+ s = str(self).strip()
503
+ v = s.split('\n ')
504
+ nrows = len(v)
505
+ if nrows == 0:
506
+ return MatrixSpace(R, 0, 0)(0)
507
+ ncols = len(v[0].split())
508
+ M = MatrixSpace(R, nrows, ncols)
509
+ v = sum([[x.rstrip('.') for x in w.split()] for w in v], [])
510
+ return M(v)
511
+
512
+ def set(self, i, j, x):
513
+ """
514
+ Set the variable var to the given value.
515
+
516
+ EXAMPLES::
517
+
518
+ sage: scilab.set('c', 125) # optional - scilab
519
+ sage: scilab.get('c') # optional - scilab
520
+ '\n \n 125.'
521
+ """
522
+ P = self._check_valid()
523
+ z = P(x)
524
+ P.eval('%s(%s,%s) = %s' % (self.name(), i, j, z.name()))
525
+
526
+
527
+ # An instance
528
+ scilab = Scilab()
529
+
530
+
531
+ def scilab_console():
532
+ """
533
+ This requires that the optional Scilab program be installed and in
534
+ your PATH, but no optional Sage packages need to be installed.
535
+
536
+ EXAMPLES::
537
+
538
+ sage: from sage.interfaces.scilab import scilab_console # optional - scilab
539
+ sage: scilab_console() # optional - scilab; not tested
540
+ ___________________________________________
541
+ scilab-5.0.3
542
+
543
+ Consortium Scilab (DIGITEO)
544
+ Copyright (c) 1989-2008 (INRIA)
545
+ Copyright (c) 1989-2007 (ENPC)
546
+ ___________________________________________
547
+
548
+
549
+ Startup execution:
550
+ loading initial environment
551
+
552
+ -->2+3
553
+ ans =
554
+
555
+ 5.
556
+
557
+ -->quit
558
+
559
+ Typing quit exits the Scilab console and returns you to Sage.
560
+ Scilab, like Sage, remembers its history from one session to
561
+ another.
562
+ """
563
+ os.system('scilab -nw')
564
+
565
+
566
+ def scilab_version():
567
+ """
568
+ Return the version of Scilab installed.
569
+
570
+ EXAMPLES::
571
+
572
+ sage: from sage.interfaces.scilab import scilab_version # optional - scilab
573
+ sage: scilab_version() # optional - scilab
574
+ 'scilab-...'
575
+ """
576
+ return str(scilab('getversion()')).strip()
@@ -0,0 +1,81 @@
1
+ """
2
+ TESTS:
3
+
4
+ We test coercions::
5
+
6
+ sage: 2 * gp('2')
7
+ 4
8
+ sage: a = 2 * gp('2'); a
9
+ 4
10
+ sage: parent(a)
11
+ PARI/GP interpreter
12
+ sage: a = 2 * gap('2'); a
13
+ 4
14
+ sage: parent(a)
15
+ Gap
16
+ sage: a = 2 * maxima('2'); a # needs sage.symbolic
17
+ 4
18
+ sage: parent(a) # needs sage.symbolic
19
+ Maxima
20
+ sage: a = 2 * singular('2'); a
21
+ 4
22
+ sage: parent(a)
23
+ Singular
24
+
25
+ Test that write errors to stderr are handled gracefully by GAP
26
+ (see :issue:`13211`) and other interfaces::
27
+
28
+ sage: import subprocess
29
+ sage: try:
30
+ ....: f = open('/dev/full', 'w')
31
+ ....: except IOError:
32
+ ....: f = open('/dev/null', 'w')
33
+ sage: kwds = dict(shell=True, stdout=f, stderr=f)
34
+ sage: subprocess.call("echo syntax error | gap", **kwds) in (0, 1)
35
+ True
36
+ sage: subprocess.call("echo syntax error | gp", **kwds)
37
+ 0
38
+ sage: subprocess.call("echo syntax error | ipython", **kwds) in (0, 1, 120)
39
+ True
40
+ sage: subprocess.call("echo syntax error | Singular", **kwds)
41
+ 0
42
+ sage: f.close()
43
+ """
44
+ import sys
45
+
46
+ from .all import *
47
+ from sage.misc.timing import cputime, walltime
48
+
49
+
50
+ def manyvars(s, num=70000, inlen=1, step=2000):
51
+ """
52
+ Test that > 65,000 variable names works in each system.
53
+ """
54
+ print(f"Testing -- {s}")
55
+ t = '"%s"' % ('9' * int(inlen))
56
+ try:
57
+ t = cputime()
58
+ w = walltime()
59
+ v = []
60
+ for i in range(num):
61
+ if not i % step:
62
+ sys.stdout.write(f'{i} ')
63
+ sys.stdout.flush()
64
+ v.append(s(t))
65
+ print('\nsuccess -- time = cpu: %s, wall: %s' % (cputime(t),
66
+ walltime(w)))
67
+ except Exception:
68
+ print("%s -- failed!" % s)
69
+
70
+
71
+ def manyvars_all(num=70000):
72
+ # for s in [gap, gp, singular, kash, magma, octave, maxima, mathematica]:
73
+ for s in [kash, magma, octave, maxima, mathematica]:
74
+ manyvars(s, num)
75
+
76
+ # bad: maple -- infinite loop -- exception pexpect.EOF: <pexpect.EOF instance at 0xb091250c> in ignored
77
+
78
+
79
+ def manyvars_all2(num=70000):
80
+ for s in [singular, maxima, mathematica, octave]:
81
+ manyvars(s, num)
sage/libs/all.py ADDED
@@ -0,0 +1,11 @@
1
+ from sage.libs.all__sagemath_combinat import *
2
+ from sage.libs.all__sagemath_gap import *
3
+ from sage.libs.all__sagemath_flint import *
4
+ from sage.libs.all__sagemath_ntl import *
5
+ from sage.libs.all__sagemath_pari import *
6
+ from sage.libs.all__sagemath_eclib import *
7
+
8
+ try:
9
+ from sage.libs.all__sagemath_symbolics import *
10
+ except ImportError:
11
+ pass
File without changes