Skip to main content

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
3 votes
0 answers
135 views

I want to have multiple timings inside a compiled code. However, it turns our that AbsoluteTime[] does not work: ...
John Taylor's user avatar
  • 6,063
12 votes
4 answers
559 views

We can define anonymous functions like this: #^2+#+1 & or like this x |-> x^2+x+1 When we want to define a recursive ...
jjagmath's user avatar
  • 533
0 votes
1 answer
77 views

I mainly use the {x,xmin,xmax} form in plotting functions, and I probably assume, if forced to think about it, that it's a hard restriction. Someone recently asked ...
Tom Barson's user avatar
0 votes
0 answers
95 views

I was wondering if you could help me with an error message. The message is: [<<19>>,{<<1>>},{a53,-Infinity,Infinity}]is incomplete; more input is needed. The expression ...
Corselet's user avatar
3 votes
2 answers
245 views

I seek help coding an algorithm that shows when $e^{1/e}$ is repeatedly raised to itself it will eventually converge to $e$. The context for this post comes from this same question on M.SE: What ...
user1540346's user avatar
2 votes
0 answers
122 views

I have a set of pairs of numbers {id, quantity}, which I store in the table tab; id takes discrete values, and ...
John Taylor's user avatar
  • 6,063
2 votes
3 answers
371 views

When I import a DOT file (or a string in that format) with labels containing the exact characters \\l or \\r, they are displayed ...
Mark S.'s user avatar
  • 1,143
0 votes
0 answers
110 views

Consider the following simple routines: ...
John Taylor's user avatar
  • 6,063
0 votes
0 answers
168 views

I have a large table for which I need to do the following: Split it into many smaller tables. For each smaller table, iteratively perform some action. Within each iteration, I have either to (a) ...
John Taylor's user avatar
  • 6,063
2 votes
2 answers
174 views

I have a 2D table tab, each row is {type, weight}. I want to iteratively sample a few rows with probability proportional to <...
John Taylor's user avatar
  • 6,063
2 votes
1 answer
137 views

I defined a function of two variables H[x, t] in my code, and then attempted to define a second function G[x, t] through the ...
Bruno Souza Leão Torres's user avatar
1 vote
0 answers
86 views

Consider the following expression: ...
John Taylor's user avatar
  • 6,063
0 votes
0 answers
46 views

Consider this code defining the "fields" field and their "derivatives" dfield for some list ...
John Taylor's user avatar
  • 6,063
2 votes
2 answers
335 views

Consider the following expression: expr = -((I G8 d\[Eta]pr[x, \[Mu]]^2 K0[x] f\[Pi])/Sqrt[2]) + ( I G8 d\[Pi]0[x, \[Mu]]^2 K0[x] f\[Pi])/Sqrt[2] I want to ...
John Taylor's user avatar
  • 6,063
0 votes
0 answers
134 views

In this code ...
Superunknown's user avatar
2 votes
2 answers
312 views

I have a question regarding the syntax of the /@ command. I start with some list, say testlist = {{a, b}, {c, d}, {e, f}}. I also have a function ...
Vosoni's user avatar
  • 347
2 votes
1 answer
123 views

In Mathematica, if using ->, it gets automatically replaced with a nicely looking arrow. However, if using "->", ...
John Taylor's user avatar
  • 6,063
1 vote
0 answers
181 views

Consider the following test code: ...
John Taylor's user avatar
  • 6,063
5 votes
1 answer
144 views

Consider the two commands: RandomInteger[3, 10^7]; // RepeatedTiming RandomInteger[{1, 3}, 10^7]; // RepeatedTiming The first executes by a factor of 3 faster than ...
John Taylor's user avatar
  • 6,063
2 votes
1 answer
139 views

I use Module a lot to localize symbols. Occasionally I will forget a semicolon on one of the lines in the middle, and don't notice until I get flooded with Tag ...
Tapiocaweasel's user avatar
0 votes
2 answers
112 views

Consider the following curves: ...
John Taylor's user avatar
  • 6,063
1 vote
0 answers
44 views

I am launching a notebook from another notebook: NotebookEvaluate[ FileNameJoin[{NotebookDirectory[], "path-to-notebook"}]]]; The latter contains ...
John Taylor's user avatar
  • 6,063
3 votes
1 answer
154 views

There are situations that the caret cursor symbol ^ remains in the code like if the code is not finished and something has to be added in its position yet the code ...
azerbajdzan's user avatar
  • 33.5k
0 votes
0 answers
63 views

Consider the following plot: ...
John Taylor's user avatar
  • 6,063
1 vote
1 answer
82 views

...
KZ-Spectra's user avatar
1 vote
1 answer
68 views

I recently discovered the "Resource Definition Notebook" which helps considerably with the development of paclets. It enables you to check the coding of the various files associated and also ...
NigelKg's user avatar
  • 141
1 vote
0 answers
166 views

I am trying to use a designed function to find the quasi-normal modes. ...
Robert Xu's user avatar
  • 111
0 votes
0 answers
74 views

Consider the following three codes: ...
John Taylor's user avatar
  • 6,063
4 votes
5 answers
732 views

I have some monster expressions, but for simplicity, consider m = -(-3 + a+3 b-5 c)/(-d -5); How can I check if "undisplayable" expressions contain ...
florin's user avatar
  • 2,432
4 votes
1 answer
182 views

Consider the following data and corresponding ListDensityPlot: ...
John Taylor's user avatar
  • 6,063
2 votes
3 answers
406 views

Consider this code: ...
John Taylor's user avatar
  • 6,063
1 vote
2 answers
123 views

Consider the following region: ...
John Taylor's user avatar
  • 6,063
6 votes
3 answers
324 views

Suppose I have two functions $f,g:\mathbb{R}^2 \to \mathbb{R}^2$ and that I want to compute $g(f(x,y))$. As an example, let's take $f(x,y)=(x+y, x-y)$ and $g(x,y)=(y^2,x^2)$. Then, $g(f(1,2))=(1,9)$. ...
user2978125's user avatar
1 vote
1 answer
124 views

Consider the system ...
John Taylor's user avatar
  • 6,063
1 vote
2 answers
155 views

Consider the following list: ...
John Taylor's user avatar
  • 6,063
3 votes
1 answer
187 views

I have a list of expressions which I would like to integrate by nested integration. For any element from the list it works without issues (see end of the post), however, when I apply nested ...
seva011's user avatar
  • 386
0 votes
0 answers
96 views

I have a function $F(z_h)$ given by, $$F(z_h) = \int^{\infty}_{z_h} s(y) T'(y) dy$$ where $T \equiv T(z_h), T' \equiv T'(z_h), s \equiv s(z_h)$, which means they're all functions of $z_h$. Their ...
mathemania's user avatar
2 votes
1 answer
165 views

I have the following routine where I build a pair of function name lists {Flist, Klist} and 1D argument list {a1,a2,a3,a4,a5}: <...
seva011's user avatar
  • 386
1 vote
1 answer
183 views

I got confused working with list of functions of two variables. I construct few lists of functions, one is vector of functions List1 and another is 2D list of ...
seva011's user avatar
  • 386
2 votes
1 answer
176 views

What is the problem with the following syntax: (5^^ # &) /@ {2, 3} The following error message is produced: ...
Aharon Naiman's user avatar
5 votes
2 answers
332 views

I am doing a nested integration. So far the result was successfully saved with Save["filename.wl", IntOutput] and looked as following: ...
seva011's user avatar
  • 386
1 vote
1 answer
125 views

I made some code that I compiled. The snippet looks as follows: ...
John Taylor's user avatar
  • 6,063
0 votes
1 answer
97 views

Can someone give examples on how to build 2D Lists of function and expressions by the given vectors? I have the following: V1={a,b,c}; V2={1,2,3}; V3={x1,x2,x3}; ...
seva011's user avatar
  • 386
0 votes
1 answer
99 views

I am facing the following issue; I have the solution of a ParametricNDSolveValue and would like to plot several solutions with varying parameter in the same Manipulate to see qualitative differences. ...
IronicOwl's user avatar
  • 115
2 votes
1 answer
192 views

This question is a continuation of the following one. Let us assume a Fermi-Dirac (FD) distribution (times $p^{2}$): ...
John Taylor's user avatar
  • 6,063
1 vote
0 answers
79 views

Consider the following test compiled code: ...
John Taylor's user avatar
  • 6,063
0 votes
0 answers
33 views

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
229 views

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

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
  • 156k
0 votes
1 answer
166 views

Consider the following combinations of integers comb, where the integers range from 1 to n ...
John Taylor's user avatar
  • 6,063

1
2 3 4 5
21