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.
3
votes
1answer
90 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
...
5
votes
1answer
67 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 ...
6
votes
3answers
83 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 ...
0
votes
1answer
62 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
0answers
72 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
78 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
65 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
122 views
Using ToExpression within Manipulate
I would like to use ToExpression (or Symbol) within Manipulate. Specifically, when running ...
8
votes
2answers
126 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: ...
6
votes
2answers
98 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
104 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
76 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
81 views
Setting the context automatically based on section
Suppose I have a task that keeps things organized using contexts, so:
...
8
votes
1answer
148 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
144 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
212 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
87 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
118 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 ...
7
votes
1answer
743 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
166 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
193 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 ...
18
votes
1answer
349 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 ...
18
votes
3answers
434 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
97 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 ...
13
votes
1answer
501 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
112 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,
...
26
votes
3answers
798 views
What is the most convenient way to read definitions of in-memory symbols when we don't have the source files?
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
142 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 ...
10
votes
1answer
220 views
Is it possible to use Begin and End inside a Manipulate?
May be someone can explain why I can't use Begin["context`"] and End[] inside a Manipulate ...
5
votes
6answers
491 views
How can you give a Module a context and have its local variables and Modules belong to that context?
What would be the best way to give a module its own context and have its local variables and Modules belong to that context?
16
votes
2answers
278 views
Context unique to each group at a specified level
Recent versions of Mathematica provide the option of having a unique $Context for each cell group, via:
Evaluation > Notebook's Default Context > Unique to Each ...
11
votes
4answers
308 views
Strategies for avoiding and handling shadowing
When dealing with namespaces in Mathematica (BeginPackage, $ContextPath ...) one is unavoidably confronted with the problem of ...




