Linked Questions

597 votes
19 answers
154k 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 ...
139 votes
8 answers
8k views

Can one identify the design patterns of Mathematica?

... or are they unnecessary in such a high-level language? I've been thinking about programming style, coding standards and the like quite a bit lately, the result of my current work on a mixed .Net/...
Verbeia's user avatar
  • 34.1k
75 votes
6 answers
15k views

How can this confetti code be improved to include shadows and gravity?

Here's some confetti: ...
David's user avatar
  • 14.9k
45 votes
7 answers
5k views

Mathematica style guide?

I encountered this site today https://code.google.com/p/google-styleguide/ regarding the programming style in some languages. What would be best programming practices in Mathematica, for small and ...
faysou's user avatar
  • 11k
36 votes
6 answers
7k views

Finding all elements within a certain range in a sorted list

Suppose we have a sorted list of values. Let's use list = Sort@RandomReal[1, 1000000]; for this example. I need a fast function ...
Szabolcs's user avatar
  • 233k
52 votes
3 answers
5k views

Changing Values in an Association using Map

I am trying to change the value of one key in an association based on the value of another key in that association. So if my association starts as: ...
Jon F.'s user avatar
  • 645
39 votes
4 answers
4k views

How to create strong types?

In a program I'm writing, I create a list of lists, that looks something like this: {{100, {1,2,3,4,5}}, {105, {2,4,6,8}}, {42, {42,39,56}}} I then pass this ...
shanusmagnus's user avatar
  • 1,159
29 votes
5 answers
9k views

How can I implement object oriented programming in Mathematica?

Roman Maeder's object oriented programming package is nice, but I'm hoping someone can suggest a sleek and novel implementation that is easy to use.
M.R.'s user avatar
  • 31.2k
48 votes
2 answers
2k views

Granular versus terse coding

While reading Leonid's grand answers to General strategies to write big code in Mathematica? I came across something that goes against my own practices. I do not disagree with the principle but the ...
Mr.Wizard's user avatar
  • 270k
39 votes
2 answers
2k views

How to implement custom integration rules for use by NIntegrate?

How can NIntegrate be extended with custom implementation of integration rules? This answer of the question "Monte Carlo integration with random numbers generated ...
Anton Antonov's user avatar
18 votes
7 answers
1k views

How to search Dataset to find all keys share same Value

If I have the following Dataset ...
Basheer Algohi's user avatar
19 votes
4 answers
3k views

Pure Functions with Lists as arguments

Assuming I have two function: example 1: add[{x_, y_, z_}] := x + y - z add[{1, 3, 5}] If use pure function,I know I can write it as : ...
matrix42's user avatar
  • 6,754
28 votes
3 answers
1k views

Writing functions with "Method" options

I'd like to implement several behaviors for a particular function using a Method option added to the function definition: ...
dionys's user avatar
  • 4,321
17 votes
3 answers
6k views

How can I type-check the arguments of a Mathematica function?

(For educational purposes) I defined the following functions: Translation (in $\mathbb{R}^2$): trM[vec_] := {{1, 0, vec[[1]]}, {0, 1, vec[[2]]}, {0, 0, 1}} ...
nilo de roock's user avatar
70 votes
2 answers
2k views

Guidelines for planning custom GUI in Mathematica

This post is here to save your time during GUI development in Mathematica. And one way to do this is to know where limits are and to be aware of features that are awaiting. Background Usually I don't ...
Kuba's user avatar
  • 136k

15 30 50 per page