Ask Your Question
1

condition number of a matrix

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

srobbert 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
1

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 
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 15:28:51 -0500 )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 15:39:22 -0500 )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-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

Stats

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

Seen: 30 times

Last updated: Feb 09