Calculate Determinant of Matrix in C++ - Get Help Now!

  • Context: C/C++ 
  • Thread starter Thread starter Caesar_Rahil
  • Start date Start date
  • Tags Tags
    Matrix
Click For Summary

Discussion Overview

The discussion revolves around calculating the determinant of a matrix in C++, with a focus on generalizing the approach beyond 3x3 matrices. Participants explore programming techniques, particularly recursion, to achieve this goal.

Discussion Character

  • Homework-related, Technical explanation, Exploratory

Main Points Raised

  • One participant describes their current capability to calculate the determinant of a 3x3 matrix but seeks guidance on generalizing the method.
  • Another participant explains that the determinant of a 1x1 matrix is simply the value of that element and suggests expanding the determinant calculation for an n by n matrix by removing rows or columns.
  • A participant expresses confusion about the explanation and seeks clarification on specific aspects of the determinant calculation.
  • Further inquiries arise regarding how to declare a determinant variable in C++, manage memory allocation, and implement recursion effectively while specifying matrix dimensions.

Areas of Agreement / Disagreement

Participants express varying levels of understanding regarding the determinant calculation and programming implementation, indicating that the discussion remains unresolved with multiple questions and uncertainties present.

Contextual Notes

Participants have not reached a consensus on the best approach to implement the determinant calculation in C++, and there are unresolved questions about memory management and recursion specifics.

Caesar_Rahil
Messages
69
Reaction score
0
Hello...
I am trying to build a program that calculates the calculates the determinant of a matrix. IN C++
I could do that to 3x3 matrix, but I was thinking of generalizing it.
I am unable to find a way to do that, the only hint I can get from mathematics is that I can use recursion to break my matrix into smaller matrices. Still i am stumped, can anybody help me out?please
 
Technology news on Phys.org
Well, the determinant of a one by one matrix A is simply A[1, 1].
For an n by n matrix, you can expand along rows or columns, and proceed just as you would do by "hand". So summing over i = 1 to n, take out the first row, nth column (or nth row, first column) and calculate the determinant of the remaining matrix (which is then (n - 1) x (n - 1), of course).
 
Still didn't get it
 
What don't you get?
How to calculate a determinant?
How to program it?
What recursion is?
 
Firstly how do i declare a determinant. Since its variable, i have to allocate memory at runtime. Plus, how do i arrange for recursion as i have to specify dimension of determinant at each step??
 

Similar threads

Replies
3
Views
2K
  • · Replies 14 ·
Replies
14
Views
5K
Replies
5
Views
2K
  • · Replies 17 ·
Replies
17
Views
3K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 17 ·
Replies
17
Views
4K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
Replies
13
Views
2K