Hot answers tagged

35 votes

How can I adaptively simplify a curved shape?

We can use the Ramer-Douglas-Peucker algorithm to reduce the number of points. This algorithm was originally devised for processing map data. ...
  • 228k
34 votes
Accepted

What are the requirements for a well behaved indexed variable? Subscript, ToExpression, Downvalue?

General usage Here is what I think Using strings and subsequently ToString - ToExpression just to generate variable names is ...
33 votes

Character to replace _ in symbol names?

This has been discussed on comp.soft-sys.math.mathematica. The gist is that there are lots of Unicode characters you could use, e.g. \[LetterSpace] or ...
  • 8,614
30 votes
Accepted

Why did Mathematica choose brackets for function arguments over parentheses?

The answer is quite simple. Most people want to multiply numbers without having to use the * symbol, e.g. 3x vs ...
  • 33.4k
29 votes

How to create symbols from strings and set values for them?

So recently I've learned from John Fultz that RawBoxes are kind of verbatim indicator for MakeBoxes which is not well stressed ...
  • 133k
27 votes

Why does removing a function and defining it on the same line not work?

Executing Trace on an expression reveals what is actually happening: ...
  • 1,380
26 votes

How to make Mathematica variables declarative instead of just-in-time?

You are looking for $NewSymbol which is run every time a new symbol is created. For example, let say you only want x, ...
  • 33.4k
19 votes

Which Mathematica function has the longest name (by character length?)

Max[StringLength@Names["System`*"]] 38 ...
  • 54.6k
19 votes
Accepted

How can I obtain a complete list of the kinds of atomic expressions in the Wolfram Language using only the language itself?

You can use EntityValue to find out what symbols can be atomic: ...
  • 125k
16 votes
Accepted

Why does leaving and re-entering a context lose values defined in that context?

The definitions aren't being lost, they're being shadowed, as described in the tutorial on contexts. Mathematica doesn't warn you about this because it only warns when there is shadowing between ...
15 votes
Accepted

When is a symbol a Symbol? Is there an easy Mathematica way to test if an object is a symbol sort of like a SymbolQ?

I'd probably use x_Symbol in a function argument to control evaluation. Otherwise, one might do the following (thanks to @Leonid for pointing out an oversight). If ...
  • 222k
14 votes

Generating list of alphabet letters

Nowadays, one can use Alphabet[] along with Take[] or Part[] + ...
14 votes
Accepted

How to make Mathematica variables declarative instead of just-in-time?

Edit: method extended for multiple contexts and unlocking mehtod added. Let's protect whatever is a new symbol. In old answer I've manually excluded symbols matching ...
  • 133k
13 votes
Accepted

How can I replace the Greek symbols in an expression with their plain text names?

Extract all Greek letters from the documentation and make replacement rules: ...
  • 265k
13 votes

Why did Mathematica choose brackets for function arguments over parentheses?

Although Chip's answer already suffices to address the question, I would like to quote here a relevant part of the dialog by Theo Gray and Jerry Glynn in their book Exploring Mathematics with ...
13 votes
Accepted

How to remove a LocalSymbol (or CloudSymbol)?

Cloud symbols are stored in cloud objects (under $CloudSymbolBase) and local symbols are stored in local objects (under ...
  • 25.1k
13 votes

Character to replace _ in symbol names?

The issue is that Mathematica interprets underscore as Blank and interprets my_variable as a ...
  • 4,251
13 votes

How can I define symbols but not have them show up in the front end?

Core Function Here's a single function that does all this coloring stuff: ...
  • 45.7k
13 votes
Accepted

Why does args symbol exist in a fresh kernel?

It's a type of otherwise harmless bug that tends to come and go with versions. I would suggest to report it to Wolfram, but also not to worry about it. Notice that the symbols have no associated ...
  • 228k
13 votes

What does $ mean in an output?

This usually means you've exported a local symbol from the context in which it was localized. Consider: Module[{x}, x] (* x$24939 *) Your results may vary. The <...
  • 13.6k
12 votes

How to create symbols from strings and set values for them?

In Mathematica version 10, you can also use Inactive to allow the Symbol to be created before doing the assignment. Here is an ...
  • 95.5k
12 votes

Bug: With[] pattern-variable renaming misses symbols within `Except`

I agree that this is a bug. However, I want to point out that this usage of Except does not seem to be allowed in older versions. In version 9.0: We don't get the ...
  • 228k
12 votes
Accepted

Defining a symbol e that represents plus-minus-one, so that e^2 == 1 and e^3 == e

A quick way is to use TagSet[] and TagSetDelayed[] to teach Power[] how to deal with your ...
12 votes

PlusMinus definition unexpectedly affects plotting

It appears that PlusMinus is the only wrapper that is not Protected: ...
  • 265k
12 votes

When is a symbol a Symbol? Is there an easy Mathematica way to test if an object is a symbol sort of like a SymbolQ?

How about: SymbolQ[_Symbol] = True SymbolQ[_] = False ?
  • 13.6k
12 votes
Accepted

Equivalent for \hookrightarrow, ↪

You can use an empty TemplateBox to create a new operator. For example: ...
  • 125k
11 votes
Accepted

Which Mathematica function has the longest name (by character length?)

Which documented Mathematica function has the longest name I assume then you want all of Mathematica, which includes all standard packages and contexts that come in the installation and not just in ...
  • 115k
11 votes

How can I adaptively simplify a curved shape?

Here is my attempt to use ParametricPlot for obtaining an adaptive approximation of the shape. It is based on the code of glyph to ...
11 votes

How can I adaptively simplify a curved shape?

Here I present a very simple angle-based polygon reduction algorithm as described in the chapter "A Simple Algorithm" of David Eberly's "Polyline Reduction". The only addition is ...
11 votes

How can I implement a listener variable in Mathematica?

As part of handling this for myself I wrote a package that does it. The idea was to mimic the *Var() classes in tkinter. I'll do ...
  • 45.7k

Only top scored, non community-wiki answers of a minimum length are eligible