Group Abstract Group Abstract

Message Boards Message Boards

How to load and use a package

GROUPS:
Many apologies for another newbie question but what do I do with a package and where do I put it so that it will load and be usable?  I want to use Combinatorica and I have saved NewCombinatorica.m in several places, mostly hanging off my main Mathematica program files directory and given them various names but no attempt to load the package has yet been successful.  I get a msg Get::noopen: "Cannot open \!\(\"Combinatorica\"\)."  (or something similar, depending on the filename I use).
POSTED BY: John Mycroft
Answer
7 months ago
When I write packages, I usually put them in the AddOns/Applications folder.
POSTED BY: Frank Kampas
Answer
7 months ago
Also see the discussion about possible locations for packages in earlier posts on this group and also covered in the attached tutorial that I have posted a couple fo times (but which i burried in an old post by this point):
Attachments:
POSTED BY: David Reiss
Answer
7 months ago
Many thanks for the replies.  I've put Combinatorica in AddOns/Applications as suggested and it looks like something is making sense to Mathematica as I now get a stream of erro rmessages (attached).  I realise I'm trying to run before I walk here, having only ever used Mathematica interactively rather than with programs and data but I really haven't got a clue how to proceed or what help and various tutorials are telling me.
Attachment

Attachments:
POSTED BY: John Mycroft
Answer
7 months ago
Combinatorica is a package that is shipped with Mathematica so you do not need to download and install it.  The version that you link to in your first posting is 2.0.  The version shipped with mathematica is version 2.1.  The error messages that you are getting may have to do with incompatibilities between the 2.0 version and Mathematica versions greater than 6.

See 

http://reference.wolfram.com/mathematica/Combinatorica/tutorial/Combinatorica.html

and

http://reference.wolfram.com/mathematica/Combinatorica/guide/CombinatoricaPackage.html

B
ut also pay attention to this:

http://reference.wolfram.com/mathematica/Compatibility/tutorial/Combinatorica.html
POSTED BY: David Reiss
Answer
7 months ago
Thanks again for the reply.  I'd visited both those links before I posted - it was them that led me to download Combinatorica: why that chose to download an okld version beats me.  So, assuming one of my futile attempts to get this thing to do something has wiped the version shipped with Mathematica which Mathematica tells me it can't load, I am now truly up the creek.  I think I'll dig out my version 8 DVD and reinstall everything and not bother with version 9.
POSTED BY: John Mycroft
Answer
7 months ago
Version 9 has Combinatorica as well.  No need to go back to an older version of Mathematica.  

This, by the way, is one good reason not to change things that are in the Mathematica distribution itself, but rather put them in in one of the folders that I describe in my notebook above. Then you will never overwrite something that is in Mathematica itself.  You can then always choose to load the alternative package that is in on of those folders by pointing to it directly. 
POSTED BY: David Reiss
Answer
7 months ago
Thanks - going back to 8 fixed it.  Must have been an install glitch.  Having said that, Inversions doesn't give me the number of inversions in a vector A as I had expected so I've headed back to Python anyway.  Methinks I should go back to watch all the Mathematica intro videos to lear more about the bits I've not used before.
POSTED BY: John Mycroft
Answer
7 months ago