Ask Your Question
2

condition number of a matrix

asked 2017-02-09 20:26:31 +0100

srobbert gravatar image

updated 2017-07-31 21:14:55 +0100

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
2

answered 2017-02-09 20:54:05 +0100

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.

edit flag offensive delete link more

Comments

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

kcrisman gravatar imagekcrisman ( 2017-02-09 22:28:51 +0100 )edit
1

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

mforets gravatar imagemforets ( 2017-02-09 22:39:22 +0100 )edit
1

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

Best to you!

srobbert gravatar imagesrobbert ( 2017-02-10 00:03:18 +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: 2017-02-09 20:26:31 +0100

Seen: 1,494 times

Last updated: Feb 09 '17