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.
1,047 questions
3
votes
0
answers
135
views
Timing inside a compiled function?
I want to have multiple timings inside a compiled code. However, it turns our that AbsoluteTime[] does not work:
...
12
votes
4
answers
547
views
Recursive anonymous functions with |-> notation
We can define anonymous functions like this:
#^2+#+1 &
or like this
x |-> x^2+x+1
When we want to define a recursive ...
0
votes
1
answer
77
views
What is the sense of the {x, xmin, xmax) form when used with NMaximize?
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 ...
0
votes
0
answers
94
views
Understanding an error message
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 ...
3
votes
2
answers
244
views
How to code a recursive algorithm to exponentiate $e^{1/e}$ to itself indefinitely and hence show that this sequence converges to $e$?
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 ...
2
votes
0
answers
120
views
Most efficient way to store set of numbers and manipulate them
I have a set of pairs of numbers {id, quantity}, which I store in the table tab; id takes discrete values, and ...
2
votes
3
answers
370
views
Why does importing a .dot graph file cause \l and \r to become \n?
When I import a DOT file (or a string in that format) with labels containing the exact characters \\l or \\r, they are displayed ...
0
votes
0
answers
108
views
Alternative to RandomSample?
Consider the following simple routines:
...
0
votes
0
answers
167
views
The most efficient way of working with updating tables: particular routine
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) ...
2
votes
2
answers
174
views
Returning row's index and row itself after making weighted selection
I have a 2D table tab, each row is {type, weight}. I want to iteratively sample a few rows with probability proportional to <...
2
votes
1
answer
137
views
Cannot evaluate functions defined by derivatives of other functions
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 ...
1
vote
0
answers
86
views
Smart simplification of an analytic expression
Consider the following expression:
...
0
votes
0
answers
46
views
How to define custom derivative rules for multiple symbolic fields in a loop without copy‐pasting?
Consider this code defining the "fields" field and their "derivatives" dfield for some list ...
2
votes
2
answers
334
views
Replacing complex numbers in expressions [duplicate]
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 ...
0
votes
0
answers
134
views
Syntax error "Has no closing"
In this code
...