ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 16 Feb 2020 08:16:44 +0100Error while creating augmented matrix: TypeError: unable to convert a to an integerhttps://ask.sagemath.org/question/49882/error-while-creating-augmented-matrix-typeerror-unable-to-convert-a-to-an-integer/ I am trying to create augmented matrix containing variables `a` and `b`, using the following code:
sage:
sage: u = Matrix([
....: [1, -1],
....: [2, 1]
....: ])
sage:
sage: var('a, b')
(a, b)
sage:
sage: w = vector([ a, b])
sage:
sage: u.augment(w, subdivide=True)
The last line, `u.augment(w, subdivide=True)`, is giving me `TypeError: unable to convert a to an integer`.Wed, 12 Feb 2020 07:33:26 +0100https://ask.sagemath.org/question/49882/error-while-creating-augmented-matrix-typeerror-unable-to-convert-a-to-an-integer/Answer by rburing for <p>I am trying to create augmented matrix containing variables <code>a</code> and <code>b</code>, using the following code:</p>
<pre><code>sage:
sage: u = Matrix([
....: [1, -1],
....: [2, 1]
....: ])
sage:
sage: var('a, b')
(a, b)
sage:
sage: w = vector([ a, b])
sage:
sage: u.augment(w, subdivide=True)
</code></pre>
<p>The last line, <code>u.augment(w, subdivide=True)</code>, is giving me <code>TypeError: unable to convert a to an integer</code>.</p>
https://ask.sagemath.org/question/49882/error-while-creating-augmented-matrix-typeerror-unable-to-convert-a-to-an-integer/?answer=49883#post-id-49883When you defined the matrix `u` you didn't specify a base ring, so SageMath reasonably guessed it to be the integers `ZZ`. Hence the error.
The solution is to always specify the base ring, like `u = Matrix(SR, [[...`.
You can also change the base ring later, e.g. `u = u.change_ring(SR)`.Wed, 12 Feb 2020 08:54:44 +0100https://ask.sagemath.org/question/49882/error-while-creating-augmented-matrix-typeerror-unable-to-convert-a-to-an-integer/?answer=49883#post-id-49883Comment by gg for <p>When you defined the matrix <code>u</code> you didn't specify a base ring, so SageMath reasonably guessed it to be the integers <code>ZZ</code>. Hence the error.</p>
<p>The solution is to always specify the base ring, like <code>u = Matrix(SR, [[...</code>.</p>
<p>You can also change the base ring later, e.g. <code>u = u.change_ring(SR)</code>.</p>
https://ask.sagemath.org/question/49882/error-while-creating-augmented-matrix-typeerror-unable-to-convert-a-to-an-integer/?comment=49884#post-id-49884Thanks, it's working now. But I am not familiar with the term `ring`. Do you know some good starting point?Wed, 12 Feb 2020 09:40:06 +0100https://ask.sagemath.org/question/49882/error-while-creating-augmented-matrix-typeerror-unable-to-convert-a-to-an-integer/?comment=49884#post-id-49884Comment by rburing for <p>When you defined the matrix <code>u</code> you didn't specify a base ring, so SageMath reasonably guessed it to be the integers <code>ZZ</code>. Hence the error.</p>
<p>The solution is to always specify the base ring, like <code>u = Matrix(SR, [[...</code>.</p>
<p>You can also change the base ring later, e.g. <code>u = u.change_ring(SR)</code>.</p>
https://ask.sagemath.org/question/49882/error-while-creating-augmented-matrix-typeerror-unable-to-convert-a-to-an-integer/?comment=49885#post-id-49885You could start at the Simple English Wikipedia: https://simple.wikipedia.org/wiki/Ring_(mathematics)Wed, 12 Feb 2020 10:04:08 +0100https://ask.sagemath.org/question/49882/error-while-creating-augmented-matrix-typeerror-unable-to-convert-a-to-an-integer/?comment=49885#post-id-49885Comment by gg for <p>When you defined the matrix <code>u</code> you didn't specify a base ring, so SageMath reasonably guessed it to be the integers <code>ZZ</code>. Hence the error.</p>
<p>The solution is to always specify the base ring, like <code>u = Matrix(SR, [[...</code>.</p>
<p>You can also change the base ring later, e.g. <code>u = u.change_ring(SR)</code>.</p>
https://ask.sagemath.org/question/49882/error-while-creating-augmented-matrix-typeerror-unable-to-convert-a-to-an-integer/?comment=49886#post-id-49886Wiki's article was good. Do you know some entry-level books on this topic/subject? I want to learn the topic in-depth.Wed, 12 Feb 2020 10:18:57 +0100https://ask.sagemath.org/question/49882/error-while-creating-augmented-matrix-typeerror-unable-to-convert-a-to-an-integer/?comment=49886#post-id-49886Comment by rburing for <p>When you defined the matrix <code>u</code> you didn't specify a base ring, so SageMath reasonably guessed it to be the integers <code>ZZ</code>. Hence the error.</p>
<p>The solution is to always specify the base ring, like <code>u = Matrix(SR, [[...</code>.</p>
<p>You can also change the base ring later, e.g. <code>u = u.change_ring(SR)</code>.</p>
https://ask.sagemath.org/question/49882/error-while-creating-augmented-matrix-typeerror-unable-to-convert-a-to-an-integer/?comment=49887#post-id-49887Personally I learned it from lecture notes in Dutch, but I also liked *A Book of Abstract Algebra* by Pinter. Like most books on abstract algebra it starts with groups and takes a while to get to rings. An example of a "rings first" book is *Abstract Algebra: A Geometric Approach* by Shifrin; it looks nice but I haven't read it.Wed, 12 Feb 2020 10:52:50 +0100https://ask.sagemath.org/question/49882/error-while-creating-augmented-matrix-typeerror-unable-to-convert-a-to-an-integer/?comment=49887#post-id-49887Comment by nbruin for <p>When you defined the matrix <code>u</code> you didn't specify a base ring, so SageMath reasonably guessed it to be the integers <code>ZZ</code>. Hence the error.</p>
<p>The solution is to always specify the base ring, like <code>u = Matrix(SR, [[...</code>.</p>
<p>You can also change the base ring later, e.g. <code>u = u.change_ring(SR)</code>.</p>
https://ask.sagemath.org/question/49882/error-while-creating-augmented-matrix-typeerror-unable-to-convert-a-to-an-integer/?comment=49890#post-id-49890Any "abstract algebra" book would work. For a "rings first" approach there is also Anderson-Feil's "A first course in abstract algebra", which is appropriate for an introctory course in the subject.Wed, 12 Feb 2020 17:57:15 +0100https://ask.sagemath.org/question/49882/error-while-creating-augmented-matrix-typeerror-unable-to-convert-a-to-an-integer/?comment=49890#post-id-49890Comment by gg for <p>When you defined the matrix <code>u</code> you didn't specify a base ring, so SageMath reasonably guessed it to be the integers <code>ZZ</code>. Hence the error.</p>
<p>The solution is to always specify the base ring, like <code>u = Matrix(SR, [[...</code>.</p>
<p>You can also change the base ring later, e.g. <code>u = u.change_ring(SR)</code>.</p>
https://ask.sagemath.org/question/49882/error-while-creating-augmented-matrix-typeerror-unable-to-convert-a-to-an-integer/?comment=49939#post-id-49939Thanks, I will look into it.Sun, 16 Feb 2020 08:16:44 +0100https://ask.sagemath.org/question/49882/error-while-creating-augmented-matrix-typeerror-unable-to-convert-a-to-an-integer/?comment=49939#post-id-49939