Assignment to a block inside a matrix
- To: mathgroup@smc.vnet.net
- Subject: [mg10614] Assignment to a block inside a matrix
- From: John JOWETT <John.Jowett@cern.ch>
- Date: Mon, 26 Jan 1998 04:42:44 -0500
- Organization: CERN
Hello,
I have a package that works with the "symplectic unit matrix"
defined for an n-degree of freedom Hamiltonian system by
symJ[n_Integer]:=
Block[{s},s=Table[0,{2n},{2n}];
Do[
s[[{k+1,k+2},{k+1,k+2}]]={{0,1},{-1,0}},
{k,0,2n-2,2}
];s]
I.e. the definition involves the assignment to a 2 by 2 sub-matrix. Can
someone tell me authoritatively whether this programming construct is
correct or whether I need to rewrite the function using ReplacePart or
something? The reason I ask is as follows:
This used to work just fine on both Windows 95 and Unix versions of
Mathematica. It still works on Unix (HP version X 3.0.0.0x) but there
are problems
in the Windows95 version (it is 3.0.1.1x according to the Help/About
Mathematica display and
$Version evaluates to "Microsoft Windows 3.0 (April 25, 1997)").
Specifically, I can calculate symJ[1], symJ[2] correctly but symJ[3]
and symJ[4] cause the kernel crash. I get a message
"This program has performed an illegal opearation and will be shut
down. If the problem persists, contact the program vendor."
Clicking on Details gives:
MATHKERNEL caused an invalid page fault in module MATHDLL.DLL at
0137:0072d9ef. Registers:
EAX=00000002 CS=0137 EIP=0072d9ef EFLGS=00010202 EBX=00a3e6b0 SS=013f
ESP=01a3fad4 EBP=013bd998 ECX=00000001 DS=013f ESI=013661d4 FS=1907
EDX=01309ba0 ES=013f EDI=00000000 GS=0000 Bytes at CS:EIP:
66 8b 47 02 24 07 3c 01 75 35 a1 e4 84 a0 00 8b Stack dump:
01396ee8 01396848 01365fcc 0131c484 00000006 00000002 00a3e6b0 0043edb4
00000018 0072dae3 013661d4 013bd898 00000002 00000000 013a14dc 0130b8d0
I have checked that this does not happen with Windows version 3.0.0.0
which is still installed here. I have also checked that both versions
behave the same way on two different PCs with different hardware.
If my function is properly defined then this would appear to be a bug
introduced in Version 3.0.1.1x. If my function is not properly defined
(and I was just lucky that it worked in the earlier version) then I
would still expect something better than a kernel crash.
John Jowett
--
----------------------------------------------------------------------
Electronic mail: John.Jowett@cern.ch World Wide Web:
http://wwwslap.cern.ch/~jowett/ Telephone: +41 22 76 76643
<-----[you can leave voice mail] Fax: +41 22 767 8480
Postal address: SL Division, CERN, CH-1211 Geneva 23, Switzerland
Location: Room 1-D18, Building 865, CERN Prevessin Site, France
Secretary: +41 (0)22 76 75272 or 73076 <-----[changed 12/12/97]
----------------------------------------------------------------------