Tagged Questions

Questions on correct (or improved) formulation of Mathematica code to achieve particular results. Use this tag (not "symbol") for questions about all those odd @@ /@ # & and ~ characters.

learn more… | top users | synonyms

10
votes
3answers
320 views

Why does ++++x return an increment of 2 when the value of x is only incremented by 1?

This line returns 3: x = 1; ++++x However, the value of x after the increment is only ...
4
votes
3answers
266 views

Brackets in output make unable to use output to identify matrix element

I'm trying to write a code where each matrix element swaps with a randomly selected neighbor (cardinal directions only) to redistribute the matrix. So far I've been able to replace an element with its ...
10
votes
3answers
838 views

Working with PhysicalConstants

I recently found the PhysicalConstants` package. First I thought this was nice, since I didn't have to look up some quantities all the time and copy them into the ...
1
vote
1answer
155 views

Differentiation w/o assiging concrete values

v = Subscript[v, 0]*Sin[(Pi*S)/Subscript[S, 0]]; a = dv/ds v; a = D[v, s] returns ...
23
votes
1answer
436 views

Why doesn't PatternTest work with Composition?

While playing around with the solutions to this question, I've found some very strange behaviour: ...
23
votes
4answers
8k views

Is there a syntax for single-line comments for notebooks?

I'm aware that I can use (* ... *) to comment out stuff in a notebook. Many languages have a syntax for single-line comments, such as ...
2
votes
2answers
626 views

Single dot textual form

How do I render a letter with a single dot above it? I see \[DoubleDot] and \[TripleDot] are readily available, but what about ...
3
votes
5answers
466 views

Using variables in function names

I want to make a list of plots and my functions are named C1, C2... Cn. The command I wish ...
5
votes
4answers
292 views

Multiple colors in Graphics[] environment

There are other questions on the site that are similar to this one, but the answers provided didn't help me. I want to draw disks of different radii. Each radius is the absolute value of a variable, ...
12
votes
2answers
836 views

Representing second derivatives with a double overdot

I would like to express a second derivative with two dots above the variable. You can do this with a first derivative by saying: ...
9
votes
2answers
690 views

Flatten at a certain level

In an earlier question the brainteasing fourth syntax variant of Flatten was discussed. I see that with ...
13
votes
3answers
659 views

How do you programatically load data into symbols?

I am trying to convert a list of string names into symbols, which will then be used to store data. I have 24 files (where the name of each file is a member of the list mentioned above) that I need to ...
12
votes
3answers
427 views

With versus Function

I've seen people compare Block with Module and With as scoping constructs, and try to figure ...
45
votes
6answers
2k views

Functions vs. patterns

Every time I define a new function, I wonder which construct I should use: true functions obtained by using Function, or rule-based syntax. For example, these are ...
15
votes
2answers
391 views

Distributing PlusMinus consistently

I would like to give the built-in function PlusMinus, which is undefined by default, the intuitive meaning: considering all possible combinations of $+$ and $-$. ...
7
votes
2answers
273 views

What's the purpose of the Unique function?

As the title says: What's the purpose of Unique? I understand that it generates some unique symbol, but when and for what is it to be used? Are there applications ...
22
votes
5answers
2k views

Clear complains that a subscripted variable is not a symbol or a string?

Here's a small listing where I've used EscqEsc to typeset θ in the notebook: ...
25
votes
1answer
607 views

Convenient string manipulation

With Mathematica I always feel that strings are "second class citizens." Compared to a language such as PERL one must juggle a lot of code to accomplish the same task. The available functionality is ...
17
votes
5answers
493 views

Change syntax from other programs to mathematica syntax

Is there a good way to transform syntax from other computer algebra systems or from latex to mathematica syntax?
57
votes
2answers
2k 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 ...
30
votes
4answers
676 views

Usage of \[InvisibleApplication] and other related invisible characters

From the front end, \[InvisibleApplication] can be entered as Esc @ Esc, and is an invisible operator for @!. By an unfortunate ...