Combinatorica, NthPermutation, and a Sort behavior

*To*: mathgroup at smc.vnet.net*Subject*: [mg50147] Combinatorica, NthPermutation, and a Sort behavior*From*: Steve Gray <stevebg at adelphia.net>*Date*: Tue, 17 Aug 2004 05:01:37 -0400 (EDT)*References*: <cfkaj9$fa0$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Dr. Bob is right, as usual. Apparently the function NthPermutation has been changed, and I quote from his answer which quotes from Wolfram: NthPermutation::usage = "NthPermutation[n, l] gives the nth lexicographic permutation of list l. This function is obsolete; use UnrankPermutation instead." Therefore, try UnrankPermutation[n,list]. For example, UnrankPermutation[20, {a, b, c, d, e, f}] gives {a, b, f, d, c, e} Incidentally, I found something interesting with Sort, which experienced users might anticipate. I computed a list containing answers in the "exact" format including many square roots, arithmetic operators, etc.. This does NOT sort the same way that actual numerics would, since the lexical order is not the numeric order. >My Combinatorica.m is in > >D:\ProgramFiles\WolframResearch\Mathematica\5.0\AddOns\StandardPackages\DiscreteMath > >but neither ><< DiscreteMath`Combinatorica` >nor >Needs["DiscreteMath`Combinatorica`"]; > >apparently loads it because NthPermutation[100,{a,b,c,d,e,f,g}] just echoes NthPermutation. >My $Path is > >{ D:\Program Files\Wolfram Research\Mathematica\5.0\AddOns\JLink, > D:\Program Files\Wolfram Research\Mathematica\5.0\AddOns\NETLink, > D:\Program Files\Wolfram Research\Mathematica\5.0\AddOns\StandardPackages\StartUp, > D:\Program Files\Wolfram Research\Mathematica\5.0\AddOns\StandardPackages\StartUp, > D:\Program Files\Wolfram Research\Mathematica\5.0\AddOns\Autoload, > D:\Program Files\Wolfram Research\Mathematica\5.0\AddOns\Applications, > D:\Program Files\Wolfram Research\Mathematica\5.0\AddOns\ExtraPackages, > D:\Program Files\Wolfram Research\Mathematica\5.0\SystemFiles\Graphics\Packages, > D:\Program Files\Wolfram Research\Mathematica\5.0\Configuration\Kernel } >(plus some other stuff) > > How do I put the required path into $Path, and I wonder why wasn't it included in the package I >received? I changed nothing about Path. > Thanks for any info. This will be holding me up. > >Steve Gray