Ask Your Question

StrongPiccolo's profile - activity

2022-06-23 12:56:49 +0200 received badge  Notable Question (source)
2021-11-08 11:10:05 +0200 received badge  Popular Question (source)
2020-01-11 00:24:13 +0200 received badge  Editor (source)
2020-01-11 00:23:08 +0200 answered a question Running Sage in Bash

As shown by @slcoleman and @John Palmieri, the easiest way to invoke Sage via Bash is through /path/to/sage, followed by the file to be run. This can be made simpler through an alias added to ~/.bashrc or the PATH. I'll also add a small Bash script I wrote that runs a Sage file on multiple threads:

for j in {1..10}; do   echo Launching thread....;   ../sage ./loader.sage.py & done 2>/dev/null
2020-01-08 18:37:32 +0200 asked a question Running Sage in Bash

I would like to execute a Sage file from my bash, similar to how I can run 'python Documents/test.py' and have Python execute the file. Is this possible? If so, how? I'm attempting to circumvent the interpreter and automate execution.

2020-01-03 18:46:23 +0200 commented answer Sage @fork Parallel Decorator Breaking Interface to Singular

Thank you! I'm unsure of implementation, I'm using a master function that calls other functions which contain calls to Singular. I would like to spawn multiple processes of the master function with @fork. Do I need to create individual singular interfaces for each function, even if the function itself is not parallelized, just the function calling it? I can't seem to space out my code, but hopefully you can decipher the blob.

`@fork

def master(polynomial, goal): s1 = Singular() singular.current_ring = currentRing polynomial = currentPolynomial global hits reduktion = reduction(polynomial) if testForICIS(polynomial, reduktion) == True:`

2020-01-03 16:42:49 +0200 commented question Sage @fork Parallel Decorator Breaking Interface to Singular

Thanks for the comment! I'm not totally sure what you mean by create a new singular interface, in my code I've just been using singular.<command>. I can post my code if that would be illuminating. I assumed that each call to Singular via Sage was a new instance of the interface, but maybe that is a misinterpretation.

2020-01-02 16:05:40 +0200 asked a question Sage @fork Parallel Decorator Breaking Interface to Singular

Exception raised by child process with pid=1704:

Traceback (most recent call last):
File "/opt/sagemath-8.8/local/lib/python2.7/site-packages/sage/parallel/use_fork.py", line 177, in __call__
self._subprocess(f, dir, *v0)
File "/opt/sagemath-8.8/local/lib/python2.7/site-packages/sage/parallel/use_fork.py", line 302, in _subprocess
value = f(*args, **kwds)
File "<ipython-input-9-532b53e3019b>", line 167, in master
reduktion = reduction(polynomial)
File "<ipython-input-9-532b53e3019b>", line 94, in reduction
singular.set_ring(currentRing)
File "/opt/sagemath-8.8/local/lib/python2.7/site-packages/sage/interfaces/singular.py", line 1098, in set_ring
self.eval("setring %s; short=0"%R.name(), allow_semicolon=True)
File "/opt/sagemath-8.8/local/lib/python2.7/site-packages/sage/interfaces/singular.py", line 658, in eval
raise SingularError('Singular error:\n%s'%s)
SingularError: Singular error:
? sage1317 is no name of a ring/qring
? error occurred in or before STDIN line 11: `setring sage1317; short=0;`

I've been implementing parallelism on a program built in Sage MATH using its interface to Singular. I am attempting to use Sage's @fork parallel decorator, which seems to cause issues with Singular (this error does not occur if the decorator is not present). I'm very new to parallelism and am unsure what the issue here could be. Thanks for any and all help! :D

2019-02-28 11:53:17 +0200 received badge  Nice Question (source)
2019-02-27 23:28:32 +0200 commented answer Calculating Milnor Numbers of Polynomials Using Singular via Sage

You're right, I was wrongly interpreting the error. Thanks!

2019-02-27 23:28:00 +0200 received badge  Scholar (source)
2019-02-27 19:13:57 +0200 received badge  Supporter (source)
2019-02-27 18:50:36 +0200 received badge  Student (source)
2019-02-27 18:03:39 +0200 asked a question Calculating Milnor Numbers of Polynomials Using Singular via Sage

I'm using Singular via Sage Math to calculate the Milnor numbers of a large number of polynomials. For most polynomials, doing polynomial.milnor() works fine, however I am getting a -1 when I have a variable raised to a power times another variable. I have manually calculated the first Milnor number, and it should be 8. For instance:

Works fine:

sage: ring = singular.ring(0,'(x,y,z)','ds')
sage: polynomial = singular('-x2+x3-y3+xy3-z5+xz5')
sage: _=singular.lib('sing.lib')
sage: polynomial.milnor()
8

Returns error:

sage: polynomial2 = singular('y2-x3-z2x2')
sage: polynomial2.milnor()
-1

I am following these documentation pages:

  • Interface to Singular (Sage Interpreter Interfaces)
  • D.6.15.10 milnor (Singular Documentation)

I can't publish links due to low karma, sorry!

By the second page, the -1 would imply that the function is an isolated complete intersection singularity. This function does not have an ICIS to my knowledge, and I have tested several other functions which I can provide. I think that singular is interpreting the polynomial as y2-x3-z^(2x2), instead of the wanted y2-x3-(z2)(x2), but I am new to Sage and unsure of how to fix this (I attempted parentheses and it threw back an error).