Ask Your Question
1

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

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

gg gravatar image

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 flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

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

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

Comments

1

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 +0100 )edit

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

rburing gravatar imagerburing ( 2020-02-12 10:04:08 +0100 )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.

gg gravatar imagegg ( 2020-02-12 10:18:57 +0100 )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.

rburing gravatar imagerburing ( 2020-02-12 10:52:50 +0100 )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.

nbruin gravatar imagenbruin ( 2020-02-12 17:57:15 +0100 )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

Stats

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

Seen: 1,141 times

Last updated: Feb 12 '20