Find Determinant/or Row Reduce parameter dependent matrix

Click For Summary

Discussion Overview

The discussion revolves around finding the determinant of a parameter-dependent band diagonal matrix, specifically addressing challenges related to numerical stability and computational efficiency when scaling up the matrix size. Participants explore various methods for calculating the determinant and transforming the matrix, including LU decomposition and row reduction.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant describes difficulties in calculating the determinant of a large band diagonal matrix with mixed numerical and parameter entries, leading to zero determinants and overflow errors.
  • Another participant suggests starting with smaller matrices to simplify debugging and emphasizes the importance of clear examples in code for effective assistance.
  • A Mathematica file with a 10x10 matrix is shared, showing the determinant as a polynomial in κ, with varying coefficients and complex solutions for κ.
  • Concerns are raised about whether the zero determinant is due to actual zero entries in the matrix or accumulated numerical errors during calculation.
  • One participant proposes scaling the matrix to avoid overflow, while also noting the potential for underflow with small numbers in the matrix.
  • Suggestions include using Singular Value Decomposition as an alternative approach to finding the determinant and applying root-finding methods.
  • Questions arise regarding the unexpected removal of κ from the matrix during row reduction and the desire for an alternative method to achieve an upper triangular form without using the RowReduce function directly.

Areas of Agreement / Disagreement

Participants express varying opinions on the best approach to take for calculating the determinant and transforming the matrix. There is no consensus on the effectiveness of the proposed methods, and multiple competing views remain regarding the handling of numerical issues and matrix transformations.

Contextual Notes

Participants note limitations related to numerical stability, including potential overflow and underflow issues, as well as the need for careful consideration of matrix entries when scaling up the size of the matrix.

Who May Find This Useful

This discussion may be useful for those working with parameter-dependent matrices, particularly in computational contexts where numerical stability and efficiency are critical, such as in physics or engineering applications.

tau1777
Messages
29
Reaction score
0
I'm trying to find the determinant of a band diagonal matrix that has a parameter, κ, in some of the entries. Some entries are just numerical ones, others (κ X number), while others are (κ + number). I have been told that they way to solve for κ is to find the determinant of the this matrix and then find values of κ that make the determinant zero.

The main issue I'm having is that when my matrix becomes large the determinant just results to zero,and in other cases to calculation overflow. (I'm trying to work out all the bugs in the code, so det =0, might be some error I'm making, but the overflow error is not avoidable).

I have already tried an LUDecomposition on the matrix, and that seems to take forever, I don't have a problem waiting, but working out the scaling, it seemed like I would have to wait a couple of days for a 500X500 matrix, and my real problem might have to be done on a 1000X1000 matrix.

I was also thinking that maybe I could somehow get the matrix into an upper triangular form and then just multiple the diagonal elements. For this I tried using Mathematica's RowReduce command, but for some weird reason that just results in the identity matrix. I thought that row reduce might give me an upper triangular matrix with f(κ) on the diagonal , and I could just multiple the diagonal elements and get a polynomial for κ and solve.

Any and all help is greatly appreciated. I'm not really sure how to put up my code, or the matrix for that matter. That is the thing that would probably help you guys the most. If there is a way for me to put up the matrix please let me know.

Thanks again.
 
Physics news on Phys.org
Start with a 10x10 or 20x20 matrix that is very similar to what your full scale matrix will be like. Make the diagonals like you expect, the size of numbers like what you expect, with or without decimal points like you expect, etc.

Put that matrix in a notebook with the simplest clearest best example of your code that you can come up with. Attach that notebook to your next post with clear specific questions about what you need help with. That will give you the best chance of getting a correct useful answer.

Then when you are sure everything is as correct as it is going to be you can scale it up to gigabytes and months to complete
 
Hey Bill,

Thanks for the post. I've attached a Mathematica file, with a 10X10 matrix, that has the essence of my matrix.

Thanks.
 

Attachments

Thank you. This makes the question much more concrete.

In[2]:= Det[t2]

Out[2]= 2.2272666733337655*^26 + 9.645234733908778*^26*κ +
4.371330048350632*^27*κ^2 + 8.861942706420684*^25*κ^3 -
2.239345794822683*^25*κ^4 - 3.605118272791786*^24*κ^5 -
2.6482517171741852*^22*κ^6 - 3.8768184082651635*^17*κ^7

In[3]:= Solve[Det[t2]==0,κ]

Out[3]= {{κ -> -68173.53229501807}, {κ -> -129.73732341256942},
{κ -> -7.963334721970968 - 8.383566010522163*I},
{κ -> -7.963334721970968 + 8.383566010522163*I},
{κ -> -0.11026869176116452 - 0.19753775539064541*I},
{κ -> -0.11026869176116452 + 0.19753775539064541*I},
{κ -> 9.49259645600023}}

So you have a combination of moderately large coefficients, up to +/-1000 or so along with high degrees of k in your determinant.

When you want 1000x1000 matricies like this the coefficients in your determinant are going to be stunning.

Now for the larger matricies you have tried, is the determinant becoming zero because you just have enough zero entries? Or does it look like this is because of accumulated error in the determinant calculation?

You might be able to answer that by writing a little code to check each of the diagonals to see if there is a zero somewhere in every one of them. That might be done with some nested For loops and subscripting to extract individual entries to test against zero. If there is a zero in every diagonal then you may need to think about what it means to have a zero polynomial for your problem.

If the problem seems to be mostly overflow of the exponent in the calculation of the determinant you might wonder whether your matrix can be conditioned in some way to avoid the overflow.

This

Solve[Det[t2/1000.] == 0, κ]

won't change the solutions but it will dramatically decrease the size of the coefficients in the polynomial. But I'm not at all certain this is what you want.

What are the bugs you think you are falling into?

What is the code you want to use on this matrix?
 
Hi Bill,

Thanks again for the help. I did basically try what you put up, i.e. using Solve to find the values of κ, and had success for small matrices. But after I increased the grid size the coefficients get out of control, and eventually I get an overflow error, or just zero determinant. And as I said earlier I'm pretty sure the zero is happening because of the craziness of the coefficients.

I have also thought about trying this: Solve[Det[t2/1000.] == 0, κ], and it did seem to help, but I guess one thing that's hard to notice with the examples I have is that my real matrix has plenty of small numbers as well, and in fact I run into an underflow problem.

Indeed I think I need to go back to the equations that lead up the matrix and see if can write down the problem a different way. I've posted this problem in a different forum, where they are suggesting that I use a Singular Value Decomposition of the matrix, and then apply a root-finder to that. That forum is here if you are interested:

http://mathematica.stackexchange.co...nant-or-row-reduce-parameter-dependent-matrix

Thanks again.
 
Hey Bill,

Just wondering if you had any suggestions for my issues with RowReduce. If you try RowReduce[t2] you should see what I mean. How come κ is totally removed from the matrix?
Is there any code out there where I can just implement RowReduce without actually using the function, I don't really need the matrix in row-echelon form, just upper triangular will do.

Thanks.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 10 ·
Replies
10
Views
4K
  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 14 ·
Replies
14
Views
4K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 33 ·
2
Replies
33
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K