passagemath-standard-no-symbolics 10.6.45__cp313-cp313-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.
Files changed (83) hide show
  1. passagemath_standard_no_symbolics/__init__.py +1 -0
  2. passagemath_standard_no_symbolics-10.6.45.data/scripts/sage-grep +5 -0
  3. passagemath_standard_no_symbolics-10.6.45.data/scripts/sage-grepdoc +5 -0
  4. passagemath_standard_no_symbolics-10.6.45.data/scripts/sage-list-packages +103 -0
  5. passagemath_standard_no_symbolics-10.6.45.dist-info/METADATA +150 -0
  6. passagemath_standard_no_symbolics-10.6.45.dist-info/RECORD +83 -0
  7. passagemath_standard_no_symbolics-10.6.45.dist-info/WHEEL +6 -0
  8. passagemath_standard_no_symbolics-10.6.45.dist-info/top_level.txt +2 -0
  9. sage/all.py +207 -0
  10. sage/all_cmdline.py +36 -0
  11. sage/cli/__init__.py +61 -0
  12. sage/cli/__main__.py +5 -0
  13. sage/cli/eval_cmd.py +45 -0
  14. sage/cli/eval_cmd_test.py +25 -0
  15. sage/cli/interactive_shell_cmd.py +28 -0
  16. sage/cli/notebook_cmd.py +51 -0
  17. sage/cli/notebook_cmd_test.py +39 -0
  18. sage/cli/options.py +26 -0
  19. sage/cli/run_file_cmd.py +50 -0
  20. sage/cli/version_cmd.py +26 -0
  21. sage/databases/all.py +83 -0
  22. sage/databases/cubic_hecke_db.py +1527 -0
  23. sage/dynamics/all.py +31 -0
  24. sage/dynamics/surface_dynamics_deprecation.py +32 -0
  25. sage/ext_data/kenzo/CP2.txt +45 -0
  26. sage/ext_data/kenzo/CP3.txt +349 -0
  27. sage/ext_data/kenzo/CP4.txt +4774 -0
  28. sage/ext_data/kenzo/README.txt +49 -0
  29. sage/ext_data/kenzo/S4.txt +20 -0
  30. sage/ext_data/mwrank/PRIMES +1 -0
  31. sage/ext_data/nbconvert/postprocess.py +48 -0
  32. sage/ext_data/nbconvert/rst_sage.tpl +99 -0
  33. sage/ext_data/nodoctest +0 -0
  34. sage/ext_data/notebook-ipython/kernel.json.in +11 -0
  35. sage/ext_data/notebook-ipython/logo-64x64.png +0 -0
  36. sage/ext_data/notebook-ipython/logo.svg +352 -0
  37. sage/ext_data/valgrind/pyalloc.supp +58 -0
  38. sage/ext_data/valgrind/sage-additional.supp +417 -0
  39. sage/ext_data/valgrind/sage.supp +43 -0
  40. sage/ext_data/valgrind/valgrind-python.supp +480 -0
  41. sage/geometry/all.py +12 -0
  42. sage/groups/matrix_gps/pickling_overrides.py +110 -0
  43. sage/homology/tests.py +66 -0
  44. sage/interacts/algebra.py +20 -0
  45. sage/interacts/all.py +25 -0
  46. sage/interacts/calculus.py +24 -0
  47. sage/interacts/fractals.py +18 -0
  48. sage/interacts/geometry.py +19 -0
  49. sage/interacts/library.py +1950 -0
  50. sage/interacts/library_cython.cpython-313-darwin.so +0 -0
  51. sage/interacts/statistics.py +19 -0
  52. sage/interfaces/axiom.py +1002 -0
  53. sage/interfaces/kash.py +834 -0
  54. sage/interfaces/lie.py +950 -0
  55. sage/interfaces/matlab.py +413 -0
  56. sage/interfaces/mupad.py +686 -0
  57. sage/interfaces/octave.py +858 -0
  58. sage/interfaces/phc.py +943 -0
  59. sage/interfaces/psage.py +189 -0
  60. sage/interfaces/qsieve.py +4 -0
  61. sage/interfaces/r.py +2096 -0
  62. sage/interfaces/read_data.py +46 -0
  63. sage/interfaces/scilab.py +576 -0
  64. sage/interfaces/tests.py +81 -0
  65. sage/libs/all.py +11 -0
  66. sage/libs/cremona/__init__.py +0 -0
  67. sage/libs/mwrank/__init__.py +0 -0
  68. sage/logic/all.py +3 -0
  69. sage/logic/booleval.py +160 -0
  70. sage/logic/boolformula.py +1490 -0
  71. sage/logic/logic.py +856 -0
  72. sage/logic/logicparser.py +696 -0
  73. sage/logic/logictable.py +272 -0
  74. sage/logic/propcalc.py +311 -0
  75. sage/misc/all.py +28 -0
  76. sage/misc/lazy_attribute.pyi +11 -0
  77. sage/rings/all.py +48 -0
  78. sage/rings/commutative_algebra.py +38 -0
  79. sage/rings/finite_rings/all.py +21 -0
  80. sage/rings/numbers_abc.py +58 -0
  81. sage/rings/polynomial/all.py +22 -0
  82. sage/rings/polynomial/convolution.py +421 -0
  83. sage/symbolic/all__sagemath_standard_no_symbolics.py +0 -0
@@ -0,0 +1,413 @@
1
+ r"""
2
+ Interface to MATLAB
3
+
4
+ According to their website, MATLAB is "a high-level language and
5
+ interactive environment that enables you to perform computationally
6
+ intensive tasks faster than with traditional programming languages
7
+ such as C, C++, and Fortran."
8
+
9
+ The commands in this section only work if you have the "matlab"
10
+ interpreter installed and available in your PATH. It's not
11
+ necessary to install any special Sage packages.
12
+
13
+ EXAMPLES::
14
+
15
+ sage: matlab.eval('2+2') # optional - matlab
16
+ '\nans =\n\n 4\n'
17
+
18
+ ::
19
+
20
+ sage: a = matlab(10) # optional - matlab
21
+ sage: a**10 # optional - matlab
22
+ 1.0000e+10
23
+
24
+ AUTHORS:
25
+
26
+ - William Stein (2006-10-11)
27
+
28
+ Tutorial
29
+ --------
30
+
31
+ EXAMPLES::
32
+
33
+ sage: # optional - matlab
34
+ sage: matlab('4+10')
35
+ 14
36
+ sage: matlab('date')
37
+ 18-Oct-2006
38
+ sage: matlab('5*10 + 6')
39
+ 56
40
+ sage: matlab('(6+6)/3')
41
+ 4
42
+ sage: matlab('9')^2
43
+ 81
44
+ sage: a = matlab(10); b = matlab(20); c = matlab(30)
45
+ sage: avg = (a+b+c)/3 ; avg
46
+ 20
47
+ sage: parent(avg)
48
+ Matlab
49
+
50
+ ::
51
+
52
+ sage: # optional - matlab
53
+ sage: my_scalar = matlab('3.1415')
54
+ sage: my_scalar
55
+ 3.1415
56
+ sage: my_vector1 = matlab('[1,5,7]')
57
+ sage: my_vector1
58
+ 1 5 7
59
+ sage: my_vector2 = matlab('[1;5;7]')
60
+ sage: my_vector2
61
+ 1
62
+ 5
63
+ 7
64
+ sage: my_vector1 * my_vector2
65
+ 75
66
+
67
+ ::
68
+
69
+ sage: # optional - matlab
70
+ sage: row_vector1 = matlab('[1 2 3]')
71
+ sage: row_vector2 = matlab('[3 2 1]')
72
+ sage: matrix_from_row_vec = matlab('[%s; %s]'%(row_vector1.name(), row_vector2.name()))
73
+ sage: matrix_from_row_vec
74
+ 1 2 3
75
+ 3 2 1
76
+
77
+ ::
78
+
79
+ sage: # optional - matlab
80
+ sage: column_vector1 = matlab('[1;3]')
81
+ sage: column_vector2 = matlab('[2;8]')
82
+ sage: matrix_from_col_vec = matlab('[%s %s]'%(column_vector1.name(), column_vector2.name()))
83
+ sage: matrix_from_col_vec
84
+ 1 2
85
+ 3 8
86
+
87
+ ::
88
+
89
+ sage: my_matrix = matlab('[8, 12, 19; 7, 3, 2; 12, 4, 23; 8, 1, 1]') # optional - matlab
90
+ sage: my_matrix # optional - matlab
91
+ 8 12 19
92
+ 7 3 2
93
+ 12 4 23
94
+ 8 1 1
95
+
96
+ ::
97
+
98
+ sage: combined_matrix = matlab('[%s, %s]'%(my_matrix.name(), my_matrix.name())) # optional - matlab
99
+ sage: combined_matrix # optional - matlab
100
+ 8 12 19 8 12 19
101
+ 7 3 2 7 3 2
102
+ 12 4 23 12 4 23
103
+ 8 1 1 8 1 1
104
+
105
+ ::
106
+
107
+ sage: tm = matlab('0.5:2:10') # optional - matlab
108
+ sage: tm # optional - matlab
109
+ 0.5000 2.5000 4.5000 6.5000 8.5000
110
+
111
+ ::
112
+
113
+ sage: # optional - matlab
114
+ sage: my_vector1 = matlab('[1,5,7]')
115
+ sage: my_vector1(1)
116
+ 1
117
+ sage: my_vector1(2)
118
+ 5
119
+ sage: my_vector1(3)
120
+ 7
121
+
122
+ Matrix indexing works as follows::
123
+
124
+ sage: my_matrix = matlab('[8, 12, 19; 7, 3, 2; 12, 4, 23; 8, 1, 1]') # optional - matlab
125
+ sage: my_matrix(3,2) # optional - matlab
126
+ 4
127
+
128
+ Setting using parenthesis cannot work (because of how the Python
129
+ language works). Use square brackets or the set function::
130
+
131
+ sage: my_matrix = matlab('[8, 12, 19; 7, 3, 2; 12, 4, 23; 8, 1, 1]') # optional - matlab
132
+ sage: my_matrix.set(2,3, 1999) # optional - matlab
133
+ sage: my_matrix # optional - matlab
134
+ 8 12 19
135
+ 7 3 1999
136
+ 12 4 23
137
+ 8 1 1
138
+ """
139
+
140
+ # ****************************************************************************
141
+ # Copyright (C) 2006 William Stein <wstein@gmail.com>
142
+ #
143
+ # Distributed under the terms of the GNU General Public License (GPL).
144
+ #
145
+ # This code is distributed in the hope that it will be useful,
146
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
147
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
148
+ # General Public License for more details.
149
+ #
150
+ # The full text of the GPL is available at:
151
+ #
152
+ # https://www.gnu.org/licenses/
153
+ # ****************************************************************************
154
+
155
+ import os
156
+
157
+ from .expect import Expect, ExpectElement
158
+ from sage.misc.instancedoc import instancedoc
159
+
160
+
161
+ class Matlab(Expect):
162
+ """
163
+ Interface to the Matlab interpreter.
164
+
165
+ EXAMPLES::
166
+
167
+ sage: # optional - matlab
168
+ sage: a = matlab('[ 1, 1, 2; 3, 5, 8; 13, 21, 33 ]')
169
+ sage: b = matlab('[ 1; 3; 13]')
170
+ sage: c = a * b
171
+ sage: print(c)
172
+ 30
173
+ 122
174
+ 505
175
+ """
176
+ def __init__(self, maxread=None, script_subdirectory=None,
177
+ logfile=None, server=None, server_tmpdir=None):
178
+ Expect.__init__(self,
179
+ name='matlab',
180
+ prompt='>> ',
181
+ command="matlab -nodisplay",
182
+ server=server,
183
+ server_tmpdir=server_tmpdir,
184
+ script_subdirectory=script_subdirectory,
185
+ restart_on_ctrlc=False,
186
+ verbose_start=False,
187
+ logfile=logfile,
188
+ eval_using_file_cutoff=100)
189
+
190
+ def __reduce__(self):
191
+ return reduce_load_Matlab, tuple([])
192
+
193
+ def _read_in_file_command(self, filename):
194
+ """
195
+ Return the command used to read in and execute a file in Matlab.
196
+
197
+ EXAMPLES::
198
+
199
+ sage: matlab._read_in_file_command('/tmp/matlab_file')
200
+ "eval(fileread('/tmp/matlab_file'));"
201
+
202
+ Here is an indirect doctest to check that it does indeed
203
+ work::
204
+
205
+ sage: m = identity_matrix(ZZ, 10)
206
+ sage: sm = matlab.sage2matlab_matrix_string(m)
207
+ sage: m = matlab(sm) # optional - matlab
208
+ """
209
+ return "eval(fileread('{0}'));".format(filename)
210
+
211
+ def _quit_string(self):
212
+ return 'quit;'
213
+
214
+ def _install_hints(self):
215
+ return """
216
+ You must obtain the program MATLAB in order to use MATLAB
217
+ from Sage. You can read all about MATLAB at
218
+ http://www.mathworks.com/
219
+
220
+ You might have to buy MATLAB or get away with setting up a remote connection to a server running Maple. Type
221
+ print(matlab._install_hints_ssh())
222
+ for hints on how to do that).
223
+ """
224
+
225
+ def _start(self):
226
+ Expect._start(self)
227
+
228
+ def whos(self):
229
+ return self.eval('whos')
230
+
231
+ # pdehaye/20070819: This is no obsolete, see Expect._get_tmpfile_from_server and Expect._send_tmpfile_to_server
232
+
233
+ # def get_via_file(self, var_name):
234
+ # t = self._temp_file(var_name)
235
+ # self.eval('save -text "%s" %s'%(t,var_name))
236
+ # r = open(t).read()
237
+ # os.unlink(t)
238
+ # return r.strip('\n')
239
+
240
+ # def set_via_file(self, var_name, x):
241
+ # t = self._temp_file(var_name)
242
+ # open(t,'w').write(x)
243
+ # print('load "%s" %s'%(t, var_name))
244
+ # self.eval('load "%s" %s'%(t, var_name))
245
+ # #os.unlink(t)
246
+
247
+ def set(self, var, value):
248
+ """
249
+ Set the variable var to the given value.
250
+ """
251
+ cmd = '{0}={1};'.format(var, value)
252
+ out = self.eval(cmd)
253
+ if out.find("error") != -1:
254
+ raise TypeError("Error executing code in Matlab\nCODE:\n\t{0}\nMatlab ERROR:\n\t{1}".format(cmd, out))
255
+
256
+ def get(self, var):
257
+ """
258
+ Get the value of the variable var.
259
+
260
+ EXAMPLES::
261
+
262
+ sage: s = matlab.eval('a = 2') # optional - matlab
263
+ sage: matlab.get('a') # optional - matlab
264
+ ' 2'
265
+ """
266
+ s = self.eval('{0}'.format(var))
267
+ return self.strip_answer(s)
268
+
269
+ def strip_answer(self, s):
270
+ r"""
271
+ Return the string s with Matlab's answer prompt removed.
272
+
273
+ EXAMPLES::
274
+
275
+ sage: s = '\nans =\n\n 2\n'
276
+ sage: matlab.strip_answer(s)
277
+ ' 2'
278
+ """
279
+ i = s.find('=')
280
+ return s[i+1:].strip('\n')
281
+
282
+ def console(self):
283
+ matlab_console()
284
+
285
+ def version(self):
286
+ return matlab_version()[1:]
287
+
288
+ def chdir(self, directory):
289
+ """
290
+ Change MATLAB's current working directory.
291
+
292
+ EXAMPLES::
293
+
294
+ sage: matlab.chdir('/') # optional - matlab
295
+ sage: matlab.pwd() # optional - matlab
296
+ /
297
+ """
298
+ self.eval("cd('{0}')".format(directory))
299
+
300
+ def sage2matlab_matrix_string(self, A):
301
+ """
302
+ Return a matlab matrix from a Sage matrix.
303
+
304
+ INPUT:
305
+
306
+ - ``A`` -- Sage matrix with entries in the rationals or reals
307
+
308
+ OUTPUT: string that evaluates to a Matlab matrix
309
+
310
+ EXAMPLES::
311
+
312
+ sage: M33 = MatrixSpace(QQ,3,3)
313
+ sage: A = M33([1,2,3,4,5,6,7,8,0])
314
+ sage: matlab.sage2matlab_matrix_string(A) # optional - matlab
315
+ '[1, 2, 3; 4, 5, 6; 7, 8, 0]'
316
+
317
+ AUTHOR:
318
+
319
+ - David Joyner and William Stein
320
+ """
321
+ return str(A.rows()).replace('), (', '; ').replace('(', '').replace(')', '')
322
+
323
+ def _object_class(self):
324
+ return MatlabElement
325
+
326
+
327
+ @instancedoc
328
+ class MatlabElement(ExpectElement):
329
+ def __getitem__(self, n):
330
+ raise RuntimeError("Use parenthesis for MATLAB matrices instead.")
331
+
332
+ def _matrix_(self, R):
333
+ r"""
334
+ Return Sage matrix from this matlab element.
335
+
336
+ EXAMPLES::
337
+
338
+ sage: # optional - matlab
339
+ sage: A = matlab('[1,2;3,4]')
340
+ sage: matrix(ZZ, A)
341
+ [1 2]
342
+ [3 4]
343
+ sage: A = matlab('[1,2;3,4.5]')
344
+ sage: matrix(RR, A)
345
+ [1.00000000000000 2.00000000000000]
346
+ [3.00000000000000 4.50000000000000]
347
+
348
+ sage: a = matlab('eye(50)') # optional - matlab
349
+ sage: matrix(RR, a) # optional - matlab
350
+ 50 x 50 dense matrix over Real Field with 53 bits of precision
351
+ """
352
+ from sage.matrix.constructor import matrix
353
+ matlab = self.parent()
354
+ entries = matlab.strip_answer(matlab.eval("mat2str({0})".format(self.name())))
355
+ entries = entries.strip()[1:-1].replace(';', ' ')
356
+ entries = [R(_) for _ in entries.split(' ')]
357
+ nrows, ncols = map(int, str(self.size()).strip().split())
358
+ m = matrix(R, nrows, ncols, entries)
359
+ return m
360
+
361
+ def set(self, i, j, x):
362
+ P = self._check_valid()
363
+ z = P(x)
364
+ P.eval('{0}({1},{2}) = {3}'.format(self.name(), i, j, z.name()))
365
+
366
+
367
+ # An instance
368
+ matlab = Matlab()
369
+
370
+
371
+ def reduce_load_Matlab():
372
+ return matlab
373
+
374
+
375
+ def matlab_console():
376
+ """
377
+ This requires that the optional matlab program be installed and in
378
+ your PATH, but no optional Sage packages need be installed.
379
+
380
+ EXAMPLES::
381
+
382
+ sage: matlab_console() # optional - matlab; not tested
383
+ < M A T L A B >
384
+ Copyright 1984-2006 The MathWorks, Inc.
385
+ ...
386
+ >> 2+3
387
+
388
+ ans =
389
+
390
+ 5
391
+
392
+ quit
393
+
394
+ Typing quit exits the matlab console and returns you to Sage.
395
+ matlab, like Sage, remembers its history from one session to
396
+ another.
397
+ """
398
+ from sage.repl.rich_output.display_manager import get_display_manager
399
+ if not get_display_manager().is_in_terminal():
400
+ raise RuntimeError('Can use the console only in the terminal. Try %%matlab magics instead.')
401
+ os.system('matlab -nodisplay')
402
+
403
+
404
+ def matlab_version():
405
+ """
406
+ Return the version of Matlab installed.
407
+
408
+ EXAMPLES::
409
+
410
+ sage: matlab_version() # random; optional - matlab
411
+ '7.2.0.283 (R2006a)'
412
+ """
413
+ return str(matlab('version')).strip()