Post a reply
Username:
Note:If not registered, provide any username. For more comfort, register here.
Subject:
Message body:
Enter your message here, it may contain no more than 60000 characters. 

Smilies
:D :) :( :o :shock: :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen:
Font size:
Font colour
Options:
BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON
Disable BBCode
Disable smilies
Do not automatically parse URLs
Confirmation of post
To prevent automated posts the board requires you to enter a confirmation code. The code is displayed in the image you should see below. If you are visually impaired or cannot otherwise read this code please contact the %sBoard Administrator%s.
Confirmation code:
Enter the code exactly as it appears. All letters are case insensitive, there is no zero.
   

Topic review - Converting Polynomial Strings into Singular Polynomials
Author Message
  Post subject:  Re: Converting Polynomial Strings into Singular Polynomials  Reply with quote
The reason:
Singular has a unary -, but no unary +.
Therefore
Code:
-2x5
is a valid polynomial,
while
Code:
+2x5
is not.
Post Posted: Fri Mar 01, 2019 11:40 am
  Post subject:  Re: Converting Polynomial Strings into Singular Polynomials  Reply with quote
This issue was fixed by moving the first term of the polynomial to the end of the polynomial.
Post Posted: Thu Feb 28, 2019 11:41 pm
  Post subject:  Converting Polynomial Strings into Singular Polynomials  Reply with quote
I'm using Singular via Sage Math, and attempting to generate random polynomials and have Singular calculate their Milnor numbers. The issue arises when I attempt to convert polynomials generated by my algorithm into ones Singular recognizes, some get through successfully while others produce an error.

This is part of a larger piece of code, however this is the error producing step and the error can be replicated outside of the rest of the code. If seeing the rest of the code would be useful, I can provide it.

Working:

Code:
singular('-1s3-8g5-8g5')
singular('-5s5+9v5+9m8')
singular('-4p5+1l9+1l9')


Non-Working:

Code:
singular('+4j2-6a7-1e5')
singular('+7f7-7w5+1d8')


Error (When a Non-Working Polynomial is Entered):

Code:
sage: R = singular.ring(0,'(j,a,e)','ds')
sage: singular('+4j2-6a7-1e5')
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-37-2b81feafe87b> in <module>()
----> 1 singular('+4j2-6a7-1e5')

/Applications/SageMath-8.6.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/interfaces/singular.pyc in __call__(self, x, type)
    796             x = str(x)[1:-1]
    797
--> 798         return SingularElement(self, type, x, False)
    799
    800     def _coerce_map_from_(self, S):

/Applications/SageMath-8.6.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/interfaces/singular.pyc in __init__(self, parent, type, value, is_name)
   1282             except SingularError as x:
   1283                 self._session_number = -1
-> 1284                 raise_(TypeError, TypeError(x), sys.exc_info()[2])
   1285             except BaseException:
   1286                 self._session_number = -1

/Applications/SageMath-8.6.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/interfaces/singular.pyc in __init__(self, parent, type, value, is_name)
   1277         if not is_name:
   1278             try:
-> 1279                 self._name = parent._create(value, type)
   1280             # Convert SingularError to TypeError for
   1281             # coercion to work properly.

/Applications/SageMath-8.6.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/interfaces/singular.pyc in _create(self, value, type)
    757         """
    758         name = self._next_var_name()
--> 759         self.set(type, name, value)
    760         return name
    761

/Applications/SageMath-8.6.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/interfaces/singular.pyc in set(self, type, name, value)
    700         cmd += '%s %s=%s;'%(type, name, value)
    701         self.__to_clear = []
--> 702         self.eval(cmd)
    703
    704     def get(self, var):

/Applications/SageMath-8.6.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/interfaces/singular.pyc in eval(self, x, allow_semicolon, strip, **kwds)
    658         # Singular actually does use that string
    659         if s.find("error occurred") != -1 or s.find("Segment fault") != -1:
--> 660             raise SingularError('Singular error:\n%s'%s)
    661
    662         if get_verbose() > 0:

TypeError: Singular error:
   ? error occurred in or before STDIN line 68: ``
   ? last reserved name was `def`
   skipping text from `4j2`


I am using the Sage Interpreter Interfaces Interface to Singular¶ documentation page.
(I can't link to it due to low karma, sorry!)
Post Posted: Thu Feb 28, 2019 5:26 pm


It is currently Fri May 13, 2022 10:55 am
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group