Ask Your Question
2

condition number of a matrix

asked 8 years ago

srobbert gravatar image

updated 7 years ago

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!

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 8 years ago

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 
15.7271056154     

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

Type A.condition? for further examples.

Preview: (hide)
link

Comments

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

kcrisman gravatar imagekcrisman ( 8 years ago )
1

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

mforets gravatar imagemforets ( 8 years ago )
1

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

Best to you!

srobbert gravatar imagesrobbert ( 8 years ago )

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: 8 years ago

Seen: 1,564 times

Last updated: Feb 09 '17