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
1 vote
0 answers
31 views

Monitor inside core function

I like DistanceMatrix: its performance is surprisingly high, even for a big data. However, for a huge arrays and custom ...
lesobrod's user avatar
  • 1,197
0 votes
0 answers
53 views

MinimalBy with argument and value

I need to find element of some list arr which is minimal by some function f. But I need to get result in form ...
lesobrod's user avatar
  • 1,197
0 votes
0 answers
28 views

MapApply not converting numbers as strings to numbers

I have large vectors that were imported and came in as strings. I try to convert these to numbers using MapApply of ToExpression (and the "@@@" form of this). There must be some subtle ...
Mark R's user avatar
  • 1,579
1 vote
0 answers
32 views

Can symbolic sums of indexed arrays be simplified?

As a simple example, is it possible to simplify say Sum[Indexed[x, i], {i, 1, n}] == Indexed[x, n] + Sum[Indexed[x, i], {i, 1, n - 1}] If not, please explain ...
Alan's user avatar
  • 13.6k
4 votes
1 answer
103 views

Function[0], Function[,0], and Function[{},0]: Is there any inherent distinction in the "academic" sense?

Note that Function[,0] is by default interpreted as Function[Null,0]. The following three calls all give ...
user688486's user avatar
3 votes
2 answers
79 views

Problem with Association in DynamicModule

How can I understand the success of the first append but the failure of the second, here? (Mma 13.3.) Is there a ready work around? ...
Alan's user avatar
  • 13.6k
-6 votes
1 answer
67 views

How to test if the input is a positive fraction?

I would like to check if a fraction is positive. The difficulty arises when there are symbols. I would like to make the assumption that all symbols, variables, and indeterminates are positive real ...
Peter Burbery's user avatar
-2 votes
1 answer
52 views

How can I list the heads of an expression?

How can I check that a fraction contains only multiplication and power? I would like to check if it contains only the heads of Power and Times. I am wondering how to get a list of heads for a fraction....
Peter Burbery's user avatar
4 votes
1 answer
98 views

Condition inside pure function

Why condition /; not work inside pure function? Suppose we have: ...
lesobrod's user avatar
  • 1,197
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 ...
Jonah's user avatar
  • 121
5 votes
0 answers
85 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 ...
Syed's user avatar
  • 41.8k
2 votes
1 answer
120 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. ...
Jineon Baek's user avatar
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 ...
Chris 's user avatar
  • 447
2 votes
0 answers
78 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?
Edward Huff's user avatar
1 vote
1 answer
110 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: <...
feynman's user avatar
  • 229
1 vote
1 answer
101 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 ...
Adam's user avatar
  • 3,897
5 votes
2 answers
228 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 ...
lesobrod's user avatar
  • 1,197
5 votes
3 answers
285 views

Delete first case

How to delete just first occurrence of given value from a list? Without sorting etc. Something like this: ...
lesobrod's user avatar
  • 1,197
5 votes
1 answer
59 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 ...
oyy's user avatar
  • 187
0 votes
1 answer
63 views

Using Unevaluated to get a list of symbol names

The official documentation of Unevaluated contains the following example: ...
Shredderroy's user avatar
  • 5,117
4 votes
2 answers
161 views

Slots inside nested pure functions

I'd like /@ instead of Table or Map. But let we have it inside pure function: ...
lesobrod's user avatar
  • 1,197
1 vote
1 answer
50 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: ...
lesobrod's user avatar
  • 1,197
2 votes
2 answers
220 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 ...
Wynne's user avatar
  • 1,516
3 votes
1 answer
89 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 ...
Nasser's user avatar
  • 137k
1 vote
1 answer
55 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, ...
bhopshang's user avatar
  • 739
3 votes
1 answer
157 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 ...
ghogoh's user avatar
  • 313
7 votes
2 answers
374 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 ...
cybervigilante's user avatar
1 vote
0 answers
46 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 ...
Revious's user avatar
  • 540
5 votes
1 answer
92 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 ...
bhopshang's user avatar
  • 739
0 votes
0 answers
126 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 ...
Michel's user avatar
  • 1,596
19 votes
1 answer
758 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 ...
Nasser's user avatar
  • 137k
4 votes
2 answers
212 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 ...
Alan's user avatar
  • 13.6k
4 votes
0 answers
72 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 ...
Lambda's user avatar
  • 41
3 votes
1 answer
184 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 ...
Murta's user avatar
  • 26.1k
11 votes
2 answers
467 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 ...
matheorem's user avatar
  • 17k
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. ...
Syed's user avatar
  • 41.8k
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 <...
miggle's user avatar
  • 647
1 vote
1 answer
49 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 ...
JEM_Mosig's user avatar
  • 2,953
6 votes
1 answer
350 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, ...
Kai's user avatar
  • 2,079
3 votes
0 answers
73 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... ...
MikeY's user avatar
  • 7,113
4 votes
1 answer
217 views

Differences between minimization functions?

There's more than 20 functions having to do with minimization ...
Adam's user avatar
  • 3,897
2 votes
3 answers
222 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 ...
janhardo's user avatar
  • 659
0 votes
0 answers
102 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 ...
AlekBiklon's user avatar
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 ...
user2757771's user avatar
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: ...
Revious's user avatar
  • 540
4 votes
1 answer
129 views

Creating a Graph of related entities with the data from Wikidata

I've a list of Entities from Wikidata ...
Revious's user avatar
  • 540
5 votes
1 answer
159 views

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

Consider: listOfKeys = {"Ambientalismo", "Anoressia"}; list2 = First /@ (WikidataSearch /@ listOfKeys) I've tried ...
Revious's user avatar
  • 540
0 votes
1 answer
490 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?
Errdonald's user avatar
0 votes
1 answer
54 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 ...
Daniel Bonilla Jaramillo Haase's user avatar
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 ...
Wisdom's user avatar
  • 1,258

1
2 3 4 5
12