# 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.

edit retag close merge delete

Sort by ยป oldest newest most voted

When 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).

more

1

Thanks, it's working now. But I am not familiar with the term ring. Do you know some good starting point?

( 2020-02-12 09:40:06 +0200 )edit

You could start at the Simple English Wikipedia: https://simple.wikipedia.org/wiki/Rin...

( 2020-02-12 10:04:08 +0200 )edit
1

Wiki's article was good. Do you know some entry-level books on this topic/subject? I want to learn the topic in-depth.

( 2020-02-12 10:18:57 +0200 )edit
1

Personally 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.

( 2020-02-12 10:52:50 +0200 )edit
1

Any "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.

( 2020-02-12 17:57:15 +0200 )edit