Ask Your Question

Error while creating augmented matrix: TypeError: unable to convert a to an integer

asked 2020-02-12 07:33:26 +0200

gg gravatar image

I am trying to create augmented matrix containing variables a and b, using the following code:

sage: u = Matrix([
....: [1, -1],
....: [2,  1]
....: ])
sage: var('a, b')
(a, b)
sage: w = vector([ a, b])
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 flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-02-12 08:54:44 +0200

rburing gravatar image

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

edit flag offensive delete link more



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

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

You could start at the Simple English Wikipedia:

rburing gravatar imagerburing ( 2020-02-12 10:04:08 +0200 )edit

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

gg gravatar imagegg ( 2020-02-12 10:18:57 +0200 )edit

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.

rburing gravatar imagerburing ( 2020-02-12 10:52:50 +0200 )edit

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.

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2020-02-12 07:33:26 +0200

Seen: 776 times

Last updated: Feb 12 '20