Questions on Mathematica packages, which are self-contained bundles of Mathematica code that add new functions and other functionality.

learn more… | top users | synonyms (1)

72
votes
8answers
10k views

Creating Mathematica packages

I'm building a package to help me write packages and their documentation. In this post I explained how to make a package and its documentation. In the answer I provided I describe how to build a very ...
47
votes
1answer
3k views

Recommended settings for git when using with Mathematica projects?

Background I'm relatively new to git — currently overseeing an offshore .NET-based development project on GitHub within a private business account, but little experience beyond that. I'd like to set ...
41
votes
3answers
2k views

How to distribute proprietary Mathematica code

If I want to make package-code completely unreadable, in a way that the end-user can only call my functions, but has no way to re-engineer my definitions, how would I do that? I know I can use ...
33
votes
5answers
657 views

Mathematica package manager

I want to bundle up a Mathematica package that I've written and distribute it as open source. It has a couple of dependencies that I'd like to automatically download independently from my package as ...
33
votes
0answers
3k views

Custom package development: Basic steps [duplicate]

Every once in a while, I write a generic function that I use quite often for months to come. However, package development in Mathematica is not very well documented from what I can tell, and I was not ...
29
votes
1answer
779 views

Proving the hairy ball theorem using xAct

I would like to formally prove the hairy ball theorem in Mathematica, initially just for $S^2$, and then see about generalizing. An approach I thought about to use the xAct package to define $S^2$ ...
28
votes
2answers
487 views

What's the difference between these two ways of specifying dependent packages?

What's the difference between these two ways of specifying dependent packages? Method 1: BeginPackage["foo`bar`", {"xxx`", "yyy`"}] Method 2: ...
28
votes
2answers
2k views

What is a “Paclet”?

I often see references to "paclets", for example the PacletManager` context, the PacletInfo.m file in some packages and next to ...
28
votes
0answers
461 views

What is the difference between a .wl package and a .m package?

In Mathematica 10.x, one now has both .wl Wolfram Language Packages and .m Wolfram Mathematica Packages. What's the ...
27
votes
1answer
527 views

Creating a package of special plots

In my work as a math teacher, I create lots of graphs to illustrate ideas. I have lots of math books and will often try to duplicate a particular style of graph. Below, one very simple example, ...
26
votes
3answers
2k views

How to load a package without naming conflicts?

This question applies to any package, but I encountered this problem while working with graphs. There are symbols in the Combinatorica package (such as ...
26
votes
1answer
850 views

Why are all the lines commented when I create a Mathematica script?

When I created a Mathematica script, I found that all my lines were commented out (when opened with vi or gedit or any other ...
26
votes
1answer
525 views

In 10.1.0 BenchmarkPlot doesn't work?

Bug introduced in 10.1 This bug was resolved in 10.2.0, but another bug was introduced in 10.3.0 persisting through 10.3.1 and finally resolved in 10.4 In Mathematica 10.1.0 and 10.3.0 ...
25
votes
2answers
1k views

What are recommended guidelines for developing packages?

This might be of general interest – I have different questions regarding naming conventions, contexts, subcontexts, shadowing, etc., but I do feel that they are closely related, thus I don't really ...
24
votes
3answers
8k views

Differential geometry add-ons for Mathematica

I need a differential geometry tool for Mathematica. Is there any add-on? Unfortunately, Mathematica does not include such functionality or I can not find it.
24
votes
2answers
796 views

When to use Get vs Needs

When should I use << vs Needs? I just always use Needs as ...
22
votes
4answers
754 views

Defining functions in stylesheets

Is there a way to define functions in a stylesheet? So far I have managed to write my stylesheets without the need to use my own custom functions or definitions. For instance, maybe I have some color ...
21
votes
4answers
453 views

Result about Context is inconsistent with the description of “Power Programming with Mathematica”

x = 5; temp`x = 6; Begin["temp`"] {x, Global`x, temp`x} The result in my Mathematica session is {5,5,6}, but it's ...
21
votes
3answers
1k views

Listing the functions defined in a package

Assume that I know a package's (Context?) name that is loaded. Now I want to list the functions defined in this package. How can I do it? I remember that I found a way once, but I cannot re-find it. ...
21
votes
3answers
2k views

Generate a Random Polygon

Does some package exist with a function that takes a parameter $n$ and generates a random 2D $n$-sided simple polygon (convex or non-convex), possibly within a certain bounding box? It does not ...
21
votes
3answers
985 views

How to program a F::argx message?

How useful is it to program a user-built function in a package to produce a red warning message F::argx if you give the wrong number of arguments to that function? ...
21
votes
2answers
1k views

How safe is Encode?

How safe is an encoded package (using locked, etc)? If I don't specify a personal key, I understand that the encoding key must be somewhere in the Mathematica program itself, and so it is not a ...
21
votes
0answers
353 views

Can code optimize code?

Are there functions, programs or packages that deal with optimizing mathematica code i.e. re-writing ineffecive or convoluted code. -This question has haunted me since I joined SE. The background for ...
20
votes
2answers
2k views

Mathematica vs. $\LaTeX$? Replacement for Legacy “Authoring Tools” package?

I'd rather write in Mathematica than in $\LaTeX$, but it's not really practical, especially for big works (> 100 pages) without good tooling. I'm just starting to look into what's available for big ...
19
votes
1answer
853 views

What is the proper method to load a Mathematica package inside a DynamicModule

I have a DynamicModule that requires loading of Mathematica packages. The usual methods do not seem to apply (...
18
votes
1answer
1k views

What is available for editing Mathematica source code with Emacs?

I can find several Emacs libraries for Mathematica, but I'm not aware of a clear favourite, a definitive list, or of a library which is actively maintained and developed. None of these appear to be in ...
18
votes
2answers
238 views

How to find the package file that stores a certain symbol?

Is it possible to figure out in what file a certain packaged symbol lives in (assuming there is no shadowing between multiple identical symbol names)? I would like to have a function that if, given a ...
17
votes
3answers
462 views

What is the purpose of tags like :Name:, :Context:, etc. in packages?

I noticed that all of the packages that come with Mathematica start with a header that is in a standard format. (See e.g. the header of NIntegrateUtilities` at the ...
17
votes
2answers
7k views

How to install packages?

This is always a problem when I distribute my packages to colleagues working on different platforms. I have my packages installed into a private directory and I autoload some of them when Mathematica ...
16
votes
2answers
1k views

How to make a parallel auto-generated .m package from Initialization cells?

according to the documentation at ref/InitializationCell, When you first save a notebook that contains initialization cells, you have the option to make a ...
16
votes
2answers
693 views

Automated testing for compatibility with older Mathematica versions

I have several packages which I actively develop and maintain. I try to stay up to date with new releases of Mathematica and usually update within a couple of months of a new version coming out. As a ...
15
votes
1answer
537 views

MaTeX for Mathematica 9

There's a great package called MaTeX that @Szabolcs wrote which allows one to easily use LaTeX within Mathematica for things like axes labels. After hours trying out various other solutions I ...
15
votes
3answers
1k views

Best Practice to write ::usage for own package functions

I'm writing an own package with Mathematica, that I would like to make available for others. In order to do that (and for my own usage of the package), I would like to write ...
15
votes
2answers
205 views

How to find out what files are touched when Get is called?

Is there a way to capture all package files touched whenever a package is called via Get, Needs, ...
15
votes
1answer
282 views

How to get the directory of a package?

I have a package that I have placed in the $BaseDirectory\Applications directory so that Needs can find it. I have a logo in ...
15
votes
1answer
2k views

Installing CRAN Packages

When I install RLink: Needs["RLink`"] InstallR[] then evaluate the command ...
15
votes
1answer
208 views

Can I emulate Wolfram's automatic package updating in my own packages?

It seems that some Wolfram-provided packages are smart enough to automatically check with the Wolfram servers, notice when a newer version is available, and download it, so that the user always has ...
15
votes
1answer
671 views

Creating a R DataFrame like construct in Mathematica

I kept getting my data mixed up so I decided to see if I could construct a package adding a R DataFrame like construct to Mathematica. I managed to cobble something together that sort of works, but ...
14
votes
2answers
620 views

Is there any harm or benefit to Removing unneeded private symbols in packages?

One of the things I noticed is that in typical medium-to-large sized packages, a huge number of symbols are created in the myPackage`Private context. You can see a ...
14
votes
3answers
2k views

How do I compute sidereal time and JD?

There was once a package that provided a wide range of functions for computing astronomical information. This package now appears to be out of date; but as near as I can tell, many of the useful ...
14
votes
4answers
974 views

Strategies for avoiding and handling shadowing

When dealing with namespaces in Mathematica (BeginPackage, $ContextPath ...) one is unavoidably confronted with the problem of ...
14
votes
3answers
305 views

How do I put my packages into Dropbox

I don't want to necessarily put my packages in Mathematica's $UserBaseDirectory, which is on my local hard drive. Can I somehow tell Mathematica to look for ...
14
votes
1answer
331 views

Making a Mathematica package manager?

I'd like to get a serious discussion started about a package manager. This has come up elsewhere, and many people have implemented their own solutions. It would be nice to have a standardized way to ...
14
votes
1answer
246 views

Creating documentation for sub-packages in Workbench

I'd like to create proper documentation for a package of mine, and Workbench in principle provides the tools to do this. However, I've split my package into multiple sub-packages (because I found it ...
14
votes
1answer
707 views

How to run an external program in parallel with a Mathematica package?

Under Mathematica 8 (Linux x84_64) I was able to run an external program in parallel from a Mathematica package. However this procedure breaks down under Mathematica 9. Within my Mathematica package ...
13
votes
2answers
345 views

Mathematica “prelude”

Is there any way to have the functions from a mathematica file be loaded on startup? For example, in this excellent answer, Jens helps me out and gives me some functions for creating legends for ...
13
votes
2answers
1k views

How to work with Application Project files in Wolfram Workbench?

I have figured out that in a basic project I simply have to call the main package (m file) from the notebook using <<nameofmfile` and then the notebook ...
13
votes
2answers
1k views

How to unload automatically loaded packages?

I know that this has been discussed here (How do I clear all user defined symbols?), but my case is somewhat different. How does one unload packages during runtime that were loaded with the start of ...
13
votes
3answers
1k views

How can I return private members of a Mathematica package as the output of package functions without the “PackageName`Private`” prefix?

I have created a Mathematica package that manipulates various types of input physics data into a common form of output data for further analysis. To make this process more efficient and manageable, I ...
13
votes
1answer
303 views

How to use Get on a folder

In the documentation for Get it says: If the file found by <<name is a directory, the Wolfram Language will try to ...