# Questions tagged [programming]

Questions on writing non-trivial programs in Mathematica. Do not use this tag for questions on plotting/graphics or for questions on doing mathematics with Mathematica, where the focus is more on the math than the program.

1,348 questions
Filter by
Sorted by
Tagged with
2k views

### Splitting up delimited data in lists

One task that I frequently find myself doing in Mathematica is splitting lists into lists of sublists, using specific elements to define the break-points. This is particularly useful with imported ...
190 views

Consider the following code: ClearAll[x, y] x = y; y = 2; ?x ?y This will store $x$ being equal to the variable $y$, and $y$ having the value of $2$. Now switch ...
460 views

### How to make a function like Set, but with a Block construct for the pattern names

How can we define a function that works like f[x_]=ComputeSomething[x] and treats x as a variable that does not have a value? ...
401 views

### Visualizing several long lists of numerical information to see relative frequency

Mathematica has very powerful visualization techniques. However, I'm at a loss at how to best make the following chart readable. ...
642 views

### RecurrenceTable not evaluated: mathematica just echoes input

Forgive the newbie question... I am trying to create a table of the following system, following the Stirling example in the documentation, but Mathematica just echoes my input. What am I doing wrong? ...
2k views

### Deploying Mathematica Content Online

I have the following program at home, which draws on a batch of pre-processed files (that are word frequency text files, compiled using ToLowerCase, ...
3k views

### ParallelTable and Table do not give same result

I have a question regarding the use of Parallelize. In the help one can read that “Parallelize[Table[expr,iter, …]] (which is ...
1k views

### Does AbsoluteTiming slow the evaluation time?

I've started using AbsoluteTiming to discriminate between similar function constructs, but I sometimes feel like it takes substantially more time to evaluate a ...
1k views

5k views

### Flatten command: matrix as second argument

One thing I could never wrap my head around is how Flatten works when provided with a matrix as the second argument, and the Mathematica help isn't particularly ...
886 views

### Continuous evaluation of complex calculations

When having a first look at some system, it's often very useful to just play with the parameters and see how it develops. Therefore, I would like to let a certain evaluation run "until I cancel it". ...
4k views

### How can I implement dynamic programming for a function with more than one argument?

Dynamic programming is a technique for avoiding the repeated computation of the same values in a recursive program. Each value computed is immediately stored. If the value is needed again, it is not ...
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 ...
22k 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 ...
6k views

### What are the best practices / most common / idiomatic ways to report errors in Mathematica?

In particular, what are the best ways to report errors about incorrect arguments to a function? Checking for the correct arguments is relatively easy using patterns, but how to report an informative ...
39k views

### Alternatives to procedural loops and iterating over lists in Mathematica

While there are some cases where a For loop might be reasonable, it's a general mantra – one I subscribe to myself – that "if you are using a ...
3k views

### The clearest way to represent Mathematica's evaluation sequence

WReach has presented here a nice way to represent the Mathematica's evaluation sequence using OpenerView. It is much more clear way to go than using the standard <...