Skip to main content
37 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. ...
Szabolcs's user avatar
  • 236k
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: ...
dan7geo's user avatar
  • 1,410
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, ...
rcollyer's user avatar
  • 34.1k
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: ...
Carl Woll's user avatar
  • 131k
16 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 ...
Michael E2's user avatar
  • 239k
14 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 ...
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 ...
Kuba's user avatar
  • 137k
13 votes

Generating list of alphabet letters

Nowadays, one can use Alphabet[] along with Take[] or Part[] + ...
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: ...
b3m2a1's user avatar
  • 47k
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 ...
Szabolcs's user avatar
  • 236k
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 <...
John Doty's user avatar
  • 13.8k
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 ...
Szabolcs's user avatar
  • 236k
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 ...
J. M.'s missing motivation's user avatar
12 votes
Accepted

How to list all user-defined symbols?

User defined symbols/functions are in the Global` context: a = 1; b[x_] := a x^2; c[x_] := f[x]; Names["Global`*"] {"a", "...
corey979's user avatar
  • 24k
12 votes

PlusMinus definition unexpectedly affects plotting

It appears that PlusMinus is the only wrapper that is not Protected: ...
Mr.Wizard's user avatar
  • 272k
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 ?
John Doty's user avatar
  • 13.8k
12 votes
Accepted

Equivalent for \hookrightarrow, ↪

You can use an empty TemplateBox to create a new operator. For example: ...
Carl Woll's user avatar
  • 131k
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 ...
Alexey Popkov's user avatar
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 ...
Alexey Popkov's user avatar
11 votes
Accepted

1 is not the SameQ as Null, but why might 1 be Equal to Null?

=== (SameQ) tests structural equality and is meant mainly for programming uses. Like nearly all functions named as ...
Szabolcs's user avatar
  • 236k
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 ...
b3m2a1's user avatar
  • 47k
11 votes
Accepted

Change nested list of symbols to nested list of numbers

symbols = {e4, {e200, {e1, {e11, e23}}}}; Map[FromDigits@StringDrop[SymbolName[#], 1] &, symbols, {-1}] {4, {200, {1, {11, 23}}}} ...
kglr's user avatar
  • 399k
11 votes

Make symbols atomic, without losing their type

Perhaps what you want is symbolic tensors: http://reference.wolfram.com/language/tutorial/SymbolicTensors.html ...
Szabolcs's user avatar
  • 236k
11 votes
Accepted

Make symbols atomic, without losing their type

You could use my TensorSimplify package help with this. Install the paclet with: ...
Carl Woll's user avatar
  • 131k
11 votes

How to generate a horizontal histogram with words?

First of all, you don't need a Histogram, you need BarChart. Secondly, you need to massage the data slightly so each data point ...
MarcoB's user avatar
  • 67.5k
10 votes
Accepted

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

I use the word internal symbol rather than just symbol, to make it easier to distinguish between the name of a symbol and the internal representation of the symbol inside the kernel. I felt I should ...
Jacob Akkerboom's user avatar
10 votes
Accepted

Check if symbol is in core language

You can look it up using WolframLanguageData, which has a list of all pre-defined symbols: ...
C. E.'s user avatar
  • 70.9k
10 votes
Accepted

Implement abstract algebraic structure

I decided it was worth giving another example of modern OOP in Mathematica. There will be a small amount of code, but almost all of it is boiler-plate. I use a package to handle most of the boiler ...
b3m2a1's user avatar
  • 47k
10 votes

What is the difference between Clear and Remove?

To see the the difference, try: a = 1; f[i_] := a + i f[1] 2 Clear[a] f[1] NameQ["a"] 1 + a True ...
Sjoerd Smit's user avatar
9 votes

How to replace the symbol n in DifferenceRoot

There is a hidden option to change the variables used by DifferenceRoot[]: ...
J. M.'s missing motivation's user avatar

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