Quick question about determinants in mathematica

Click For Summary

Discussion Overview

The discussion focuses on using Mathematica to compute the determinant of a 4x4 matrix composed of functions. Participants explore methods for inputting functions into Mathematica and simplifying the resulting determinants, while addressing challenges faced by a newcomer to the software.

Discussion Character

  • Exploratory, Technical explanation, Homework-related

Main Points Raised

  • One participant expresses difficulty in computing a determinant for a 4x4 matrix of functions in Mathematica, questioning if it is possible.
  • Another participant provides an example of calculating a determinant with a simpler 2x2 matrix, suggesting that the provided example should suffice for understanding.
  • Some participants challenge the initial query by implying that calculating a determinant by hand is manageable, questioning the newcomer’s mathematical background.
  • There is a discussion about defining functions in Mathematica and how to structure the matrix input, with examples provided for defining a matrix of constants and functions.
  • A participant clarifies that they need to compute multiple determinants involving different variables, indicating the complexity of their task.
  • One participant shares their success in using Mathematica after trying the suggested methods, expressing enthusiasm about the software's capabilities.
  • Concerns are raised about variable naming conventions in Mathematica, specifically regarding the distinction between defined (black) and undefined (blue) variables, and how to properly define multiple matrices.
  • Another participant suggests using subscripts for labeling variables and functions to avoid confusion in Mathematica.

Areas of Agreement / Disagreement

Participants exhibit a mix of agreement on the utility of Mathematica for simplifying determinants, while disagreements arise regarding the necessity of hand calculations and the newcomer’s mathematical experience. The discussion remains unresolved regarding the best practices for defining variables and functions in Mathematica.

Contextual Notes

Participants mention challenges related to the explicit forms of functions and the complexity of managing multiple variables and indices in their computations. There are also notes on the importance of variable naming conventions in Mathematica, which may affect the execution of commands.

Amok
Messages
254
Reaction score
1
Sup guys,

So, I'm totally new to mathematica. I need to use it in order to compute a determinant of a
4x4 matrix that is made up entirely of functions. I almost managed to do this in wolfram alpha, but for a 4x4 matrix, the input is too long. Do you guys know how to do this (and if it even possible)?
 
Physics news on Phys.org
Is this example enough to show you how to do this?

In[1]:= Det[{{Sin[t],Log[t]},{t^2,1+t}}]

Out[1]= -t^2 Log[t] + Sin[t] + t Sin[t]
 
Are you totally new to mathematics, too? Working out a determinant for a 4x4 matrix by hand is not much of a problem.
 
gsal said:
Are you totally new to mathematics, too? Working out a determinant for a 4x4 matrix by hand is not much of a problem.

I assume the functions are rather lengthy, and Mathematica is great for simplifying. I think you are assuming its a 4x4 of constants.

The above example should be enough.
Det[] is the function.
Tables/Matrices are entered as:

nameofmatrix = {{1,2,3,4},{5,6,7,8},{9,1,2,3},{4,5,6,7}}

for a 4x4 of constants. You can put the functions in by yourself, or define them prior:

F[1,1] = x^2;
F[1,2] = 3 x + 4;
F[1,3] = Sin[x];
F[1,4] = x^2;
F[2,1] = 3 x + 4;
F[2,2] = Sin[x];
F[2,3] = x^2;
F[2,4] = 3 x + 4;
and so forth for all 16 functions;

Then if you have all 16 functions defined as F[i,j] do:

matrix = Table[F[i,j],{i,1,4},{j,1,4}];
det = Det[matrix]

And you can simplify with :

detS = Simplify[det]

oor detFS = FullSimplify[det]And if you don't know, since you're new, to execute the command you use "SHIFT ENTER" to run the statement.
 
gsal said:
Are you totally new to mathematics, too? Working out a determinant for a 4x4 matrix by hand is not much of a problem.

Honestly, that was uncalled for. If you want to know, I want to compute more than one determinant (I have a linear combination of them) and then collect terms and look for pattern in these functions. Moreover there are four different variables involved. I've been trying by hand, but it's obviously a lengthy procedure and keeping track of all the variables and indexes without making a single mistake is hard...

Hepth said:
The above example should be enough.
Det[] is the function.
Tables/Matrices are entered as:

nameofmatrix = {{1,2,3,4},{5,6,7,8},{9,1,2,3},{4,5,6,7}}

for a 4x4 of constants. You can put the functions in by yourself, or define them prior:

F[1,1] = x^2;
F[1,2] = 3 x + 4;
F[1,3] = Sin[x];
F[1,4] = x^2;
F[2,1] = 3 x + 4;
F[2,2] = Sin[x];
F[2,3] = x^2;
F[2,4] = 3 x + 4;
and so forth for all 16 functions;

Then if you have all 16 functions defined as F[i,j] do:

matrix = Table[F[i,j],{i,1,4},{j,1,4}];
det = Det[matrix]

And you can simplify with :

detS = Simplify[det]

oor detFS = FullSimplify[det]And if you don't know, since you're new, to execute the command you use "SHIFT ENTER" to run the statement.

Thank you for you reply. I tried something like that, but I don't have the explicit form of the functions, I have to write something like f1(x1)*a(y1), f2(x2)*a(y2), f3(x3)*a(y3)... (and permutations). I see that you wrote Sin[X] and not sin(x), so that might help. Gonna try it ASAP

:P

EDIT: Waddya know, it worked! Thx a bunch.
EDIT2: Holy crap! This program is awesome, it actually simplifies stuff :)
EDIT3: Hey, it worked while I called my matrix 'mat' and my determinant 'det', but then I changed them to matrix, or mat1 or det1 and the name became blue and the operations didn't work anymore. I'm having a hard time defining two matrices to use in my computations. Do I have to open a new cell to define each one of them? Or variables for that matter? Why do some names become blue, while others are black? I've read an intro to mathematica, but I'm still confused about this.
 
Last edited:
blue = undefined variable, black = defined variable

You need to set a blue variable to something to make it black. You can do it in the same cell as the previous work, separating with a ; or you can create a new cell. I suggest practicing on simple operations if you are unfamiliar with Mma. Like

Expand[(1+x)^4]
Factor[x^2+x-2]
 
lpetrich said:
blue = undefined variable, black = defined variable

You need to set a blue variable to something to make it black. You can do it in the same cell as the previous work, separating with a ; or you can create a new cell. I suggest practicing on simple operations if you are unfamiliar with Mma. Like

Expand[(1+x)^4]
Factor[x^2+x-2]

I found out that I need to use subscripts in order to label variables and especially functions, because mathematica was getting confused about wether the numbers were labels or actual numbers (hence variables that remained undefined). Everything's working fine now. Thanks.
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 21 ·
Replies
21
Views
6K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 7 ·
Replies
7
Views
5K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 37 ·
2
Replies
37
Views
20K
  • · Replies 3 ·
Replies
3
Views
6K
  • · Replies 6 ·
Replies
6
Views
5K