[Date Index]
[Thread Index]
[Author Index]
tried to post to newsgroup, it din't appear ?!
*To*: mathgroup at christensen.cybernetics.net
*Subject*: [mg718] tried to post to newsgroup, it din't appear ?!
*From*: wacb at aplcomm.jhuapl.edu (Bill Christens-Barry)
*Date*: Tue, 11 Apr 1995 12:21:37 -0500
Please help me understand why the notebook below gags when it tries to
evaluate/generate the matrix qmat. This occurs on a Macintosh IIfx under
System 7.5.
I have inserted a comment line immediately above the the offending line.
I believe the problem has to do with local variables, although this naive
Mathematican can't quite understand the problem.
Can anyone offer a fix to this? Do I need to use the "Module" command or
something?
Here's the notebook:
*A troublesome notebook with it's output:*
N[matr = Table[Random[], {i,1,8}, {j,1,8}],4]
{{0.06929, 0.9464, 0.4035, 0.6322, 0.7467, 0.6381, 0.6909, 0.4858},
{0.8121, 0.1755, 0.3619, 0.3957, 0.3599, 0.449, 0.9441, 0.3689},
{0.4389, 0.1149, 0.7913, 0.8554, 0.3139, 0.9049, 0.5738, 0.4717},
{0.1519, 0.8093, 0.2467, 0.111, 0.7874, 0.7262, 0.2427, 0.7447},
{0.4285, 0.1066, 0.4626, 0.3627, 0.6486, 0.4808, 0.6846, 0.09464},
{0.4071, 0.2647, 0.01095, 0.7005, 0.2893, 0.2249, 0.324, 0.6257},
{0.7357, 0.6536, 0.8456, 0.4141, 0.6551, 0.4296, 0.8578, 0.4409},
{0.2465, 0.2561, 0.7107, 0.5838, 0.06516, 0.1273, 0.2135, 0.9609}}
summatr = Sum[matr[[i,j]], {i,1,8}, {j,1,8}]
31.0777
N[coocc = MatrixForm[Table[matr[[i,j]], {i,1,8}, {j,1,8}]],4]
0.06929 0.9464 0.4035 0.6322 0.7467 0.6381 0.6909 0.4858
0.8121 0.1755 0.3619 0.3957 0.3599 0.449 0.9441 0.3689
0.4389 0.1149 0.7913 0.8554 0.3139 0.9049 0.5738 0.4717
0.1519 0.8093 0.2467 0.111 0.7874 0.7262 0.2427 0.7447
0.4285 0.1066 0.4626 0.3627 0.6486 0.4808 0.6846 0.09464
0.4071 0.2647 0.01095 0.7005 0.2893 0.2249 0.324 0.6257
0.7357 0.6536 0.8456 0.4141 0.6551 0.4296 0.8578 0.4409
0.2465 0.2561 0.7107 0.5838 0.06516 0.1273 0.2135 0.9609
Some function definitions:
pX[i_] := Sum[coocc[[i,j]], {j,1,8}]
pY[j_] := Sum[coocc[[i,j]], {i,1,8}]
pXplsY[k_] := Sum[coocc[[i,j]] (If[i+j==k,1,0]), {i,1,8}, {j,1,8}]
pXmnsY[k_] := Sum[coocc[[i,j]] (If[Abs[i-j]==k,1,0]), {i,1,8}, {j,1,8}]
q[i_, j_] := Sum[(coocc[[i,k]] coocc[[k,j]]) / (pX[i] pY[k]), {k,1,8}]
*------Evaluation of the following line is where trouble occurs:-------*
N[qmat = Table[q[i,j], {i,1,8}, {j,1,8}],4]
*And below is the red letter output I get before I terminate evaluation:*
0.0692891 0.946448 0.403485 0.632163
0.746748 0.638131
Part::partw: Part 2 of 0.690894 0.48584
0.812072 0.175495 0.361884 0.395737
0.359938 0.449019
*most remaining output of matrix coocc[[]] editted out for clarity,
finishing with:*
0.246523 0.256119 0.710738 0.583817
0.0651624 0.127326
0.213508 0.960917
does not exist.
0.0692891 0.946448 0.403485 0.632163
0.746748 0.638131
Part::partw: Part 3 of 0.690894 0.48584
0.812072 0.175495 0.361884 0.395737
*I've editted out the most of the matrix elements that were output,
*which finished with:*
0.213508 0.960917
does not exist.
$Aborted
*I've removed the rest of the notebook, which is irrelevant to the problem*
A different but related problem occurs when I run this on a Macintosh
Quadra 660AV. On that machine the evaluation of the function pX[i_]
generates an 8-element
list (vector) instead of a single element result (scalar) for pX[1].
And evaluation of pX[2], pX[3],... produces an error. Same thing for pY[j_].
Thanks.
Bill Christens-Barry
wacb at aplcomm.jhuapl.edu
Prev by Date:
**Re: FactorInteger Print Formatting**
Next by Date:
**Re: Performance of student version of Mathematica?**
Previous by thread:
**Evaluating Abs**
Next by thread:
**Statistical Analysis of Data through Mma Functions:**
| |