All Questions
85,018
questions
632
votes
7
answers
191k
views
xkcd-style Plots
I received an email to which I wanted to respond with a xkcd-style graph, but I couldn't manage it. Everything I drew looked perfect, and I don't have enough command over ...
588
votes
19
answers
149k
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 ...
528
votes
37
answers
121k
views
What are the most common pitfalls awaiting new users?
As you may already know, Mathematica is a wonderful piece of software.
However, it has a few characteristics that tend to confuse new (and sometimes not-so-new) users. That can be clearly seen from ...
297
votes
6
answers
154k
views
How do I draw a pair of buttocks?
I'm trying to develop a function which 3D plot would have a buttocks like shape.
Several days of searching the web and a dozen my of own attempts to solve the issue have brought nothing but two ...
247
votes
8
answers
17k
views
What are the use cases for different scoping constructs?
Mathematica includes three functions that I know of which can be used to effectively (if not actually) define a variable and give it a value within a local scope: ...
211
votes
2
answers
13k
views
What is the distinction between DownValues, UpValues, SubValues, and OwnValues?
When reading through the documentation, you often encounter the phrases DownValues, UpValues, ...
204
votes
2
answers
41k
views
Help find a bright object on Mars!
In today's news, scientists found a bright object on one of Curiosity's photos (it's near the bottom of the picture below). It's a bit tricky to find - I actually spent quite some time staring at the ...
200
votes
2
answers
63k
views
QR Code in shopping cart handle
This week, the market people from my work wanted to put QR codes in shopping cart handles, but when they tested it, the QR code did not work. I noted that the cylindrical curvature (even small) ...
199
votes
22
answers
16k
views
What are some useful, undocumented Mathematica functions?
There have already been some questions about some undocumented functionality in Mathematica. Such as (please add to these lists!)
How can one find undocumented options or option values in Mathematica?...
197
votes
3
answers
48k
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 ...
193
votes
9
answers
70k
views
Elegant operations on matrix rows and columns
Question
The Mathematica tutorial has a section 'Basic Matrix Operations', describing operations like transpose, inverse and determinant. These operations all work on entire matrices. I am missing a ...
178
votes
5
answers
17k
views
Performance tuning in Mathematica?
What performance tuning tricks do you use to make a Mathematica application faster? MATLAB has an amazing profiler, but from what I can tell, Mathematica has no similar functionality.
176
votes
6
answers
22k
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 ...
171
votes
8
answers
20k
views
List of compilable functions
Is there somewhere a list on the functions that Compile can compile, or the cases in which a particular function can be compiled that I haven't found?
I'd be glad ...
169
votes
1
answer
30k
views
Mathematica Minecraft
Some time ago I asked myself: with all these great graphics and interactive capabilities of Mathematica, what kinds of 3D games can be implemented in it? And the answer which came to mind is ...
166
votes
6
answers
8k
views
How can one find undocumented options or option values in Mathematica?
Mathematica has a lot of undocumented or poorly documented options.
How does one go about working out if there is an undocumented option that might solve a particular problem?
How does one work out ...
164
votes
5
answers
15k
views
Are you interested in purchasing David Wagner's "Power programming with Mathematica"?
I recently contacted McGraw-Hill to see if they have a mechanism in place for printing out-of-print books that are still of interest. Specifically, I asked about "Power programming with Mathematica" ...
159
votes
3
answers
12k
views
How to make use of Associations?
I have been curious about it for long. Now that Mathematica 10 arrives, I think it's time to ask the question: How the new Association data structure would be used ...
156
votes
12
answers
51k
views
1 Plot, 2 Scale/Axis
I would like to plot those two datasets on top of each other. But they have very different range on the $y$ axis. How can I have two different axis?
I found the following on the help menu but quite ...
150
votes
9
answers
14k
views
General strategies to write big code in Mathematica?
I think after six months of exposure to Mathematica and the Wolfram Language I am fairly OK with writing short codes and snippets. However, what are some general strategies to use in order to write ...
148
votes
4
answers
26k
views
How to create word clouds?
Word clouds are rather useless fancy and visually appealing plots, where words are plotted with different sizes according to their frequency in a corpus. Many applications exist out there (Wordle, ...
147
votes
7
answers
33k
views
How to generate a random snowflake
'Tis the season...
And it's about time I posed my first question on Mathematica Stack Exchange.
So, here's an holiday quest for you Graphics (and P-Chem?) gurus.
What is your best code for generating ...
141
votes
3
answers
21k
views
How to manipulate 2D plots?
When it comes to visual analysis, large datasets or data with intricate internal details often makes plotting in 2D useless, as the outcome is either just a fraction of the full dataset, or no details ...
136
votes
9
answers
33k
views
$\LaTeX$ and Mathematica
I quite often would like to draw graphics in my $\LaTeX$ documents using Mathematica. I have encountered three problems. I would like to know if there are any workarounds to these problems
I would ...
136
votes
7
answers
160k
views
Get a "step-by-step" evaluation in Mathematica
Is it possible in Mathematica to get a step-by-step evaluation of some functions; that's to say, outputting not only the result but all the stages that have led to it? If so, how does one do it?
...
136
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/...
135
votes
5
answers
17k
views
Resources for beautiful Mathematica Stylesheets
When the Wolfram Demonstrations were introduced and the Documentation-Center was redesigned, I remember it was the first time I thought someone had put some effort into creating a beautiful stylesheet....
131
votes
9
answers
28k
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 ...
127
votes
3
answers
32k
views
Is there an open source implementation of Mathematica-the-language?
I've seen questions before such as "What is the best open-source equivalent for Mathematica?", but that specific question (and that line of inquiry in general) cares more about the computer algebra ...
126
votes
2
answers
6k
views
Implementing efficient multiple undo
At the time this question was asked, version 10 was not out yet. The Front End of Mathematica 10 does have multiple undo, see the answer by John Fultz.
The Mathematica Front End's built-in Undo ...
122
votes
3
answers
8k
views
What is a Mathematica packed array?
A simple sounding question with a few sub questions:
What is the difference between unpacked vs packed array?
Are packed arrays more space efficent, how much so?
Are packed arrays more time ...
121
votes
7
answers
7k
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 ...
121
votes
7
answers
16k
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 ...
121
votes
7
answers
13k
views
Minimal effort method for integrating C++ functions into Mathematica
Update: While at the time of writing the question loading DLLs with .NET/Link seemed easier, now I always use LibraryLink, which I recommend to anyone with a similar problem!
As of Mathematica 8, ...
119
votes
1
answer
8k
views
File-backed lists/variables for handling large data
Background
Currently I am working with some large data (most of it generated by Mathematica itself). I usually find it a hassle to do this. For example, I just exported a large amount of data to ...
118
votes
7
answers
13k
views
Generating visually pleasing circle packs
EDIT: (my conclusion and thank you note) I want to thank you all guys for this unexpected intellectual and artistic journey. Hope you had fun and enjoyed it the same as I did.
I would like to ...
117
votes
1
answer
2k
views
Why are numeric division and subtraction not handled better in Mathematica?
There is something that has been troubling me for a while. At least through version 10.0 the performance of a / b and a - b is ...
115
votes
9
answers
6k
views
Functional style using lazy lists?
Let's say I want to answer the question "what are the first 400 palindromic prime numbers?"
The first approach that comes to my mind from the set of languages that I know is to use some sort ...
115
votes
3
answers
5k
views
Programmatic formatting for Mathematica code - possible?
It seems to be both an interesting programming challenge and a very useful practical application to have a Mathematica program which would allow one to pretty-print Mathematica code, so that it is ...
113
votes
6
answers
28k
views
Exporting graphics to PDF - huge file
I want to draw some basic surfaces, export them to PDF and include them in a LaTeX file. I create a simple 3D graphics object, for instance with
...
108
votes
4
answers
21k
views
Why should I avoid the For loop in Mathematica?
Some people advise against the use of For loops in Mathematica. Why? Should I heed this advice? What is wrong with For? What ...
107
votes
2
answers
27k
views
What is the difference between Reduce and Solve?
Solve and Reduce both can be used for solving equations.
Just by working with them, I know there are some differences between ...
106
votes
4
answers
6k
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 ...
106
votes
4
answers
10k
views
What are the recommended settings for git when using with Mathematica projects?
Background
I'm relatively new to git — currently overseeing an offshore .NET-based development project on GitHub within a private business account, but little experience beyond that.
I'd like to set ...
104
votes
6
answers
105k
views
How do I clear all user defined symbols?
Is there some way to do this other than going to Evaluation -> Quit kernel and firing a new one up?
103
votes
4
answers
5k
views
Replacement inside held expression
I wish to make a replacement inside a held expression:
f[x_Real] := x^2;
Hold[{2., 3.}] /. n_Real :> f[n]
The desired output is ...
103
votes
3
answers
14k
views
Recovering data points from an image
Unfortunately, some data can only be obtained in picture form (Japanese publications anyone?). Since this cannot be worked with, it has to be converted to a dataset that can; I was wondering whether ...
101
votes
4
answers
15k
views
Plot draws list of curves in same color when not using Evaluate
This example comes from
the Mathematica documentation for Plot
under Basic Examples.
Can someone please explain why these are each plotted as a different color in ...
100
votes
12
answers
11k
views
Artistic image vectorization
The question is
how can we use Mathematica to create vectorized versions of low-resolution images? The goal is to get an image suitable for quality printing at any resolution.
Since "true" ...
100
votes
2
answers
6k
views
Is it possible to define a new PlotTheme?
In version 10 one can define, say,
$PlotTheme = "Scientific"
Which changes the appearance of all plots. This is fantastic because on the one hand I can have nice ...