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.Sun, 06 Sep 2015 21:23:14 -0500Why do I get the "unable to find a common ring for all elements" error message?http://ask.sagemath.org/question/10746/why-do-i-get-the-unable-to-find-a-common-ring-for-all-elements-error-message/I was wondering if you can take a look at this cell:
http://sagecell.sagemath.org/?q=ypqhgw
and let me know why I get the error message.
ThanksSun, 17 Nov 2013 13:46:09 -0600http://ask.sagemath.org/question/10746/why-do-i-get-the-unable-to-find-a-common-ring-for-all-elements-error-message/Answer by ppurka for <p>I was wondering if you can take a look at this cell:</p>
<p><a href="http://sagecell.sagemath.org/?q=ypqhgw">http://sagecell.sagemath.org/?q=ypqhgw</a></p>
<p>and let me know why I get the error message. </p>
<p>Thanks</p>
http://ask.sagemath.org/question/10746/why-do-i-get-the-unable-to-find-a-common-ring-for-all-elements-error-message/?answer=15592#post-id-15592The variables in the MILP are not symbolic variables, i.e., not from the Symbolic Ring. The `vector()` command is failing in that step.
type(x)
<type 'sage.numerical.linear_functions.LinearFunction'>
You can rewrite your constraints like this
p.add_constraint(sum(_a*_x for _a,_x in zip(a1, [x,y])) + r*a1.norm(2) <= b1)Sun, 17 Nov 2013 14:32:30 -0600http://ask.sagemath.org/question/10746/why-do-i-get-the-unable-to-find-a-common-ring-for-all-elements-error-message/?answer=15592#post-id-15592Comment by Saul Schleimer for <p>The variables in the MILP are not symbolic variables, i.e., not from the Symbolic Ring. The <code>vector()</code> command is failing in that step.</p>
<pre><code>type(x)
<type 'sage.numerical.linear_functions.LinearFunction'>
</code></pre>
<p>You can rewrite your constraints like this</p>
<pre><code>p.add_constraint(sum(_a*_x for _a,_x in zip(a1, [x,y])) + r*a1.norm(2) <= b1)
</code></pre>
http://ask.sagemath.org/question/10746/why-do-i-get-the-unable-to-find-a-common-ring-for-all-elements-error-message/?comment=29412#post-id-29412Basically, you are reimplementing the dot product. That seems like a "bad thing". Obviously linear algebra and linear programming should play well together - can this actually be done?Sun, 06 Sep 2015 21:23:14 -0500http://ask.sagemath.org/question/10746/why-do-i-get-the-unable-to-find-a-common-ring-for-all-elements-error-message/?comment=29412#post-id-29412