Fwd: Re: mma question
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg521] Fwd: Re: mma question
- From: Patcavana at aol.com
- Date: Tue, 7 Mar 1995 16:17:26 -0500
The following code has a problem. I'm trying to compare two values for an If statement test. The test is {Integer}< Integer... this doesn't seem to work. How can I change {Integer} to Integer so that the test will work. Any ideas. Thank-you..... --------------------- >Forwarded message: >Subj: Re: mma question >Date: 95-03-06 14:58:54 EST >From: Patcavana >To: nb at eeyore.stanford.edu Nancy, I typed it in wrong in email but not in mma. It looks like this: MinimumNeighborDistance[co_List,sublist_List]:= Block[{len,minm,minpair,ll,sl}, minm=1000000000000; minpair={}; sl=sublist; len=Length[sublist]; For[i=1,i<=len,++i, Print[i]; ll=Partition[Flatten[Take[sublist,i]],1]; sl=RotateLeft[sl,1]; ii=ll[[1]]; jj=ll[[2]]; If[co[[ii,jj]]<minm,minm=co[[ii,jj]];minpair={ii,jj}]; (* the problem is on this line*) If[co[[ii,jj]]==minm,Append[minpair,{ii,jj}]] (*also on this line*) ]; minpair ] co[[ii,jj]] is of the form {Integer}, minm is as defined. The test for the If doesn't work.. I've changed the problem line to If[Apply[Integer,Flatten[co[[ii,jj]]]]<minm,..........just to try to get co[[ii,jj]] as close to integer form as possible so I can do the If test. I end up with If[{Integer}<integer,then,...} But it still didn't work..... ii and jj are just calculated indexes into integer array co.