turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

Topic Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

05-05-2014 07:34 PM

how would you create a subroutine that accepts an nxn matrix, finds its inverse if the determinant is 0 or prints an error if the matrix's determinant isn't 0?

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to bri11

05-06-2014 05:30 AM

Since you have asked several elementary questions, here is a link to an article that might help: How to learn SAS/IML: Five resources for the beginner - The DO Loop

In particular, tip #4 is relevant. When you write your funtion, you will need to use the

RETURN statement

IF-THEN/ELSE statement

DET function, and

INV function

BTW, your logic is backwards: if the determinant is NOT zero, you can compute the inverse.