Questions about contexts, which are used in Mathematica to organize defined symbols and avoid conflict between symbols that would otherwise have the same name. They are created when packages are loaded.

learn more… | top users | synonyms

7
votes
0answers
89 views

Potential pollution of Global` context in fresh kernel

If I evaluate, with a fresh kernel Names["Global`*"] I get {"rhs", "z"} I think this is not caused by any packages in ...
1
vote
1answer
47 views

how to make cells independent with each other in notebook

If we open DocumentationCenter and then run code, we will find that the Cells are independent from each other. For example: ...
10
votes
1answer
121 views

Importing an mx file into a context

Consider the following simple code which dumps the global context: var = 5; DumpSave["test.mx", "Global`"]; Now, in a new notebook, I would like to import var in ...
2
votes
1answer
52 views

ContextPath and autocompletion with subpackages

I'm developing a larger package which includes several subpackages. My problem is, that I can't introduce the symbols in the subpackages to the autocompletion by loading the main package, but by ...
1
vote
0answers
89 views

Auto-complete for user defined functions [duplicate]

If I define a symbol in Mathematica, it doesn't show up in the autocomplete list that works for symbols in System. Test code: ...
8
votes
2answers
187 views

The introduction for Context in Wagner's book is out of date? [duplicate]

In Section 8.1.1 (P230 of the book, P249 of the PDF) of Wagner's book, the following example is shown: x = 5; temp`x = 6; Begin["temp`"]; {x, Global`x} The ...
12
votes
2answers
219 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 ...
12
votes
2answers
144 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, ...
0
votes
0answers
58 views

Setting individual CellContext for each notebook loses autocomplete suggestions

I'm running Mathematica 9.0.1 under OS X. In order to have separate contexts for each of my notebooks, I used the instructions in the last part of the accepted answer from the following link: Is ...
10
votes
3answers
158 views

Creating a custom context with a Hold construct

I'm trying to create a function "InContext" to execute a piece of code inside a certain context (and to return the result of evaluating that piece of code). One approach is to place the code inside a ...
1
vote
1answer
63 views

Can kernel-specific variables be accessed from stylesheets?

I'm trying to create a modified version of the Default.nb StyleSheet that adds a docked cell to act as a status bar along the top of every notebook to display some ...
10
votes
1answer
141 views

Is there a way to find out who is importing a package?

After calling some functions, if I look into $ContextPath, I can see that JLink` is in there. Is there a way to find out what ...
2
votes
1answer
140 views

WebServices context problem

I'm using two web services from the same host: Earth Orientation Center I can get each one to work on a fresh kernel but I cannot get both of them to work during the same instance of the kernel. I ...
2
votes
2answers
79 views

How to make a function work on symbols in a specific context

Let us say we have two sets of symbols $(x, y, z)$ with the same names that live in two different contexts: ...
1
vote
1answer
90 views

Symbol not added to context

I have run into a problem that is currently stumping me. I'm running a WebMathematica server, and am trying to create a package to use on one of the pages. However, when I load the package, it appears ...
0
votes
0answers
64 views

GUIKit`Private`Script appended to expression when I try to update list through Table Widget

I am trying to update a list every time a value in a Table Widget is changed. My list has to be made from expressions and not strings since I am doing some symbolic calculations each time the table ...
2
votes
1answer
149 views

Errors when using ParallelTable inside a package

I'm developing a package that contains a function that requires evaluation of an expensive Table, so I use ParallelTable ...
5
votes
0answers
70 views

Does one need to be careful about loading multiple (many) contexts or packages in the same session?

I have a number of large pieces of precomputed data which I am considering putting into individual packages in order to load them (via DeclarePackage) and unload ...
1
vote
0answers
30 views

Symbol created in unevaluated second argument of If [duplicate]

Apologies for the long question title, but I couldn't come up with something shorter to describe the following. Starting with a clean session, there are no symbols in, let's say, ...
1
vote
0answers
76 views

NMaximize with matrix input

I defined function f[x_, fixed_] := {...}. Here x is an $M\times N$ matrix. I want to maximize $f$ with respect to $x$. I have ...
14
votes
2answers
174 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 ...
0
votes
0answers
57 views

Loading Cell Option Definitions on Kernel Launch for Stylesheets

I have my own stylesheet that I like using so much I change all my documents to it almost immediately, but as I demo Mathematica to people I cannot use ...
4
votes
1answer
546 views

FeynCalc “May shadow or be shadowed by other definitions”

So I've downloaded the latest FeynCalc from this site and put the extracted folder in user/me/library/Mathematica/application, but when I write the command ...
7
votes
2answers
187 views

Why doesn't DumpSave work for elements created within a local notebook context?

I recently noticed that when dealing with notebooks with local context, I cannot successfully DumpSave variables, or, rather, when I call ...
8
votes
3answers
188 views

Functions that creates symbol in a specific context

I'm trying to make a function f that takes a symbol, a value, and a context, and creates the symbol in the requested context and assigns it the passed value. The ...
1
vote
2answers
94 views

Given a list of context names, how can I access all the variables with the same name across all those contexts?

I'm looking to access variables in different contexts. The contexts are stored in a list labeled contexttable. Each context, of course, is a string. Is there any ...
2
votes
1answer
180 views

Transfer of symbols between contexts

As many others (I guess) I'm struggling with the handling of contexts within Mathematica. I'm working on a new package definition with the usual syntaxt specified by the Mathematica documentation: ...
4
votes
1answer
118 views

Copying a symbol using a subpackage

In this question, there is a beautiful method to copy a symbol. However, i'm not able to use it as an addon to my package. So the main question is How to rename/copy a function defined in a ...
3
votes
1answer
100 views

Contexts after Cell Grouping

I'm trying to separate my document into cell groups, each with their own context (much like the style of code isolation described by the answer here: Localizing variables within a Manipulate), but the ...
2
votes
1answer
201 views

Using ToExpression within Manipulate

I would like to use ToExpression (or Symbol) within Manipulate. Specifically, when running ...
8
votes
2answers
170 views

For any symbol, how can I get the full context-qualified name of the symbol as a string?

I'd like to have a function, whether built-in or not, that when given a symbol, whether bound to a value or not, returns a string giving the context and name of the symbol. Example: ...
7
votes
2answers
148 views

How to define UpValues in a different context from within a package

I'm trying to create a function (in a package) to import a lot of data and create a symbol with UpValues to return specific results about the data. I've got it working fine in a regular notebook, but ...
2
votes
1answer
159 views

How to find full names of all packages already on the $Path?

I'll show one specific example of what I am trying to do, I think it will explain things. On the default $Path there exist (in version 8) the following 4 packages ...
3
votes
1answer
122 views

automatically add Global` to $ContextPath for all notebooks when using CellContext->Notebook

I have some definitions in my init.m. E.g. my init.m contains this: ...
3
votes
1answer
103 views

Setting the context automatically based on section

Suppose I have a task that keeps things organized using contexts, so: ...
7
votes
1answer
182 views

What is the purpose of Dump contexts?

Motivation I've been trolling through some internal code, trying to glean design practices WRI developers employ when extending Mathematica using top-level code. During my ...
5
votes
3answers
220 views

Scope within Context

To define some package-wide functions/variables, what approach is recommended? I tried to use contexts with the Begin function, but this failed: ...
6
votes
2answers
410 views

How to properly handle mutual imports of multiple packages?

I'm new to the mathematica platform and I am developing a simulation framework as my first exercise and have been tearing my hair figuring how to make packages interact with each other. Ill explain a ...
2
votes
2answers
100 views

What is the best way for an application to provide customisation options for the user?

Suppose that an application needs to be configured specifically for a user's system. e.g. the application needs to be told the location of certain data directories. What is the best way to provide ...
10
votes
2answers
173 views

Globally loading packages while using a CellGroup as the default context

I have a notebook I wish to set up where the sections are conceptually related to each other. But, I wish to isolate them from each other programmatically, so that they do not interfere with one ...
8
votes
1answer
2k views

How do I create and use Mathematica packages?

I have created a package following the tutorial in Mathematica 8 virtual book. However this tutorial is quite, let's call it, "short". I have a TestPackage.m file: ...
5
votes
2answers
195 views

Delete contexts from a string representation of a symbol

I want to delete the string representing the context of a symbol. For info I need such a functionality in my ShowIt function defined here I'd like to know how I ...
10
votes
2answers
241 views

How to abbreviate context names?

It's convenient to abbreviate often-used function names, eg Dim = Dimension. Is it possible to abbreviate long context symbols, e.g. Combinatorica when the context ...
30
votes
1answer
768 views

Local variables in Module leak into the Global context

From the Mathematica documentation on Module: Module allows you to set up local variables with names that are local to the module. But after using ...
19
votes
3answers
940 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 ...
10
votes
2answers
103 views

Functions in a different context are replaced with infix forms of their namesake in System`

So, in an attempt to help out Fabian with his question, I did what I often do, and created a new symbol in the Pillsy` package that I could play with. Since it was ...
17
votes
1answer
1k views

Why are some function names red?

I need to evaluate Needs["GraphUtilities`"] before I can use functions such as GraphPath[]. When I do so, some functions get ...
7
votes
1answer
143 views

Organizing similar datasets using Contexts or otherwise

I often import several long time series to analyze something about a city. When I have multiple cities, I use contexts. As a simple example, ...
43
votes
5answers
2k views

What is the most convenient way to read definitions of in-memory symbols when we don't have the source files? (Spelunking tools)

Note: I put Simon's implementation on GitHub. Contributions welcome! When trying to read the definition of already defined (package or built-in) symbols using ...
9
votes
1answer
170 views

Future-proofing access to packed array tools

Most of the Mathematica users beyond beginner level will be aware of the phenomenon of Packed Arrays. The user-accessible functions related to packed arrays live in the ...