Determinant
- To: mathgroup@smc.vnet.net
- Subject: [mg12272] Determinant
- From: "Arturas Acus" <acus@itpa.lt>
- Date: Tue, 5 May 1998 03:30:08 -0400
Recently I observed a bit strange behaviour when calculating
determinant of large symbolic matrix. With the usual command
Det[symbolicmatrix] I was unable to get the result. After I wrapped
each element with Hold, the Det was calculated in fraction of second.
So, I am interesting what is going. Do Det checks something? Actual
example I attach bellow.
Arturas Acus
Institute of Theoretical
Physics and Astronomy
Gostauto 12, 2600,Vilnius
Lithuania
E-mail: acus@itpa.lt
Fax: 370-2-225361
Tel: 370-2-612906
-------------- Enclosure number 1 ----------------
(***********************************************************************
Mathematica-Compatible Notebook
This notebook can be used on any computer system with Mathematica 3.0,
MathReader 3.0, or any compatible application. The data for the
notebook starts with the line of stars above.
To get the notebook into a Mathematica-compatible application, do one of
the following:
* Save the data starting with the line of stars above into a file
with a name ending in .nb, then open the file inside the application;
* Copy the data starting with the line of stars above to the
clipboard, then use the Paste menu command inside the application.
Data for notebooks contains only printable 7-bit ASCII and can be sent
directly in email or through ftp in text mode. Newlines can be CR, LF
or CRLF (Unix, Macintosh or MS-DOS style).
NOTE: If you modify the data for this notebook not in a Mathematica-
compatible application, you must delete the line below containing the
word CacheID, otherwise Mathematica-compatible applications may try to
use invalid cache data.
For more information on notebooks and Mathematica-compatible
applications, contact Wolfram Research:
web: http://www.wolfram.com
email: info@wolfram.com
phone: +1-217-398-0700 (U.S.)
Notebook reader applications are available free of charge from Wolfram
Research.
***********************************************************************)
(*CacheID: 232*)
(*NotebookFileLineBreakTest
NotebookFileLineBreakTest*)
(*NotebookOptionsPosition[ 13453, 262]*)
(*NotebookOutlinePosition[ 14127, 286]*) (*
CellTagsIndexPosition[ 14083, 282]*) (*WindowFrame->Normal*)
Notebook[{
Cell[BoxData[
\( (*\ This\ is\ test\ matrix\ *) \)], "Input"],
Cell[BoxData[
\(fullGM
= {{\((Pi*
\((40*dF^2*r^2*Sin[F]^2\ + \ 160*e2*fpi2*r^2*Sin[F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\((dF^2*r^2\ + \ 4*e2*fpi2*r^2\ + \ Sin[F]^2)\)*\n
\ \ \ \ \ \
\((\(-2\)*Cos[q2]*Cos[qp2]\ + \
Cos[q2]*Cos[qp2]*Sin[q0/2]^2\ + \ \n\ \ \ \ \ \ \ \
2*Cos[q0/2]*Cos[q3]*Cos[qp1]*Sin[q2]*Sin[qp2]\ - \
\n
\ \ \ \ \ \ \ \
2*Cos[q0/2]*Sin[q2]*Sin[q3]*Sin[qp1]*Sin[qp2])\))\)/
\((3*e2*r^2)\), \ \n\ \ \
\((4*Pi*Cos[q0/2]*Sin[F]^2*
\((dF^2*r^2\ + \ 4*e2*fpi2*r^2\ + \ Sin[F]^2)\)*\n
\ \ \ \ \ \ \((Cos[qp1]*Sin[q3]\ + \
Cos[q3]*Sin[qp1])\)*
Sin[qp2])\)/\((3*e2*r^2)\), \ \n\ \ \
\((Pi*\((3\ + \ Cos[q0])\)*Cos[qp2]*Sin[F]^2*
\((dF^2*r^2\ + \ 4*e2*fpi2*r^2\ + \ Sin[F]^2)\))\)/
\((3*e2*r^2)\), \ 0, \ \n\ \ \
\((4*Pi*Cos[qp2]*Sin[F]^2*
\((dF^2*r^2\ + \ 4*e2*fpi2*r^2\ + \ Sin[F]^2)\))\)/
\((3*e2*r^2)\), \ 0, \ \n\ \ \
\((4*Pi*Sin[F]^2*\((dF^2*r^2\ + \ 4*e2*fpi2*r^2\ + \
Sin[F]^2)\))
\)/\((3*e2*r^2)\)}}\)], "Input"],
Cell[BoxData[
\( (*\ the\ line\ will\ not\ finish\ \ *) \)], "Input"],
Cell[BoxData[
\(\(matrixDeterminant = Det[fullGM]; \)\)], "Input"],
Cell[BoxData[
\( (*\ this\ works\ *) \)], "Input"],
Cell[BoxData[
\(\(matrixDeterminant =
ReleaseHold[
Det[ReplaceRepeated[Map[Hold, fullGM, {2}], Hold[0] :> 0]]];
\)\)],
"Input"],
Cell[BoxData[
\( (*\ this\ is\ the\ rezult\ after\ simplification\ \ *) \)],
"Input"],
Cell[BoxData[
\(determinantSimplified =
9*\((9/64)\)*Pi^7*
\((dF^2*r^2 + 16*e2*fpi2*r^2 + \n\t\t\t\t\t\t\t2*Sin[F]^2)\)^4*
Sin[q0]^2*Sin[q2]^2*Sin[qp2]^2*\((\(-2\) + 2*Cos[q0] +
Sin[q0]^2)\)*
\((dF^2*r^2 + \n\t\t\t\t\t\t\t4*e2*fpi2*r^2 + Sin[F]^2)\)^3*
\((1 + Cos[F])\)^3*\((\((\(-1\) +
Cos[F])\)/\((3*e2*r^2)\))\)^7\)],
"Input"],
Cell[BoxData[
\( (*\ this\ is\ test\ *) \)], "Input"],
Cell[BoxData[
\(q1 = Random[Real, {0, Pi}]; q2 = Random[Real, {0, Pi}];
q3 = Random[Real, {0, Pi}]; \nq0 = Random[Real, {0, Pi}];
qp1 = Random[Real, {0, Pi}]; qp2 = Random[Real, {0, Pi}];
dF = Random[Real, {1, 2}]; F = Random[Real, {0, 2*Pi}];
r = Random[Real, {1, 2}]; \ne2 = Random[Real, {1, 2}];
fpi2 = Random[Real, {1, 2}];
\n{determinantSimplified, matrixDeterminant} // N\)], "Input"] },
FrontEndVersion->"Microsoft Windows 3.0", ScreenRectangle->{{0, 800},
{0, 544}}, CellGrouping->Manual,
WindowSize->{496, 436},
WindowMargins->{{134, Automatic}, {-29, Automatic}} ]
(***********************************************************************
Cached data follows. If you edit this Notebook file directly, not
using Mathematica, you must remove the line containing CacheID at the
top of the file. The cache data will then be recreated when you save
this file from within Mathematica.
***********************************************************************)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[1709, 49, 65, 1, 30, "Input"],
Cell[1777, 52, 10357, 169, 3030, "Input"], Cell[12137, 223, 73, 1, 30,
"Input"], Cell[12213, 226, 70, 1, 30, "Input"], Cell[12286, 229, 54, 1,
30, "Input"], Cell[12343, 232, 149, 4, 30, "Input"], Cell[12495, 238,
89, 1, 30, "Input"], Cell[12587, 241, 375, 7, 70, "Input"], Cell[12965,
250, 57, 1, 30, "Input"], Cell[13025, 253, 424, 7, 110, "Input"] }
]
*)
(***********************************************************************
End of Mathematica Notebook file.
***********************************************************************)