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
37
votes
6 answers

How to plot a gene graph for a DNA sequence say ATGCCGCTGCGC?

I need to generate a random walk based on the DNA sequence of a virus, given its base pair sequence of 2k base pairs. The sequence looks like "ATGCGTCGTAACGT". The path should turn right for an A, left for a T, go upwards for a G and downwards for a…
37
votes
1 answer

Strange Sin[x] graph in Mathematica

I randomly plotted a Sin[x] function in Mathematica 7 and this is what it shows: Note the visible defect at approximately x = -100. Here is a zoom of the defect part, clearly showing that Mathematica for some reason uses a much lower resolution…
houbysoft
  • 32,532
  • 24
  • 103
  • 156
34
votes
3 answers

Implementing a Quadtree in Mathematica

I have implemented a quadtree in Mathematica. I am new to coding in a functional programming language like Mathematica, and I was wondering if I could improve this or make it more compact by better use of patterns. (I understand that I could…
M-V
  • 5,167
  • 7
  • 52
  • 55
34
votes
3 answers

How to determine PlotRange to include all of graphics?

Given Graphics object, how do I determine the range of coordinates needed to include all of graphics? Basically I need something like what Show does by default, but I want to specify PlotRange,PlotRangePadding and ImagePadding explicitly. Example,…
Yaroslav Bulatov
  • 57,332
  • 22
  • 139
  • 197
34
votes
2 answers

Customizing Mathematica shortcuts

Is there a place I can view/change global shortcut options like Command + 9 (turn into Input style)? In particular, I need a faster way of creating bulleted lists. It's the style "Item" in the Cell context menu which doesn't have its own shortcut.
Yaroslav Bulatov
  • 57,332
  • 22
  • 139
  • 197
34
votes
1 answer

Mathematica: Unevaluated vs Defer vs Hold vs HoldForm vs HoldAllComplete vs etc etc

I'm bewildered by all the built-in Mathematica functions that purport to prevent evaluation in some way: Unevaluated, Defer, Hold, and over half a dozen of the form Hold*. The Mathematica documentation just explains each function in isolation…
dreeves
  • 26,430
  • 45
  • 154
  • 229
33
votes
5 answers

Currying with Mathematica

One may implement a limited form of Currying in Mathematica, using this construct: f[a_][b_][c_] := (a^2 + b^2)/c^2 Allowing one to do, for example: f[4][3] /@ Range@5 {25, 25/4, 25/9, 25/16, 1} There is a problem: Attributes only apply to the…
Mr.Wizard
  • 24,179
  • 5
  • 44
  • 125
31
votes
6 answers

Secret Santa - Generating 'valid' permutations

My friends invited me home to play the game of Secret Santa, where we are supposed to draw a lot & play the role of 'Santa' for a friend in the group. So, we write all our names and pick a name randomly. If any of us ends up having their own name…
fritz
  • 698
  • 6
  • 12
30
votes
4 answers

How to find line where error occurred in Mathematica notebook?

I have a Mathematica file called myUsefulFunctions.m containing, for example, a function called mySuperUsefulFunction. Suppose I call mySuperUsefulFunction in a notebook and get the following error: Part::pspec: Part specification #1 is neither an…
rjkaplan
  • 3,138
  • 5
  • 27
  • 33
30
votes
2 answers

Plot using With versus Plot using Block (Mathematica)

I want to describe an issue I have been having with Plot using With to keep defined parameters 'local'. I am not necessarily asking for a fix: the problem I have is one of understanding. Sometimes I use a construction such as the following to obtain…
681234
  • 4,214
  • 2
  • 35
  • 42
29
votes
7 answers

pair lists to create tuples in order

I'd like to combine two lists. If I have the following two lists: {a,b,c,d} and {1,2,3,4} what do I need to do so that I get {{a,1}, {b,2}, {c,3}, {d,4}}?
Martijn
  • 11,964
  • 12
  • 50
  • 96
29
votes
2 answers

Tail call optimization in Mathematica?

While formulating an answer to another SO question, I came across some strange behaviour regarding tail recursion in Mathematica. The Mathematica documentation hints that tail call optimization might be performed. But my own experiments give…
28
votes
3 answers

How to specify a particular plot marker from Mathematica's automatic list of markers?

Mathematica has ten basic plot markers which are used cyclically when making a ListPlot with PlotMarkers->Automatic. There are filled and empty versions of circle, square, diamond, up triangle, and down triangle. The eleventh marker repeats filled…
JxB
  • 977
  • 1
  • 7
  • 12
28
votes
11 answers

Abstract algebra and Programming

I am going to start learning Abstract Algebra- Groups, Rings,etc. I am interested to know any programming language, if at all which can help me learn/try the concepts I learn in theory. EDIT: I am not really looking at implementing what I learn. I…
user59634
28
votes
5 answers

Plotting horizontal and vertical lines in Mathematica

In Mathematica, how do you plot a horizontal line at a given number? How do you plot a vertical line at a given number?
karlsbad
  • 281
  • 1
  • 3
  • 3