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
2 answers
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 ...
John Taylor's user avatar
  • 4,642
2 votes
1 answer
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 ...
Yaroslav Bulatov's user avatar
2 votes
0 answers
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 ...
John Taylor's user avatar
  • 4,642
2 votes
2 answers
100 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
  • 4,642
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
  • 221
0 votes
1 answer
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 ...
John Taylor's user avatar
  • 4,642
0 votes
2 answers
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 ...
John Taylor's user avatar
  • 4,642
2 votes
1 answer
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 ...
JDRobin's user avatar
  • 55
2 votes
4 answers
132 views

How to transform the data in the following way?

Consider the following data: ...
John Taylor's user avatar
  • 4,642
1 vote
0 answers
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 ...
Pamela's user avatar
  • 309
4 votes
4 answers
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 ...
John Taylor's user avatar
  • 4,642
2 votes
4 answers
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 ...
John Taylor's user avatar
  • 4,642
8 votes
2 answers
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 ...
Pamela's user avatar
  • 309
0 votes
2 answers
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. ...
John Taylor's user avatar
  • 4,642
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
270 views

How to leave only specific columns?

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

Problem with repeated cells evaluation using tags

Consider the following code: ...
John Taylor's user avatar
  • 4,642
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
  • 39
0 votes
0 answers
46 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,253
2 votes
1 answer
104 views

Why axes arrows are not present? [closed]

Consider some test data ...
John Taylor's user avatar
  • 4,642
3 votes
5 answers
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 ...
John Taylor's user avatar
  • 4,642
0 votes
0 answers
51 views

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

Consider the following table: ...
John Taylor's user avatar
  • 4,642
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
  • 4,642
0 votes
1 answer
44 views

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

Consider the following symbolic definitions: ...
John Taylor's user avatar
  • 4,642
4 votes
1 answer
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 ...
Pamela's user avatar
  • 309
1 vote
2 answers
126 views

How to define the following "derivative"?

Consider the following test expression: ...
John Taylor's user avatar
  • 4,642
3 votes
2 answers
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, ...
John Taylor's user avatar
  • 4,642
2 votes
3 answers
123 views

How to extract specific terms from the polynomial?

Consider the following polynomial: ...
John Taylor's user avatar
  • 4,642
6 votes
3 answers
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 ...
Pamela's user avatar
  • 309
4 votes
2 answers
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 ...
John Taylor's user avatar
  • 4,642
-1 votes
1 answer
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, <...
John Taylor's user avatar
  • 4,642
3 votes
1 answer
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 ...
John Taylor's user avatar
  • 4,642
3 votes
2 answers
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 ...
John Taylor's user avatar
  • 4,642
2 votes
1 answer
48 views

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

Consider the following matrix: ...
John Taylor's user avatar
  • 4,642
0 votes
1 answer
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....
John Taylor's user avatar
  • 4,642
1 vote
0 answers
112 views

How to make a histogram-like plot?

Consider the following data: ...
John Taylor's user avatar
  • 4,642
1 vote
2 answers
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, ...
theorist's user avatar
  • 3,603
1 vote
2 answers
55 views

How to distinguish these strings when extracting parameters?

Consider the following list: ...
John Taylor's user avatar
  • 4,642
3 votes
1 answer
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 ...
John Taylor's user avatar
  • 4,642
0 votes
0 answers
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 ...
John Taylor's user avatar
  • 4,642
0 votes
1 answer
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 ...
John Taylor's user avatar
  • 4,642
2 votes
2 answers
120 views

Eliminate artifacts in a region region defined by `RegionDifference`

Consider the following region: ...
John Taylor's user avatar
  • 4,642
2 votes
1 answer
179 views

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

Consider the following region: ...
John Taylor's user avatar
  • 4,642
5 votes
2 answers
175 views

RegionDifference imperfection

Consider the following two regions: ...
John Taylor's user avatar
  • 4,642
1 vote
1 answer
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 ...
John Taylor's user avatar
  • 4,642
0 votes
0 answers
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: ...
John Taylor's user avatar
  • 4,642
1 vote
1 answer
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: ...
John Taylor's user avatar
  • 4,642
2 votes
0 answers
63 views

How to find the farthest distance from the point to the region?

Consider the following 2D regions: ...
John Taylor's user avatar
  • 4,642
2 votes
1 answer
38 views

How to enter the following number to InputDialog form?

Consider some input field: ...
John Taylor's user avatar
  • 4,642

1
2 3 4 5
20