Linked Questions

267
votes
12answers
45k 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 ...
65
votes
7answers
6k views

Struct equivalent in Mathematica?

I really miss having something like a struct in Mathematica. I know of (and regularly use) a couple of programming techniques which feel like a ...
75
votes
5answers
5k views

How to compile effectively?

What are the best practices of compiling functions? I understand that this is a vague question, but let me list some aspects that might trigger useful answers. Some of these have already been answered ...
30
votes
4answers
1k views

How do I evaluate only one step of an expression?

I am looking for a simple, robust way to evaluate an expression only one step, and return the result in a held form. The definition of a single step is ambiguous, and this itself is probably worthy ...
23
votes
7answers
441 views

What kinds of uses of SymbolicC (introduced in Mathematica 8) do you foresee? Are there any neat examples already?

Mathematica 8 introduced SymbolicC, a set of Mathematica functions that capture C language constructions in the familiar Mathematica tree-like fashion. Additionally, there are functions to write ...
17
votes
2answers
493 views

How to inject an evaluated expression into a held expression? [duplicate]

I know that there are methods to structurally manipulate held expressions (discussed e.g. here), but I failed to apply those for this particular problem: ...
7
votes
6answers
184 views

How to join held Lists?

Let's say I have a = Hold@{2+2} b = Hold@{4+4} How can I get Hold@{2+2,4+4} ie join the two held lists ? More ...
12
votes
2answers
417 views

How can I compile this function

I want to simplify my function f1 to f2, but f2 can't be compiled. How can I make it ...
8
votes
1answer
331 views

Compile function which calls other functions to C

I have a function which calls other functions and I would like to compile it to C code. For example: ...
10
votes
1answer
282 views

Using Apply inside Compile

In this great answer a compiled version of the Nelder-Mead algorithm is presented. Since it works on arbitrary dimensions (i.e. arbitrary number of arguments), it has to use apply on the objective ...
5
votes
1answer
161 views

How to use Compile to efficiently apply a function to every element of a list

Let's say I have a list of random numbers; list = Table[Random[], {100000}]; I want to apply a function f in every element of ...
1
vote
1answer
153 views

Compile with array operations

When I use the function f with only the Module ...