As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [core-language]

Questions on the basic structure of the Mathematica language (Wolfram language) including atomic data types, syntax etc

Filter by
Sorted by
Tagged with
3 votes
1 answer
77 views

Condition inside pure function

Why condition /; not work inside pure function? Suppose we have: ...
1 vote
0 answers
48 views

Why do rules not default to local scope? [closed]

Consider the following: 80 //. a_?EvenQ -> a/2 a = 3 80 //. a_?EvenQ -> a/2 which outputs: 5 3 3/2 I think I understand ...
5 votes
0 answers
73 views

Using Cases to select expressions from a list

I am using v12.2.0 on Win7-x64. I want to use Cases to select the Times and Plus cases from ...
2 votes
1 answer
109 views

Why does using a variable name as pattern name determine its context?

Checking the context of a fresh variable inside Begin-End, it gives the enclosing context. ...
11 votes
2 answers
1k views

What is a function?

Regarding: Map[#[{2, b}] &, {Reverse}] The above works, but it makes my head spin. The documentation for Map says that the ...
2 votes
0 answers
75 views

With[{a=1},{b=a},b] in 13.2 does evaluate to 1 [duplicate]

This isn't documented, and the front end highlights the second comma and third argument in red, but it's used in DownValues[Once][[3]] and is very convenient. Anyone know more?
1 vote
1 answer
186 views

Convenient value assignments in OOP

It is possible to implement OOP in Mathematica using something like obj=c[<|a->1,b->2|>] and it's convenient to extract value from the object by ...
1 vote
1 answer
96 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 ...
1 vote
1 answer
88 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: <...
5 votes
2 answers
221 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
257 views

Delete first case

How to delete just first occurrence of given value from a list? Without sorting etc. Something like this: ...
4 votes
2 answers
133 views

Slots inside nested pure functions

I'd like /@ instead of Table or Map. But let we have it inside pure function: ...
5 votes
1 answer
51 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 ...
541 votes
37 answers
126k views

What are the most common pitfalls awaiting new users?

As you may already know, Mathematica is a wonderful piece of software. However, it has a few characteristics that tend to confuse new (and sometimes not-so-new) users. That can be clearly seen from ...
0 votes
1 answer
56 views

Using Unevaluated to get a list of symbol names

The official documentation of Unevaluated contains the following example: ...
1 vote
1 answer
44 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
214 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
69 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
46 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, ...
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 ...
3 votes
1 answer
151 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 ...
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 ...
76 votes
9 answers
10k views

Is Mathematica an Implementation of the Wolfram Language?

I am trying to figure out what the announcement of the Wolfram Language means for Mathematica. Is Mathematica an implementation of the Wolfram Language, or is it something else?
160 votes
3 answers
13k views

How to make use of Associations?

I have been curious about it for long. Now that Mathematica 10 arrives, I think it's time to ask the question: How the new Association data structure would be used ...
0 votes
0 answers
124 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
752 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
206 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
178 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
458 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 ...
6 votes
1 answer
286 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, ...
6 votes
1 answer
136 views

Why Does Subsets[...,{n}] not Output a Packed List, Even Though it Doesn't Unpack?

Assume list is packed. I expect Subsets[] is a structural operation because it depends on the number of elements, not on what ...
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
43 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
47 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 ...
3 votes
0 answers
72 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
163 views

Differences between minimization functions?

There's more than 20 functions having to do with minimization ...
2 votes
3 answers
212 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 ...
22 votes
1 answer
488 views

What's the difference between these 2 associations?

I have 2 associations similar to these simplified ones: ...
0 votes
0 answers
91 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 ...
26 votes
3 answers
618 views

Performance regression for Fold?

I noticed an over 10x performance drop on Mathematica v9.0.1 (as Oleksandr R. commented, also v8) compared with v7.01 for this code: ...
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
68 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
109 views

Creating a Graph of related entities with the data from Wikidata

I've a list of Entities from Wikidata ...
5 votes
1 answer
141 views

How can I remove First[{}] from the output list of a function?

Consider: listOfKeys = {"Ambientalismo", "Anoressia"}; list2 = First /@ (WikidataSearch /@ listOfKeys) I've tried ...
25 votes
5 answers
1k views

How can one manually change the rule ordering

I have a function which has some general behavior, but that should act on some specific kinds of objects in some other way. I know that Mathematica is supposed to automatically order the rules so that ...
0 votes
1 answer
262 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?
11 votes
1 answer
280 views

Can we change a pattern once we throw them into pattern matcher?

Main Problem Mathematica's pattern matching mechanism seems fairly well in most cases but in some situations, I would like to ask for a bit more freedom. We can easily call for extra evaluation while ...
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 ...

1
2 3 4 5
12