MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

What's legit here?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg39940] What's legit here?
  • From: Steve Gray <stevebg at adelphia.net>
  • Date: Wed, 12 Mar 2003 02:31:36 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

	In the following function, most of which you can ignore,
there is an If [ enalist ... etc. where several statements to be
executed if the If succeeds are grouped with ( ) . This works but I
thought the right way to group several statements together was with
{ }. The latter does not work and I find I don't know what the correct
way is. As usual, Mathematica did not complain with the { } or the ( ). The
effect was to have the If always fail and for the function to always
Return [ failu ].

 Whether  the comments get in the way, I don't know, but if someone
would define what's legal here, I would appreciate it.
	Thank you.



ranqrs := Module[{res2}, 
   ptab = Table[0, {i, NN}];
   If[changeq == 1, qtab = Table[Random[Integer, {1, NN - 1}], {i, NN
- 1}]];
   If[changer == 1, 
      rtab = Table[Random[Integer, {0, NN - 1}], {i, NN - 1}]]; 
   If[changes == 1, stab = Mod[Table[1, {i, NN - 1}] - rtab, NN]];
   matall;                                  (* 
      Make matrices from model.     *)
   matmul;                                  (* 
      Compute matrix product.       *)
   result = newres;
   If [ enalist[[result]] == 1,                (* 
        If a good value = > try again; *)
	  ( newmmt;                              (* make a new model &
target,   *)
	    res2 = newres;                       (* do another test.
*)
        If [res2 == result, Return[result]]; (* If agree, 
          return good result. *)
      )];
   Return[failu];                            (*If no agree or no
interest, 
      0. *)
  ]


  • Prev by Date: Trouble with iterative function
  • Next by Date: Re: Re: presentation layout
  • Previous by thread: Trouble with iterative function
  • Next by thread: Re: What's legit here?