Linked Questions

2
votes
2answers
83 views

How to make a contextual variable?

I have a question that would be trivial in OOP, but I am a newbie to programming in Mathematica, so I'm wondering how to deal with it. Basically, I want to create a package which basically involves a ...
18
votes
5answers
631 views

Prevent graphics from rendering inside a held expression

Assuming each odd line is input I would like the even lines to be the output of the following lines. In the above the Graphics are inside ...
6
votes
2answers
177 views

How to prevent Mathematica from complete evaluation of special functions?

Recently I tried to check a result of integration which should be a linear combination of the Riemann $\zeta\;$-function at various arguments, the coefficients of the combination being of primary ...
102
votes
7answers
6k 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 ...
527
votes
19answers
131k views

Where can I find examples of good Mathematica programming practice?

I consider myself a pretty good Mathematica programmer, but I'm always looking out for ways to either improve my way of doing things in Mathematica, or to see if there's something nifty that I haven't ...
31
votes
5answers
2k views

How to perform a depth-first preorder traversal of an expression?

Mathematica provides functions that perform a depth-first postorder traversal, or which use such a traversal, including: Scan, ...
10
votes
2answers
179 views

Unexpected behavior when directly assigning to DownValues

I'm encountering some unexpected behavior when assigning to DownValues. When I assign two definitions for test[1] as below, ...
10
votes
3answers
521 views

Mathematica unable to solve easy differential equation $y''+y\,y'=0$ with initial conditions $y(0)=1, y'(0)=-1$

Trying to solve the following: DSolve[{y''[x] + y[x] y'[x] == 0, y[0] == 1, y'[0] == -1}, y[x], x] leads Mathematica to declare that no analytic solution exists <...
5
votes
1answer
208 views

ConversionRules and style inheritance

Take the LaTeX-Article stylesheet stylesheet = FileNameJoin[{"Article","LaTeX-Article.nb"}]; Compare these outputs ...
15
votes
1answer
331 views

Why do subsequent evaluations seem to be stopped by a False Condition (/;)?

Exploring another problem and this example of @halirutan, I came across an evaluation behavior I don't understand. When g[] below is evaluated the first time, <...
18
votes
2answers
276 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, ...
5
votes
3answers
165 views

Why does `Block` reset `Attributes`?

Not even "formal symbols" such as \[FormalX] are guaranteed to always be symbolic. Their Protected argument is forgotten when ...
53
votes
5answers
1k views

Placement of Condition /; expressions

It is my practice to place Condition expressions on the left side of := and :> in almost ...
5
votes
1answer
208 views

Multiple down-values with exactly the same lefthand side

I was working on an answer to this question, when I was sidetracked by what I bring up here. I wanted a function, which when given a string representing a binary number, would convert the string to a ...
5
votes
2answers
212 views

Capturing an F1

I teach an Intro to Mathematica course, and one of the things I try to reinforce early on is just how helpful Mathematica's help is. In the very first lab for the course, I even give the students a ...

15 30 50 per page