Questions tagged [wolfram-mathematica]

Wolfram Mathematica is a computer algebra system and programming language from Wolfram Research. Mathematica has its own Stack Exchange site at https://mathematica.stackexchange.com/ and that site is the preferred place to ask questions about it.

Wolfram Mathematica is a computer algebra system and programming language from Wolfram Research. The programming language is a term-rewriting functional programming language strongly influenced by . Not to be confused with mathematics ().

Mathematica has its own Stack Exchange site. That is the preferred site for asking questions on this topic.

Tips for asking Mathematica questions

  • Include self-contained source code or a link to a notebook that illustrates the issue
  • Include relevant image, for a graphics related question

A chat room for the tag is available here. It is intended for discussion of some meta-related problems and perhaps some social activity.

Free Mathematica Programming Book


Don't forget to check out our little Tool Bag and add your favorite tricks there.

4457 questions
22
votes
3 answers

What does "upvalue" mean in Mathematica and when to use them?

To me, g /: f[g[x_]] := h[x] is just verbose equivalent of f[g[x_]] := h[x]. Can you raise an example that you have to use /:?
xzhu
  • 5,675
  • 4
  • 32
  • 52
22
votes
2 answers

SaveDefinitions considered dangerous

SaveDefinitions is a nice option of Manipulate. It causes Manipulate to store any definitions used for its creation inside the Manipulate panel. A Manipulate made this way can be copied to an empty notebook and will still work on its own.…
Sjoerd C. de Vries
  • 16,122
  • 3
  • 42
  • 94
22
votes
3 answers

What are the standard colors for plots in Mathematica?

(Note: All the answers to this question are valid for versions of Mathematica before version 10. For versions 10 and above, see https://mathematica.stackexchange.com/questions/54486/how-to-access-new-colour-schemes-in-version-10 and…
Robert Filter
  • 1,661
  • 3
  • 12
  • 14
22
votes
4 answers

Plot a complex function in Mathematica

How can I make a Mathematica graphics that copies the behaviour of complex_plot in sage? i.e. ... takes a complex function of one variable, and plots output of the function over the specified xrange and yrange as demonstrated below. The magnitude…
Simon
  • 14,631
  • 4
  • 41
  • 101
22
votes
6 answers

Sample uniformly at random from an n-dimensional unit simplex

Sampling uniformly at random from an n-dimensional unit simplex is the fancy way to say that you want n random numbers such that they are all non-negative, they sum to one, and every possible vector of n non-negative numbers that sum to one are…
dreeves
  • 26,430
  • 45
  • 154
  • 229
22
votes
7 answers

ForEach loop in Mathematica

I'd like something like this: each[i_, {1,2,3}, Print[i] ] Or, more generally, to destructure arbitrary stuff in the list you're looping over, like: each[{i_, j_}, {{1,10}, {2,20}, {3,30}}, Print[i*j] ] Usually you want to use Map or other…
dreeves
  • 26,430
  • 45
  • 154
  • 229
22
votes
1 answer

Why does Mathematica use an underscore when defining parameters?

For example if I was defining the following function exprod[n_] := Expand[Product[x + i, {i, 1, n}]] Then why is the underscore after the variable n, necessary in the function definition? Where does this style come from or is it specific only to…
EthanLWillis
  • 930
  • 4
  • 14
  • 27
22
votes
2 answers

Image transformation in OpenCV

This question is related to this question: How to remove convexity defects in sudoku square I was trying to implement nikie's answer in Mathematica to OpenCV-Python. But i am stuck at the final step of procedure. ie I got the all intersection…
Abid Rahman K
  • 51,886
  • 31
  • 146
  • 157
21
votes
1 answer

How to create tabbed Mathematica notebooks

Is there a way to create and edit notebooks (sequences of cells) in a tabbed interface? Could such an interface be made with TabView or some other tool? I assume this would be possible if I made a front-end from scratch, but is there a way within…
Andrew
  • 1,041
  • 1
  • 16
  • 24
21
votes
4 answers

A fast implementation in Mathematica for Position2D

I'm looking for a fast implementation for the following, I'll call it Position2D for lack of a better term: Position2D[ matrix, sub_matrix ] which finds the locations of sub_matrix inside matrix and returns the upper left and lower right row/column…
Arnoud Buzing
  • 15,383
  • 3
  • 20
  • 50
21
votes
1 answer

Correct way to cap Mathematica memory use?

Under a 32-bit operating system, where maximum memory allocated to any one program is limited, Mathematica gracefully terminates the kernel and returns a max memory allocation error. On a 64-bit OS however, Mathematica will freely use all the memory…
Mr.Wizard
  • 24,179
  • 5
  • 44
  • 125
21
votes
1 answer

Import big files/arrays with mathematica

I work with mathematica 8.0.1.0 on a Windows7 32bit platform. I try to import data with Import[file,”Table”] which works fine as long as the file (the array in the file) is small enough. But for bigger files(38MB)/array(9429 times 2052) I get the…
partial81
  • 495
  • 6
  • 14
21
votes
3 answers

How do I label different curves in Mathematica?

How can I label each of these lines separately : Plot[{{5 + 2 x}, {6 + x}}, {x, 0, 10}]
500
  • 6,509
  • 8
  • 46
  • 80
21
votes
1 answer

Using strings instead of symbols: good or evil?

Often enough, I find myself dealing with lists of function options (or more general replacement lists) of the form {foo->value,...}. This leads to bugs when foo already has a value in $Context. One obvious way to prevent this is using a string…
Leo Alekseyev
  • 12,893
  • 5
  • 44
  • 44
21
votes
4 answers

Profiling memory usage in Mathematica

Is there any way to profile the mathkernel memory usage (down to individual variables) other than paying $$$ for their Eclipse plugin (mathematica workbench, iirc)? Right now I finish execution of a program that takes multiple GB's of ram, but the…
Mogos
  • 211
  • 2
  • 4