Results 1 to 3 of 3
Thread: Determinant of matrix
- 07-03-2011, 05:39 AM #1Member
- Join Date
- Jul 2011
- Rep Power
Determinant of matrix
The determinant of a matrix can be cal- culated by taking performing the following for every entry in the 0th row of a matrix.
(a) If the matrix has only 1 row and 1 column, then the determinant is just whatever that 1 entry is.
(b) Otherwise, for a number in the ith column (starting from zero) and 0th row, cross off (temporarily) the entire ith column and 0th row.
(c) The resulting matrix has 1 fewer row and 1 fewer column after crossing them off. Take the determinant of this matrix and multiply the result by the value in the ith column and 0th row.
(d) If i is odd, multiply the result by negative 1. (e) Sum up all such results.
USING RECURSION write a method to calculate the determinant of a matrix.
The header should look something like this:
public static int calculateDeterminant(int m)
- 07-03-2011, 05:53 AM #2Moderator
- Join Date
- Feb 2009
- New Zealand
- Rep Power
Hi osenna, welcome to the forum.
I'm sure you don't expect anyone here to do your homework for you! (for this or the other 3 posts) But to get started and provide some help we need to know what the problem is: not the assignment you were given, but the problem you have doing that assignment.
Do you understand the assignment? If not, what questions do you have about it?
Have you written code to attempt to do what the assignment asks? If you have and there are compiler messages that you can't understand, post the code and the entire compiler message(s).
Does your program compile sucessfully but do something weird at runtime? (throw an exception, or give a result that you know is incorrect). If so, post the code and say what the actual behaviour at runtime is, and what you were expecting to happen.
I guess this observation and these questions apply to your other posts, although I haven't read them in any detail.
Let's close all of the homework dump threads and start over. Osenna, I invite you to repost any questions that you have, but please show your work and ask a specific question. Repeatedly posting homework or interview dumps can result in your being banned.
Last edited by Fubarable; 07-03-2011 at 06:00 AM.
- By Albert in forum Advanced JavaReplies: 7Last Post: 09-06-2011, 09:50 AM
- By atomant in forum New To JavaReplies: 11Last Post: 12-05-2010, 09:10 AM
- By metrokid in forum New To JavaReplies: 1Last Post: 12-04-2010, 01:48 PM
- By Engineer in forum New To JavaReplies: 7Last Post: 10-06-2010, 02:26 PM
- By susan in forum New To JavaReplies: 1Last Post: 08-07-2007, 05:37 AM