Ask Your Question

osr's profile - activity

2021-03-13 14:06:06 +0200 received badge  Popular Question (source)
2020-12-22 09:38:06 +0200 received badge  Taxonomist
2016-08-10 12:44:18 +0200 received badge  Nice Question (source)
2016-08-10 11:06:26 +0200 commented answer Equivalent to Singular's minpoly?

That is exactly what I needed, thank you!

Just one follow-up question, how would I do this for a finite field like GF(5) instead of QQ?

2016-08-10 10:29:38 +0200 received badge  Editor (source)
2016-08-10 10:21:55 +0200 asked a question Equivalent to Singular's minpoly?

Hello everyone

In Singular, one can define a ring such as

ring r = (0,i),(x,y),dp;
minpoly = i2+1;

in order to specify that the parameter i verifies i²+1=0. Can I do this, or is it at all needed to work with Q(i), in Sage?

As of now, I have defined a ring

K.<x,y,I>=QQ[]

but I don't know if defining I as a parameter of the ring in Sage is needed, neither how could I define the minimal polynomial for K.

Thank you.

Edit: I discovered I can simplify each polynomial using .mod(I^2+1) but I guess there has to be a more general solution that applies this to the ring itself.

2016-08-10 10:13:39 +0200 commented answer Unhandled SIGABRT when working with polynomial rings

The Pari build log didn't have any errors in it, but your suggestion of rebuilding Sage and running a self check worked like a charm, thank you!

2016-08-09 11:19:14 +0200 commented question Unhandled SIGABRT when working with polynomial rings

@FrédéricC You are right, but even if I declare the ring with I as a variable K.<a1,b1,a2,b2,x,I>=PolynomialRing(GF(32003)) I get the same SIGABRT error.

2016-08-09 10:09:38 +0200 asked a question Unhandled SIGABRT when working with polynomial rings

Hello, experts!

I am working with multivariate polynomial rings in a finite field, such as

K.<a1,b1,a2,b2,x>=PolynomialRing(GF(32003))

But when I try to define an object like this one:

c1=numerator((a1+b1*I)+(a1-b1*I)*x^(-5))

I get a SIGABRT from Sage and the program terminates giving an Ubuntu error (something like "gdb stopped working").

This pastebin shows the output: http://pastebin.com/jKEM87aS. Even though it says Saved trace to /home/slenderman/.sage/crash_logs/crash_oImBtz.log, that file is totally empty.

More information: if I use the ring over Q it works perfectly

K.<a1,b1,a2,b2,x>=QQ[]

Also, I have Sage version 7.2 compiled from the git repository.

Thank you in advanced for any help!

2016-06-21 09:10:59 +0200 received badge  Supporter (source)
2016-06-21 09:10:55 +0200 received badge  Scholar (source)
2016-06-21 09:10:51 +0200 commented answer Executing Sage with arguments from C with exec family

You must be right, because the error no longer appears. But I've run into another problem doing it this way, which is not related to Sage afaik (my guess is PVM i/o). I will accept your answer anyway, thank you!

2016-06-20 12:17:06 +0200 received badge  Student (source)
2016-06-15 17:46:50 +0200 asked a question Executing Sage with arguments from C with exec family

Hi, I'm writing a piece of software that lets me distribute executions of the type same program-multiple data in a computing server through PVM. This software has a module for Maple executions, one for C, one for Python and one for Pari. Now I'm trying to write the code for a Sage module.

The idea is that i have a master who sends tasks to several slaves, each task consists on executing the same Sage script but using different values for the variables taskId and taskArgs. The slave forks a process and executes a chunk such as this one:

            // NULL-terminated array of strings
            char **args;
            int nargs=2;
            args = (char**)malloc((nargs+1)*sizeof(char*));
            // Do not malloc for NULL
            for (i=0;i<nargs;i++)
                args[i] = malloc(BUFFER_SIZE);
            // Fill up the array with strings
            sprintf(args[0],"sage");
            sprintf(args[1],"-c \"taskId=%d;taskArgs=[%s];load('%s');\"",taskNumber,arguments,inp_programFile);
            args[2] = NULL;
            // Call the execution and check for errors
            err = execvp(args[0],args);
            perror("ERROR:: child Sage process");
            exit(err);

For example, an instance of this code would be executing

sage -c "taskId=71;taskArgs=[0,73,74,0];load('test.sage')",

where test.sage prints the arguments or whatever.

Now comes the question. If i execute the previous command from the command line i get the expected result (the two prints). However, if i execute my C program (which works corectly for Maple, C, Python and Pari using a very similar approach) i get this error:

sage-run received unknown option: -c "taskId=71;taskArgs:=[0,73,74,0];load('test.sage')"

I have already tried changing the double quotes " to single quotes ', using only a single, very simple argument from C (e.g. sage -c "print(1);"), all to no avail.

Am I missing something? How can the same command work from the command line but not when i use execvp from within C?

Thanks in advanced for any help!


(I know I could adapt my Python module to read Sage scripts, but i want a standalone module for Sage because the Python one uses sys.args and I'd like to keep the Sage scripts as simple as possible for the users of the software)