Questions tagged [syntax]

Questions on the correct (or improved) formulation of Mathematica code to achieve particular results. Use this tag (not "symbol") for questions about all those odd @@ /@ # & and _ characters, which are keyboard shortcuts for the Wolfram Language named functions Apply, Map, Slot, Function, and Blank.

Filter by
Sorted by
Tagged with
0 votes
0 answers
16 views

Question about rule syntax/format for CellularAutomaton function

I am trying to understand how to use CellularAutomaton function. For example, I am interested in the Game life and I found a working example here. However I cannot understand or find a detailed ...
Zlelik's user avatar
  • 531
4 votes
2 answers
132 views

How to speed up the following algorithm?

I have some random combinations of numbers pairs (where numbers range from 1 to some ntest) ...
John Taylor's user avatar
  • 5,513
6 votes
2 answers
148 views

Is there a system option to make Mathematica generate syntax error when reading code from file which has red syntax warning in frontend?

I type some equations from text books into database, which later read from Mathematica to solve. Since I do this manually, sometimes I make mistakes where I type ...
Nasser's user avatar
  • 143k
0 votes
1 answer
74 views

How to select non-repeating pair of numbers?

Consider the following combinations of integers comb, where the integers range from 1 to n ...
John Taylor's user avatar
  • 5,513
0 votes
0 answers
26 views

Enforcing multiple domains in Reduce function [closed]

I would like to have two different restriction for the domains of my variables. In particular, in the following code, I'd like to have q to be a natural positive number. Is there a way to do that? <...
asdf's user avatar
  • 184
4 votes
2 answers
205 views

Trying to Solve system of equations gives empty result

First-time user of Mathematica. I have three equations, and I'm trying to solve for one of the variables. I'm hoping this is just a syntax problem. ...
DansAltamira's user avatar
0 votes
0 answers
41 views

Invalid variables error in SolveValues when using an array of variables

I was attempting to run some code similar to the simple example below. ...
VertexVexed's user avatar
1 vote
1 answer
104 views

Fastest splitter?

Consider some dataset ...
John Taylor's user avatar
  • 5,513
2 votes
2 answers
95 views

Analog of monitor which does not lead to freezes of the interface

I have some heavy computation wrapped by Monitor and ProgressIndicator. It is the template: ...
John Taylor's user avatar
  • 5,513
3 votes
2 answers
130 views

Different behavior of Clear in different versions of Mathematica

Consider the following code: list1 = {1, 2, 3}; m = 17; {list1, m} // Clear In Mathematica 13.2, this syntax with Clear works ...
John Taylor's user avatar
  • 5,513
1 vote
1 answer
62 views

Problem with RegionNearest?

Consider the following region: ...
John Taylor's user avatar
  • 5,513
0 votes
0 answers
65 views

Any way to eliminate evaluating cells except for "Abort evaluation"?

I have a notebook with many cells, one of which contains an evaluation of some condition. If it is False, I want to have an automatized way of the "Abort ...
John Taylor's user avatar
  • 5,513
3 votes
0 answers
72 views

Keeping track of braces and brackets { } [ ]

It doesn't take much to end up with lots of braces, i.e, { or }, and brackets, i.e., [ or ], in even a single line of MM code, and it's very easy to lose track of how many there are and where they ...
Chris O's user avatar
  • 91
7 votes
1 answer
371 views

What is the diffrence between these three commands?

Consider F=1/((x-a)(x-b)) ; G= 1/((x-α)*(x-β)); H=1/((x-r[1])(x-r[2])) ; Using Apart[], the partial fraction decomposition ...
Claude Leibovici's user avatar
2 votes
0 answers
75 views

Optimizing prallel computing for nested integration

I need an advice for optimization of computing with ParallelMap, as well as general hints to speed up computing discussed below. I have several questions about this ...
seva011's user avatar
  • 69
0 votes
1 answer
154 views

Partial differential equation with conditions

I am trying to solve this PDE with Mathematica, and I have checked the syntax a lot, but still don't get a solution ...
TTT's user avatar
  • 57
1 vote
1 answer
66 views

Syntax::sntxf when using ItoProcess

The following code gives an error message Syntax::sntxf. What is wrong with my code, and how can I fix it? ...
Deepika Gaur's user avatar
3 votes
1 answer
88 views

Multiple dropdown dialogs in the same window?

Consider a few dropdown dialogs: ...
John Taylor's user avatar
  • 5,513
3 votes
0 answers
66 views

Making speed of MemberQ comparable with explicit If?

Consider the following two lists: listtest = {11, 13, 22, 221, 1, 3} // Sort // N; pdglisttest = RandomInteger[{-222, 222}, 10^6] // N; For the given element of <...
John Taylor's user avatar
  • 5,513
5 votes
3 answers
414 views

How to find the nearest element that is bigger than x?

Consider some list list=RandomReal[{0,1},10^6]; I would like to find the closest element to some value of x that is larger than it, and also extract its position. ...
John Taylor's user avatar
  • 5,513
3 votes
4 answers
214 views

Destructuring the left-hand-side of `Optional[s:v]`

It is useful to be able to provide default values in pattern-matching, for example, if an element has a key but no corresponding ...
Diffycue's user avatar
  • 1,834
0 votes
2 answers
98 views

How to build the following region?

Consider a 3D figure defined by the dependence $\Delta x(z),\Delta y(z)$. One example is a pyramidal frustum, for which $\Delta x, \Delta y$ are linear functions of $z$, and $z$ lies inside the ...
John Taylor's user avatar
  • 5,513
2 votes
1 answer
53 views

ReplaceAll that works inside Rational?

I'm trying to replace all instances of a 31632259 in a formula with x, but there's something special about how Mathematica ...
Yaroslav Bulatov's user avatar
3 votes
0 answers
220 views

How to solve the following integrodifferential equation by generic approach?

Consider the following equation: $$ \frac{\partial f}{\partial t} - p H(t)\frac{\partial f}{\partial p} = \mathcal{I}[p,t], \tag 1 $$ Here, f = f[p,t], with p being ...
John Taylor's user avatar
  • 5,513
2 votes
2 answers
111 views

How to "complete" the table by making all of its rows to have the same number of elements?

Consider the following table: ...
John Taylor's user avatar
  • 5,513
0 votes
1 answer
58 views

Syntax error trying to rewrite expression using rules

I want to use Mathematica to calculate derivatives of some long, complicated expressions. I have an integral with integrand $I_*$ which is a functional that depends on $h(x,t)$ and $\phi(x,t)$. The ...
Mjoseph's user avatar
  • 233
0 votes
1 answer
73 views

How to re-organize the table in the following way?

Consider the following table: tab=RandomReal[{0,1},{5,10}] How is it possible to convert it into the form of a 2-column table ...
John Taylor's user avatar
  • 5,513
0 votes
2 answers
106 views

How to combine the tables in the following way?

Consider two tables tab1 = RandomReal[{0, 1}, {5, 4}] tab2 = RandomReal[{0, 1}, {10, 4}] How to quickly make a table where the ith row of ...
John Taylor's user avatar
  • 5,513
2 votes
1 answer
105 views

How to code retarded time in Lienard-Wiechert potential equations?

I have been making strides on my project with the help of others here but have run into another snag: I am having difficulty in expressing the Lienard-Wiechert potentials with retarded time. For ...
JDRobin's user avatar
  • 55
2 votes
4 answers
133 views

How to transform the data in the following way?

Consider the following data: ...
John Taylor's user avatar
  • 5,513
1 vote
0 answers
80 views

How to emulate the curves and color of the video? [closed]

I found this animation on the internet, it is part of a joke, but I was intrigued by how the video can be emulated with the colors and the curve proposed in the video.The video talks about neural ...
Pamela's user avatar
  • 309
4 votes
4 answers
158 views

How to check if at least one ordering of the given row matches one of the rows of a table?

Consider some list of elements ...
John Taylor's user avatar
  • 5,513
2 votes
4 answers
216 views

How to check if the given row matches one of the rows of a table?

Consider some table tabb = RandomInteger[{0, 4}, {5, 4}] and a row row = RandomInteger[{0, 4}, 4] How to check if ...
John Taylor's user avatar
  • 5,513
8 votes
2 answers
368 views

Reverse the rotation of an animated gif and create a mirror image of it

I need Mathematica code to reverse the rotation direction and viewpoint of an animated GIF named "wheel." The current rotation is counterclockwise, and I need it to rotate clockwise while ...
Pamela's user avatar
  • 309
0 votes
2 answers
113 views

How to automatically convert sub- super-indices to strings?

Consider the following expression: expr = "\!\(\*SubscriptBox[\(m\), \(t\)]\)" I would like to convert it to the ordinary string e.g. ...
John Taylor's user avatar
  • 5,513
0 votes
2 answers
91 views

Clip, Select, FirstPosition not working for extracting values from an association based on a range from another list

I have this dataset of associations: ...
atomic-muclei's user avatar
4 votes
6 answers
276 views

How to leave only specific columns?

Consider the following table: ...
John Taylor's user avatar
  • 5,513
0 votes
0 answers
27 views

Problem with repeated cells evaluation using tags

Consider the following code: ...
John Taylor's user avatar
  • 5,513
1 vote
0 answers
28 views

Generator of limits of successions according to type of indeterminacy. Correct syntax

I am trying to make a limit generator with 3 columns, number of the exercise, the second column is the limit (perfectly written with n-->00), and the third column is the result of the limit. I have ...
wilma's user avatar
  • 11
0 votes
0 answers
41 views

How do we create a function for the recurrence relation in terms of a dependent variable?

Suppose S = {{-1.5, 1}, {0, 1}, {1.5, 1}, {1.5, 0.1}, {0, -0.1}, {-1.5, 0}, {1, -1.4}, {-1, -1.5}} How do we define the recurrence relation as a function of the ...
Arbuja's user avatar
  • 59
0 votes
0 answers
51 views

Way to download all attachments from yahoo.com

For a long time now I want to download the attachments from my yahoo.con mail, only the files, no text, but in batches, so MMA gets into my mail and downloads every attached file it finds in a folder. ...
zeros's user avatar
  • 2,263
2 votes
1 answer
108 views

Why axes arrows are not present? [closed]

Consider some test data ...
John Taylor's user avatar
  • 5,513
3 votes
5 answers
474 views

How to find the most repeating row?

Consider the following table: tab={{1,0,0,1},{1,0,0,1},{0,1,0,1},{1,0,0,1},{0,0,0,1},{1,0,0,0},{0,1,0,1}} Could you please tell me whether there is a command which ...
John Taylor's user avatar
  • 5,513
0 votes
0 answers
78 views

How to compile a code with a table having varying number of columns?

Consider the following table: ...
John Taylor's user avatar
  • 5,513
1 vote
2 answers
98 views

How to extract the following data from the file?

Consider the following file. It has the form ...
John Taylor's user avatar
  • 5,513
0 votes
1 answer
46 views

How to define the following rule for all objects in a compact way?

Consider the following symbolic definitions: ...
John Taylor's user avatar
  • 5,513
4 votes
1 answer
127 views

Put text in Graphics3D syntax?

Some friends from the forum helped me to make this MMA script, I have tried to modify it to put text similar to the image, perhaps with a more beautiful letter, but I can't think of how, I have seen ...
Pamela's user avatar
  • 309
1 vote
2 answers
128 views

How to define the following "derivative"?

Consider the following test expression: ...
John Taylor's user avatar
  • 5,513
3 votes
2 answers
119 views

How to make two sub-sets each with two distinct elements having a list with 4 elements?

Consider the following list: list = {{meson1, p1}, {meson2, p2}, {meson3, p3}, {meson4, p4}} I would like to organize it into two sub-sets, each with two elements, ...
John Taylor's user avatar
  • 5,513
2 votes
3 answers
145 views

How to extract specific terms from the polynomial?

Consider the following polynomial: ...
John Taylor's user avatar
  • 5,513

1
2 3 4 5
21