ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 25 Oct 2017 03:45:48 -0500Segmentation fault when multiplying by variablehttp://ask.sagemath.org/question/39204/segmentation-fault-when-multiplying-by-variable/In Sage 7.5.1 I'm trying to work with unknown values in GF(3) and polynomials.
The following code gives me a *segmentation fault*:
P.<x> = GF(3)['x']
var('a')
sigma = 2*x+ 1
print(a*(sigma))
What is the proper way to handle unknown GF(3) values like "a" in Sage?Wed, 18 Oct 2017 15:30:48 -0500http://ask.sagemath.org/question/39204/segmentation-fault-when-multiplying-by-variable/Comment by slelievre for <p>In Sage 7.5.1 I'm trying to work with unknown values in GF(3) and polynomials.</p>
<p>The following code gives me a <em>segmentation fault</em>:</p>
<pre><code>P.<x> = GF(3)['x']
var('a')
sigma = 2*x+ 1
print(a*(sigma))
</code></pre>
<p>What is the proper way to handle unknown GF(3) values like "a" in Sage?</p>
http://ask.sagemath.org/question/39204/segmentation-fault-when-multiplying-by-variable/?comment=39234#post-id-39234This might be a duplicate of [https://trac.sagemath.org/ticket/21391](#21391).Sat, 21 Oct 2017 03:48:33 -0500http://ask.sagemath.org/question/39204/segmentation-fault-when-multiplying-by-variable/?comment=39234#post-id-39234Comment by B r u n o for <p>In Sage 7.5.1 I'm trying to work with unknown values in GF(3) and polynomials.</p>
<p>The following code gives me a <em>segmentation fault</em>:</p>
<pre><code>P.<x> = GF(3)['x']
var('a')
sigma = 2*x+ 1
print(a*(sigma))
</code></pre>
<p>What is the proper way to handle unknown GF(3) values like "a" in Sage?</p>
http://ask.sagemath.org/question/39204/segmentation-fault-when-multiplying-by-variable/?comment=39227#post-id-39227I've created [#24072](https://trac.sagemath.org/ticket/24072) to report the bug.Fri, 20 Oct 2017 02:09:36 -0500http://ask.sagemath.org/question/39204/segmentation-fault-when-multiplying-by-variable/?comment=39227#post-id-39227Comment by B r u n o for <p>In Sage 7.5.1 I'm trying to work with unknown values in GF(3) and polynomials.</p>
<p>The following code gives me a <em>segmentation fault</em>:</p>
<pre><code>P.<x> = GF(3)['x']
var('a')
sigma = 2*x+ 1
print(a*(sigma))
</code></pre>
<p>What is the proper way to handle unknown GF(3) values like "a" in Sage?</p>
http://ask.sagemath.org/question/39204/segmentation-fault-when-multiplying-by-variable/?comment=39220#post-id-39220Bug confirmed. I haven't been able to track it completely, but experimentally the bug happens when one multiplies a symbolic expression by a non-monic polynomial over some finite field.
You can report it on [trac](http://trac.sagemath.org/) and/or on [sage-devel](https://groups.google.com/forum/#!forum/sage-devel).
Concerning your last question, on possibility (depending on what is your goal) is to define a multivariate polynomial ring in `x` and `a`, using for instance `P.<x,a> = GF(3)[]`.Thu, 19 Oct 2017 11:15:31 -0500http://ask.sagemath.org/question/39204/segmentation-fault-when-multiplying-by-variable/?comment=39220#post-id-39220Comment by mforets for <p>In Sage 7.5.1 I'm trying to work with unknown values in GF(3) and polynomials.</p>
<p>The following code gives me a <em>segmentation fault</em>:</p>
<pre><code>P.<x> = GF(3)['x']
var('a')
sigma = 2*x+ 1
print(a*(sigma))
</code></pre>
<p>What is the proper way to handle unknown GF(3) values like "a" in Sage?</p>
http://ask.sagemath.org/question/39204/segmentation-fault-when-multiplying-by-variable/?comment=39218#post-id-39218same error in 8.1.beta8.Thu, 19 Oct 2017 10:47:33 -0500http://ask.sagemath.org/question/39204/segmentation-fault-when-multiplying-by-variable/?comment=39218#post-id-39218Comment by Psi for <p>In Sage 7.5.1 I'm trying to work with unknown values in GF(3) and polynomials.</p>
<p>The following code gives me a <em>segmentation fault</em>:</p>
<pre><code>P.<x> = GF(3)['x']
var('a')
sigma = 2*x+ 1
print(a*(sigma))
</code></pre>
<p>What is the proper way to handle unknown GF(3) values like "a" in Sage?</p>
http://ask.sagemath.org/question/39204/segmentation-fault-when-multiplying-by-variable/?comment=39217#post-id-39217@eric_g Yikes, should I report it somewhere?Thu, 19 Oct 2017 10:38:50 -0500http://ask.sagemath.org/question/39204/segmentation-fault-when-multiplying-by-variable/?comment=39217#post-id-39217Comment by eric_g for <p>In Sage 7.5.1 I'm trying to work with unknown values in GF(3) and polynomials.</p>
<p>The following code gives me a <em>segmentation fault</em>:</p>
<pre><code>P.<x> = GF(3)['x']
var('a')
sigma = 2*x+ 1
print(a*(sigma))
</code></pre>
<p>What is the proper way to handle unknown GF(3) values like "a" in Sage?</p>
http://ask.sagemath.org/question/39204/segmentation-fault-when-multiplying-by-variable/?comment=39205#post-id-39205Seg fault confirmed with Sage 8.1.beta5; looks a real bug...Wed, 18 Oct 2017 17:15:44 -0500http://ask.sagemath.org/question/39204/segmentation-fault-when-multiplying-by-variable/?comment=39205#post-id-39205Answer by B r u n o for <p>In Sage 7.5.1 I'm trying to work with unknown values in GF(3) and polynomials.</p>
<p>The following code gives me a <em>segmentation fault</em>:</p>
<pre><code>P.<x> = GF(3)['x']
var('a')
sigma = 2*x+ 1
print(a*(sigma))
</code></pre>
<p>What is the proper way to handle unknown GF(3) values like "a" in Sage?</p>
http://ask.sagemath.org/question/39204/segmentation-fault-when-multiplying-by-variable/?answer=39276#post-id-39276The [ticket #24072](https://trac.sagemath.org/ticket/24072) has been positively reviewed, meaning that it will be included into the next SageMath release. The solution found by developers is to forbid to mix elements from the *symbolic ring* `SR` and elements from finite fields. The reason is that the symbolic ring is inherently a ring of characteristic $0$. Your example will not result in a segmentation fault anymore, but you'll get an exception `TypeError: positive characteristic not allowed in symbolic computations`.
In your case, the solution is to work with either a multivariate polynomial ring (`P.<x, a> = GF(3)[]`), or you may want to have rational functions in `a` for instance, using `P.<x> = GF(3)[]` and `F.<a> = FractionField(P['a'])`.Wed, 25 Oct 2017 03:45:48 -0500http://ask.sagemath.org/question/39204/segmentation-fault-when-multiplying-by-variable/?answer=39276#post-id-39276