# 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.

995 questions
Filter by
Sorted by
Tagged with
85 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 ...
51 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 ...
160 views
+500

### 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 ...
100 views

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

Consider the following table: ...
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 ...
66 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 ...
100 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 ...
86 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 ...
132 views

### How to transform the data in the following way?

Consider the following data: ...
1 vote
79 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 ...
156 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 ...
215 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 ...
349 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 ...
108 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. ...
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: ...
270 views

### How to leave only specific columns?

Consider the following table: ...
27 views

### Problem with repeated cells evaluation using tags

Consider the following code: ...
1 vote
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 ...
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 ...
46 views

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. ...
104 views

### Why axes arrows are not present? [closed]

Consider some test data ...
469 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 ...
51 views

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

Consider the following table: ...
1 vote
98 views

### How to extract the following data from the file?

Consider the following file. It has the form ...
44 views

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

Consider the following symbolic definitions: ...
119 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 ...
1 vote
126 views

### How to define the following "derivative"?

Consider the following test expression: ...
115 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, ...
123 views

### How to extract specific terms from the polynomial?

Consider the following polynomial: ...
861 views

### How can I draw this image and if you can make it rotate horizontally and vertically?

I've been looking at the site, but it doesn't occur to me there was a method to obtain the coordinates of the image, but I can't find it. Could you give me a hand? It's for a poster of the ...
193 views

### How to tell Mathematica to leave only terms not higher than X power?

Consider the following expression: expr = a[x]*da[x,t]*db[x,t]c[x] + db[x,z]^2*a[x]^2*d[x] +d[x]^2*da[x,t]db[x,t]+ dc[x,z]^2 + c[x]*dc[x,z]^2*db[x,t]^6 Is there ...
190 views

### How to simplify the following expression?

Consider the following expression: expr[s1_, s2_, m_] = Sqrt[s1 (s1 - 4*m^2)] + c Sqrt[s1^3 (s1 - 4*m^2)] + d Sqrt[s1^4 s2^2 (s1 - 4*m^2) (s2 - 4*m^2)] Here, <...
131 views

### How to assign the following rule?

Consider the following object: function[x,a,b]. It is a symbol carrying one "coordinate" x and two indices a,b. I ...
381 views

### Why the replacement rule works okay for scalars but not okay for matrices?

Consider the following UpSetDelayed: D[Kstar0[x_, a_], x[b_]] ^:= dKstar0[x, a, b] It works fine if applied to a scalar ...
48 views

### How to simplify the following expression of a matrix with complex conjugation?

Consider the following matrix: ...
40 views

### How to make a rule for the complex conjugation of a symbol?

Consider some symbols piplus, piminus, eta. Let us assume that they appear as conjugated, e....
1 vote
112 views

### How to make a histogram-like plot?

Consider the following data: ...
1 vote
85 views

### Assigning domain and/or value restrictions to multiple variables at once

Suppose I want to assign value and/or domain restrictions to a set of variables. As an example, let expr be some function of a, b, c, d, and e. Instead of writing, ...
1 vote
55 views

### How to distinguish these strings when extracting parameters?

Consider the following list: ...
149 views

### Why is the code with multiple Do slower than the one without them, and why is For faster than Do?

For some table tab having N rows and n columns, I need to go over all its rows $j$ and ...
29 views

### Omit multiple calculations of the same thing inside a compiled code?

Toy problem This question arises from the more complicated question involving it as a part. Assume a 2D table tab. We need to iterate over its rows ...
273 views

### Why are the results of these codes different?

I apologize for the very long question with a relatively complicated code. I am dealing with a real problem, and the question below appeared from my attempt to simplify this problem to ask about it ...
120 views

### Eliminate artifacts in a region region defined by RegionDifference

Consider the following region: ...
179 views

### How to get rid of the boundary at the regions merging in the plot?

Consider the following region: ...
175 views

### RegionDifference imperfection

Consider the following two regions: ...
1 vote
47 views

### How to make the following region?

Consider the following region shown in green: It is a part of the annular cylinder with the inner radius $R$ and the outer radius $R+r$, which is cut off from the left and right. Is it possible to ...
21 views

### How to get back from CForm to ScientificForm? [duplicate]

Consider a number number = 2.*10^20 It is in the representation of ScientificForm. I convert it to C-form: ...
1 vote
45 views

### How to adjust PlotRange automatically depending on the value of the function?

Consider the following test function: func[x_] = x^3 Exp[-x^2]; In general, it may be an arbitrary function without e.g. extrema. I want to plot it: ...