Questions tagged [core-language]
Questions on the basic structure of the Mathematica language (Wolfram language) including atomic data types, syntax etc
561
questions
1
vote
1
answer
79
views
How to convert a function with named arguments to a pure function?
A function is defined with named arguments. How can this function be converted to a pure function that uses slots (#). As a simple example, how can the following:
<...
1
vote
1
answer
76
views
Where does the result of thing["Properties"] come from?
Question
I'll focus on the example
stream=AudioStream@First@$AudioInputDevices
I can do stream@"Properties" to get a ...
5
votes
2
answers
203
views
Do not understand evaluation order of ReplaceAll [duplicate]
{x, x^2, Length@x, Subsets[x]} /. x -> {1, 2, 3}
(* {{1, 2, 3}, {1, 4, 9}, 0, {{}, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}}} *)
with error
What ...
4
votes
3
answers
251
views
Delete first case
How to delete just first occurrence of given value from a list?
Without sorting etc.
Something like this:
...
5
votes
1
answer
48
views
Assumptions about indexed variables
I am interested in the most efficient way to impose assumptions on indexed variables. In the following stylized problem, the following code
...
0
votes
1
answer
54
views
Using Unevaluated to get a list of symbol names
The official documentation of Unevaluated contains the following example:
...
3
votes
2
answers
120
views
Slots inside nested pure functions
I'd like /@ instead of Table or Map.
But let we have it inside pure function:
...
1
vote
1
answer
42
views
Get FullForm content
For this challenge I need to get FullForm as array, string or nested function.
Especially for number expressions.
The best I have achieved is:
...
2
votes
2
answers
211
views
How to implement Newton's Identities
I need to produce identities related to Newton's Identities of arbitrary order. More specifically, I need the identities in the following image for an arbitrary n:
What I can't quite wrap my head ...
3
votes
1
answer
64
views
How to enforce/specify the type of a module local variables similar to the module arguments?
In Mathematica, one can specify the type of a module argument by giving the Head name. I am using type loosely here since Mathematica does not have types. But this does basically the same thing. So ...
1
vote
1
answer
45
views
VEHICLe dataset - aromatic ring counts problem
I was recently exploring the VEHICLe data set and seem to have run into an inconsistency. The dataset is described as,
The VEHICLe database, short for Virtual Exploratory heterocyclic library, ...
3
votes
1
answer
150
views
A workaround needed to overcome the Derivative function anomaly in Mathematica 13
Edits:
Additional illustrations are provided for comparison with D[] in Mathematica 12, as clarifying examples, supplemented at the end.
An erroneous Derivative ...
7
votes
2
answers
373
views
Why do some functions require its arguments to be in a list while others accept these as a sequence? [closed]
With Midpoint[{{4, -2}, {2, 5}}], the vectors must be in a list.
But with EuclideanDistance[{-2, 2}, {3, -6}], they don't.
These ...
1
vote
0
answers
32
views
Clustering related entities using the data from Wikidata
This question starts from Creating a Graph of related entities with the data from Wikidata
Compared to the previous question, I have defined a larger starting set, which I am going to enrich with ...
5
votes
1
answer
88
views
FindIsomers produces disconnected fragments
I was playing around with FindIsomers and got this strange result,
FindIsomers[Molecule["butane"]]
output
This seems unexpected in the sense that you ...
0
votes
0
answers
120
views
Codewars and Mathematica
I looked up the Wolfram Language on Codewars as the site is great to improve coding.
WL is not among the listed languages (I checked the beta versions as well). I assume this is because the language ...
19
votes
1
answer
751
views
When did this global rules change happen in Mathematica? Is this change documented?
In this Wolfram talk video titled "Professor Richard J. Gaylord's Wolfram Language Fundamentals Part Two" he shows at time 36:45 the following
Where there are two definitions for ...
4
votes
2
answers
205
views
What should mapping over a number or symbol produce?
I expected it to be an error (i.e., produce an error message), but Map[f,num] is num. Why is this the correct behavior? If it is ...
4
votes
0
answers
70
views
What are some basic references for learning "box language" and further mathematica language customization techniques? [duplicate]
I'd like to be able to understand and write mathematica code that is able to customize in some way the output of mathematica in notebooks, for example. I believe I need to learn the so called ...
3
votes
1
answer
173
views
BUG - Different Cloud vs. Desktop Return behavior in V13.1 [duplicate]
After install V13.1 one of my scripts get broke in my Mac. Here is the bug:
Module[{}, Return[1]; 2]
Return[1]
When I tested ...
11
votes
2
answers
454
views
How can I create an atomic head or treat some head as atomic during Map?
For example,
Map[g, {0, {h[1, 2, 3]}}, {-1}]
gives
{g[0], {h[g[1], g[2], g[3]]}}
I want a ...
0
votes
0
answers
48
views
Evaluation involving complex conjugates
I was trying to write an expression involving Conjugate. To create a minimal example, however, I have reduced it down to these expressions.
...
0
votes
0
answers
42
views
Extracting function domain from a finite set of assignments
Suppose we define a function through a finite collection of equalities, e.g.,
f[1] = 1; f[26] = 321
and so on. We can extract the set of output values by running
<...
1
vote
1
answer
46
views
How to define the `Length` property of some expensive function (UpValues, DownValues and order of execution confusion)
I want to define the Length property for some function that is computationally expensive and returns a list. So if the function is ...
6
votes
1
answer
268
views
Is K is a function? [duplicate]
Some of the capitalized single letters are functions. Starting a fresh kernel and typing in the 24 capital letters, the following letters turn black since they are special functions,
...
3
votes
0
answers
69
views
Problem with Mathematica Relationship Building
When I enter the following to get Mathematica to open my pod door I get
Could someone try and replicate this? Also, my name is not Dave and I throw my own error...
...
4
votes
1
answer
151
views
Differences between minimization functions?
There's more than 20 functions having to do with minimization
...
2
votes
3
answers
208
views
How to map integration and multiplication to a serie?
*For further study of series, they can be put into a different form.
Normal[Series[1/(1 - x), {x, 0, 10}]]
This serie 1/(1-x) = 1 + x + ... ,must be first ...
0
votes
0
answers
86
views
How can I add such objects as three dots and plus
What kind of objects do the red arrows point to in the following images?
Things like the "Three dots plus". What is the name of this object and how do I insert it? And also the second ...
0
votes
0
answers
37
views
Adding new functions globally [duplicate]
Perhaps this is bad practice, but I'm wondering if it's possible to create my own Mathematica functions and make them equivalent to core functions (i.e they are available in any notebook/kernel ...
0
votes
1
answer
66
views
Applying pure function to an association, why the square brackets? [closed]
I'm studying the wolfram guide and I'm trying to figure out why the square brackets on the right side:
...
4
votes
1
answer
103
views
Creating a Graph of related entities with the data from Wikidata
I've a list of Entities from Wikidata
...
5
votes
1
answer
140
views
How can I remove First[{}] from the output list of a function?
Consider:
listOfKeys = {"Ambientalismo", "Anoressia"};
list2 = First /@ (WikidataSearch /@ listOfKeys)
I've tried
...
0
votes
1
answer
178
views
How to get a specific element from a list {a, b, c, d}? [closed]
For example, I have x ={11,12,13,14}, how do I get the element staying at the third place, that is, 13?
0
votes
1
answer
51
views
Program works, but then fails when I write it inside Module [duplicate]
I'm new to Wolfram Language; I'm trying to get used to it by writing a bunch of code and programs, being one of them the algorithm for the bisection method.
When I write the algorithm outside of a ...
6
votes
3
answers
1k
views
Can someone tell me what's wrong with this nested IF? [duplicate]
I have written a very simple nested If as follows
...
1
vote
0
answers
55
views
Outer vs Tuples, what's the meaning of this sentence from the Wolfram ref? [closed]
Results from Outer involve extra sublists:
...
0
votes
1
answer
45
views
Distribute an operation on the cartesian product of two sets
I've been trying some different approach but all are not working:
I've got 2 polls, the first with 2 options (and 2 list of people which voted each option), the second with 3 options (and 3 list of ...
18
votes
3
answers
556
views
Difference between HashTable datastructure and Association datastructure
Is there a difference in the runtimes between CreateDataStructure["HashTable"] and <||> in terms of inserting, ...
0
votes
0
answers
68
views
Is SetDelayed creating Functions?
I was trying to create a named function using a short syntax (I mean avoid writing Function[]). I thought SetDelayed was the short for Function[], but then I had some issues and realized that maybe #x ...
0
votes
1
answer
62
views
What's the meaning of TypeSystem`Atom and TypeSystem`Vector?
SemanticImport is probably failing to import the data. In fact the log message is transformed into this weird entity.
Dataset[List["Error calling Sogei service http://lb-ven-onl-psqf.winco.local/...
4
votes
1
answer
78
views
How can default valued be added in a Query?
I'm not understanding the the default values are not used to produced a length of 0 in the following example. What is the right way to add default values during a query?
...
2
votes
1
answer
95
views
Can I tell whether a symbol is build-in (part of the System` library)?
I'd like a function that checks whether a symbol is a predefined part of the language or not. More generally, it might check whether it's part of a given package.
...
4
votes
1
answer
98
views
Making a rule that only applies when the expression is NOT an argument?
I know we can make rules of the kind:
magic/:f_[x___,magic[a_],y___]:=f[x,arg[a],y]
This will replace magic[a] by ...
-1
votes
1
answer
386
views
Keywords for the Wolfram Language [closed]
For a programming language, certain keywords are reserved; i.e., these tokens can't be used in any other context while programming in that particular language.
Here is a list of C language keywords ...
3
votes
1
answer
116
views
Why do these two calls to Apply return different results?
In the following example, why do these two calls to Apply return different results?
...
4
votes
1
answer
125
views
Alternatives in pure function construction
When I declare a function f in the following form:
f[a|b] := 1
then I can use it like:
...
3
votes
1
answer
46
views
Type formation rules for 1-position expressions
I made a summary of the rules for formation of types for simple 1-position expressions, as I understand them.
Here it is in textual form:
A symbol, say, α, is a discrete entity, represented by a ...
0
votes
1
answer
56
views
Debugging code with Plot function. Full details
This is some code:
The first plot (with the f[x,3]) gives me a graph.
The second plot (with the 'numerical' form of f[x,3] given) does give me a plot
How can I fix this so that the first line gives me ...
11
votes
1
answer
348
views
What is the relationship between the Wolfram executables? Where is this documented?
The relatively new wolframscript now accompanies the traditional math and wolfram binaries. ...