Mathematica Quick question about determinants in mathematica

Click For Summary
The discussion centers on using Mathematica to compute the determinant of a 4x4 matrix composed of functions. A user new to Mathematica seeks guidance after struggling with Wolfram Alpha due to input length limitations. Key points include the method of defining matrices and functions in Mathematica, using the Det function to calculate determinants, and the importance of simplifying results with functions like Simplify and FullSimplify. The user initially faced challenges with variable definitions and naming conventions, noting that variables turn blue when undefined and black when defined. After experimenting with subscripted variables to avoid confusion, the user successfully computed the determinant and expressed satisfaction with Mathematica's capabilities for simplification. The conversation highlights the learning curve associated with Mathematica, particularly in managing variables and functions effectively.
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
2K
  • · Replies 11 ·
Replies
11
Views
2K
  • · 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
5K
  • · Replies 6 ·
Replies
6
Views
4K