Ask Your Question

condition number of a matrix

asked 2017-02-09 13:26:31 -0500

srobbert gravatar image

updated 2017-07-31 14:14:55 -0500

FrédéricC gravatar image

I am a novice Sage user, trying to get my Linear Algebra students to use Sage, too. One part of a problem I have assigned in the past asks a student to find the condition number of a matrix. In Maple, the command is just ConditionNumber(A), where A is a defined matrix. Is there a similar command in Sage?

Thanks for any help!

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2017-02-09 13:54:05 -0500

mforets gravatar image

Yes, check the method condition, as in:

A = random_matrix(RDF, 4)
A.condition(p=2) # produces the 2-norm (spectral norm) condition number 

sv = A.singular_values(); 
max(sv)/min(sv) # to check

Type A.condition? for further examples.

edit flag offensive delete link more


I assume this method only exists for matrices over "inexact rings", correct?

kcrisman gravatar imagekcrisman ( 2017-02-09 15:28:51 -0500 )edit

@kcrisman that's accurate: both in RDF and CDF it exists, but not in ZZ, RR, QQ.

mforets gravatar imagemforets ( 2017-02-09 15:39:22 -0500 )edit

Thanks! This helps--also with the random_matrix command that I didn't ask about!

Best to you!

srobbert gravatar imagesrobbert ( 2017-02-09 17:03:18 -0500 )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: 2017-02-09 13:26:31 -0500

Seen: 392 times

Last updated: Feb 09 '17