Questions tagged [built-in-symbols]
Questions related to handling built-in symbols and functions, for example why they behave a certain (possibly unexpected) way.
246 questions
10
votes
4
answers
520
views
Construct a pure function containing built-in 'Sequence'
I guessed the output for
(Sequence[#, 7]&)[3]
should be
Sequence[3,7]
But my guess was wrong. See the screenshot:
And I ...
6
votes
2
answers
750
views
What is the character [esc][cc][esc]?
esc + cc + esc gives a double-struck lower-case c. It is different, however, from the double-struck c given by esc + dsc + esc (the double stroke is curved in the former but vertical in the latter). ...
8
votes
2
answers
265
views
Can I put Association brackets <| … |> in an autocompletion template?
I have a function f which takes as one of its arguments an Association object, and I would like to produce a nice usage message ...
8
votes
2
answers
538
views
How to convert formal symbols to standard ones in an expression?
Mathematica generates an expression sometimes using \[Formal] symbols. This is causing a problem with the TeXForm code generated ...
5
votes
6
answers
503
views
Compare all elements of a set with a specific number and return 1 or 0
Say I generate a set of 20 random numbers by x=RandomReal[{0, 1}, 20], I want to compare every element of x with 0.4. If it is less than or equal to 0.4, then return 1; if it is greater than 0.4, then ...
3
votes
1
answer
444
views
Plot fails to plot. What am I doing wrong?
The below code executes. If I uncomment the Plot, it runs for a while and outputs nothing, not even the Mean and Variance.
...
3
votes
0
answers
50
views
Is this list of Formal Symbols complete? Which versions have unprotected Formal Symbols?
Formal Symbols are protected against being assigned values, making them handy for avoiding name collisions for things like fit parameters and pattern matching. Because formal symbols (and others) like ...
8
votes
3
answers
147
views
Is there a PartDelete like there is a TakeDrop
TakeDrop is nice because after taking a subarray, it also returns the remaining subarray. But it is limited in that the part specification can only be ranges, and ...
32
votes
2
answers
2k
views
List of atomic expressions
I was surprised to see Graph objects are atomic. Is there a way (through documentation or programmatically) to find all atomic heads?
The ones I know of are:
...
1
vote
0
answers
30
views
Can we find (and understand) the ordering functions used in the various output forms?
Can we use (and perhaps even understand) the sorting functions used in the various output forms (such as OutputForm, TraditionalForm, TeXForm, etc...).
This is motivated by the fact that I would like ...
3
votes
2
answers
153
views
Check an input matrix M contains any nonzero diagonal matrix element or not
Is there a way to easily check an input matrix M contains any nonzero diagonal matrix element or not?
For example,
if the M contains any nonzero diagonal matrix element, Output: True.
if the M ...
2
votes
1
answer
95
views
Distinguish .nb that has been saved from new .nb
There may be many ways to distinguish .nb that has been saved from new .nb
I found that in NotebookInformation[] may be useful.
...
1
vote
3
answers
114
views
A variable with a^2=0 [closed]
I want to do something simple.
I want to define a variable such that a^2=0, so that say:
Exp(a) = 1+a
And any other function automatically f(a)=1+f'(0)a.
Is it possible to do that in Mathematica?
2
votes
0
answers
35
views
What are the (potential) uses of those utility functions in the context GroupTheory`Tools`?
This old answer briefly described the usages of
GroupTheory`Tools`Multisets,
GroupTheory`Tools`MultiSubsets,
...
7
votes
7
answers
704
views
Grouping consecutive elements at specified positions
Let
L1={1,2,4,6,8,9,10,14,15,17,21,22,72,76,80,96,106,116,117}
Question1) Group from 10-th to 14-th elements in L1.
So that the ...
7
votes
8
answers
497
views
What is the inverse of the Position function?
What is the inverse of the Position?
I have an array which contains the positions of elements and I want a function which returns an List which contains 1 where ...
1
vote
1
answer
144
views
Can the Debye functions be implemented using built-in functions?
It is claimed in the comments here that the Debye functions can be implemented using built-in special functions. This is clearly true for some Debye functions, e.g., $D_n^{(1)}(x)$ for $n = 1, 2, 3$ (...
3
votes
5
answers
2k
views
How to obtain the gradient of a function as a function?
The Grad function allows me to get the gradient of a function like this:
...
3
votes
1
answer
117
views
Factor gives non-factorized result
The Factor built-in function is usually idempotent, namely applying it twice gives the same result. However, in the following example it is not. Is that expected? ...
0
votes
0
answers
44
views
Palette that gets single keystroke as input
I could find many examples of user-made Palette with many buttons in it.
And drawing-tools Palette is not user-made, but it accepts a single keystroke as input.
(In ...
1
vote
0
answers
41
views
"ParticleData[] " command $Failed
I am using Mathematica version 13.2. I am trying to use Mathematica's "ParticleData" command to get the information about the particles directly from PDG. But, whenever I am trying to ...
0
votes
0
answers
137
views
How to use Switch for more than one switchable arguments (in a compilable way)?
Consider some example of usage of the function Switch:
...
3
votes
1
answer
86
views
Custom iterable objects
I understand that to create objects with custom behavior with respect to existing code one uses upvalues. However, I'm at loss when it comes to guess what interface is expected from objects fed to ...
7
votes
1
answer
138
views
Get All Discrete Univariate Distributions with Symbolic Parameters
I am trying to get all Discrete Univariate Distributions with symbolic arguments from any place in Wolfram Language system. For example this guide:
http://reference.wolfram.com/language/guide/...
3
votes
1
answer
240
views
Test whether an expression contains a particular pattern
How to test whether an expression contains a particular pattern ?
I made a function for myself that tests whether an expression contains Plus or not.
...
3
votes
1
answer
83
views
Basic question Sort criteria
Can you explain the following codes? (output of codes)
I know that
there is the default ordering for any expression in Mathematica
and Sort uses the default ...
1
vote
1
answer
99
views
Why do some functions, or at least, PowersRepresentations, run far faster on subsequent calls? What determines this behaviour?
Say I run the following:
PowersRepresentations[4782969,4,2]
and it takes about 2 minutes. If I call it again it takes only about 0.0005 seconds.
What determines ...
2
votes
1
answer
85
views
Defining function for decimal value k[0.5+0.5]
k[1 + 1] = 2;
k[1 + 0.5] = 1.5;
k[0.5 + 0.5] = 1;
{k[2], k[1.5], k[1]} // TableForm
2
1.5
k[1]
Can you explain this phenomenon? I think the output should be
...
8
votes
1
answer
351
views
What is MergeDifferences?
My version is 13.2.0 for Mac OS X ARM (64-bit) (November 18, 2022).
The symbol MergeDifferences appears in the auto-completion
...
5
votes
5
answers
268
views
How to get the action diagram when the group act on a set?
I previously thought the orbital map would achieve this, but as the current answer or discuss in the comment. I realized that was wrong. And the Close behavior advice tells me "Needs details or ...
12
votes
2
answers
366
views
How can I create a shortcut to convert "normal Symbol" to Formal Symbol?
I'd like to create a shortcut to convert a selected symbol, say \[Delta], into its rough equivalent formal symbol (i.e., ...
1
vote
1
answer
128
views
Need a few built-in Symbols (functions) whose Options are a mix of Rule-s and DelayedRule-s [closed]
This is for examples in documentation I'm writing for a ResourceFunction["PrettyOptions"] (look for it soon) that is close to completion. Asking for most ...
2
votes
1
answer
85
views
`SequencePosition` doing unnecessary work
SequencePosition returns only the first sequence in a list that matches a given pattern with
SequencePosition[list,pattern,1]
...
2
votes
2
answers
116
views
Write an expression that queries all of MMA to find the top M Symbols with the most Options or M Symbols having N Options?
I apologize, but I'm way over my pay-grade on this one, so I don't have any code to share that needs correcting. That is because I really don't know how to start this. I feel like this has a very easy ...
9
votes
1
answer
320
views
How to restore the compile function from FunctionCompileExportByteArray
We can compile a function into a ByteArray object:
...
3
votes
0
answers
62
views
ContinuousMarkovProcess built-in function
Is the built-in function ContinuousMarkovProcess in Mathematica is the well-known Gillespie algorithm?
2
votes
1
answer
926
views
How to copy infinity symbol as ∞ and not as \[Infinity]
FromCharacterCode[8734]
(* ∞ *)
No matter how I copy ∞ whether as plaintext or input text or whether it is inside string like <...
0
votes
1
answer
127
views
How to convert a list of indexed variable names to a list of formal symbols?
I have the following list of indexed variable names:
list = {x1,x2,x3,x4};
I would like to build a list of formal symbols from the above list, i.e.
...
6
votes
3
answers
170
views
Customized priority function in DataStructure["PriorityQueue"]?
I'm using Mathematica 12.1. The documentation for DataStructure["PriorityQueue"] claims that,
... the highest-priority element is always returned.
The ...
1
vote
1
answer
89
views
Why does my simple string function fail to grab the only element in a List?
The idea is to normalize a string before processing it to extract information from it. Strings may come with embedded outer brackets which are easily stripped or as elements of a true list. This is ...
1
vote
1
answer
91
views
Ensure that Options for built-in symbols are the original defaults
I often create symbols (no args) or functions (with args) in which common options (and styles) are set in body and unique opts within args for managing multiple calls to built-in functions. these spit ...
4
votes
0
answers
43
views
Sequence in superscript
The code DisplayForm@SuperscriptBox[a,b,c] makes a invalid box. It still renders like $a^b$, but it's red with an error message (as it should be).
That being said,...
5
votes
1
answer
172
views
Evaluating PlusMinus to 2 decimal answers
How do I evaluate and expand an expression containing PlusMinus such that:
N[PlusMinus[1, 1]]
returns
2, 0
I'm stuck at ...
0
votes
0
answers
70
views
Packed/Unpacked array - what object/like 0 or 1?/how to check/ [duplicate]
In Mathematica, there is a concept called packed array.
...
6
votes
1
answer
155
views
What is the purpose of StrokeForm?
Symbol System`StrokeForm is present already in Mathematica version 8 (but not in version 5.2).
Currently, it is used in built-in themes, for example:
...
1
vote
2
answers
169
views
Two questions about `Infinity` [closed]
These are 2 small questions about Infinity. They are not related each other.
Q1)
...
4
votes
1
answer
134
views
Extracting list structure from nested list
Can we construct a function f, g in mathematica such that
For any list L,
g[Flatten[L],f[L]] ...
1
vote
1
answer
446
views
The square of Abs of a complex number
We all know that
4^2 + 22^2 = 500
Is there a natural way to generates 500 from the complex number ...
1
vote
2
answers
78
views
Theoretical Timing possible? (not changes for each evaluation)
Is there a method to measure theoretic time load (hope +theoretic memory load) of an evaluation?
They should not change - always generate same value after pressing Enter key(=evaluation).
Hope they ...
2
votes
1
answer
362
views