Questions on correct (or improved) formulation of Mathematica code to achieve particular results. Use this tag (not "symbol") for questions about all those odd @@ /@ # & and ~ characters.

learn more… | top users | synonyms

1
vote
1answer
78 views

Double arguments and place of the underscore

Could someone explain me of this bit of code below is correct: Is it possible to define a function with a second bracket, see below, i.e. f[x_][y_]? And what does ...
0
votes
1answer
63 views

what do those signs #1, #1^2, #1^3, & mean here? [duplicate]

I have read common pitfalls page and the documentation page but I still don't understand what do those signs mean here? ...
2
votes
1answer
45 views

Why do Wolfram Alpha and Mathematica give different answers? [closed]

I've just got my hands on Wolfram Mathematica and tried to see if I can figure out how to use it by myself. I've plugged in an integral $\int \frac{dx}{(1-x^2)^{2/3}}$, knowing that the result is ...
0
votes
2answers
75 views

Referencing elements of ArrayRules

How do I call elements of ArrayRules by their indices rather than by Part[ArrayRules[list],i]? I'd like to call the element that ...
3
votes
1answer
40 views

Aliases for keys?

The syntactic sugar for alternatives in replacement rules is clean: {a|b|c-> 1, d->2} Are there any analogous shorthands for keys in associations. I want ...
0
votes
1answer
55 views

What does the syntax <<X>> mean? [duplicate]

What does the syntax; << X >> mean? Where X is a number? Cheers
3
votes
0answers
81 views
2
votes
4answers
117 views

How to obtain the gradient of a function as a function?

The Grad function allows me to get the gradient of a function like this: ...
7
votes
3answers
124 views

Morse Code Spacing

Trying to make a function to convert text into morse code and play the sound. Have it pretty much completed, but I cannot get mathematica to emit no sound so I can have a pause between the dots and ...
0
votes
0answers
25 views

I would like know why “&” came after “FrontEndToken[”New"] here [duplicate]

I am a newbie to this Mathematica world who lives in South Korea, which is not a desirable place to have people to discuss Mathematica. So I came here, even though this question may look very simple ...
3
votes
0answers
36 views

Java anonymous functions from JLink?

JLink is really great to act on Java objects and access Java static methods. I'm asking myself if there would be a way to have access to a more recent Java syntax that allows anonymous functions, ...
5
votes
5answers
204 views

Nested function with an increasing argument

If, for example, I have a nesting function like Nest[1 + x^n (#) &, 1, 3] it gives the result ...
0
votes
1answer
50 views

Compile decreases the number of returned list elements

I have: LogisticMap = Compile[{μ}, ({μ, #} &) /@ Union[Drop[NestList[μ # (1 - #) &, .2, 300], 100]]]; Then: ...
3
votes
1answer
100 views

Binary decision diagrams (BDD) syntax error

I am new here (and to Mathematica) and would like to rebuild a simple binary decision diagram that I found here https://en.wikipedia.org/wiki/Binary_decision_diagram A code has been provided as part ...
7
votes
3answers
77 views

TagSetDelayed on a function with a delayed value

I'm trying to automatically optimize cases when the user evaluates Length[returnsList[x_]] to instead use returnsLength: ...
4
votes
1answer
165 views

Why assign variables to empty curly brackets?

I am trying to read code and I see empty curly brackets. For example: abc = {} or ...
6
votes
2answers
135 views

Ignore some values at return

Is there Mathematica analogue of Python _ (underscore) or Matlab ~, a special variable, that can be used when a function returns ...
6
votes
3answers
301 views

How can I create currying functions using pure function syntax?

For example how can I write In: pureFunctionSyntax[myF] /@ {7, 3} Out: {myF[7, Log[7]], myF[3, Log[3]]}
6
votes
2answers
463 views

What does (0 &) mean in an evaluation? [closed]

My Mathematica code is this: Simplify[D[Sqrt[1 + (u')^2 + (-60 x - 20 u u')^2], u]] It returns this: ...
5
votes
3answers
601 views

Can symbols like + or * be used to denote the Plus and Times functions?

Can one do something similar to +[1, 2]? The point is that with one symbol you would be able to write expressions like ...
0
votes
2answers
64 views

Function input syntax [closed]

My functions are ...
1
vote
0answers
57 views

Meaning of Abs´? [closed]

A friend showed me the code below. r[i_] := {x[i, t], y[i, t], z[i, t]}; rji = r[i] - r[j]; solap = 2 a - Norm[rji]; FullSimplify[D[solap, t]] I'm unsure about ...
1
vote
1answer
32 views

Scan appears to work setting graph properties, but get error on property-read

This is a self-contained version of something a bit bigger - going for brevity. It is a bit synthetic, but there are applications I have in mind where the {{1,2}} will be replaced with real data, more ...
1
vote
2answers
66 views

Intersection of all sublists of a list [duplicate]

I want to get the intersection of all sublists of list in an easy way. ...
11
votes
1answer
144 views

The equivalent of dplyr mutate with Dataset

In R, there is a package "dplyr" that works on data.frame objects, which is one of the origins of the Mathematica Dataset construct. One of the things dplyr can do is "mutate" the columns of a ...
1
vote
1answer
78 views

Can I map a function over a sequence of arguments without making the arguments into a list first?

I would like to set evenFunction[f_][a_, b_, c_, ...] = f[Abs[a], Abs[b], Abs[c], ...] I have come up with two ways to do this so far. Use pure functions ...
5
votes
2answers
280 views

f /@ # & /@ # & /@ # & /@ # & /@ # & /@ # & /@ # & /@ matrix

How can one write f /@ # & /@ # & /@ # & /@ # & /@ # & /@ # & /@ # & /@ matrix in one line with arbitrary level and without using ...
0
votes
0answers
40 views

Solving Integral -syntax or interpretation problems

WA interpreter achievement not well this entry from Mathematica, steps need to see the full resolution input WA ...
0
votes
1answer
110 views

Convert code from C++ to Mathematica [closed]

I need to know how to convert the following code in C++ to Mathematica. ...
1
vote
4answers
102 views

Build a truncated tower with numbers from 1 to 9 without repeating

consider the image subject to the following conditions appearing in my code, I find not the appropriate numbers ...
4
votes
2answers
111 views

Sorting and keeping the main format of list numbers [duplicate]

I have a list with these elements: list={1/2 (1 + Sqrt[5]), 1, 1, 1/2 (1 - Sqrt[5]), 0}; I want to sort them with ...
4
votes
0answers
79 views

Why does FromDigits transpose its argument (sometimes)?

FromDigits /@ Transpose@{{1, 2}, {3, 4}, {5, 6}} == FromDigits @ {{1, 2}, {3, 4}, {5, 6}} (* True *) The only "strange" syntax I've found in the docs is ...
0
votes
1answer
35 views

Possibly syntax errors? [duplicate]

trying to graph, however graph is blank when i enter it. Please help! ...
0
votes
1answer
157 views

Syntax::sntxf: “…” cannot be followed by “…\MatrixForm” [closed]

I'm trying to create a $3\times 1$ matrix named Pauli but I really don't understand what's the problem of the following code? ...
0
votes
1answer
52 views

How to store value of result in an array for a calculation inside the loop [closed]

Note: In my code I used j (ranging from 3 to 7) but I want j to be general I tried this ...
4
votes
0answers
78 views

“\:”; flagged as syntax error

While answering question 94032, I noticed that Mathematica 10.2 flagged "\:" <> IntegerString[62378, 16, 4] with a red bracket, apparently indicating a ...
8
votes
1answer
165 views

Invalid Symbol Characters

What unicode characters are invalid as a Symbol name? Ideally I'm looking for a complete list. Here is the current list ...
0
votes
1answer
41 views

Evaluation of a Laplace transform for e^-at does not give expected results [closed]

LaplaceTransform[E^-at, t, s] That is my input, and the output I am expecting is 1/(a + s), but I am getting ...
4
votes
0answers
98 views

Multiple Constrained Sum

I need to perform a multiple summation, that obeys some conditions. This arises in the study of a statistical physics model. q=Exp[-β]. I would like to ask if ...
6
votes
1answer
128 views

Why is Reap result nested?

A minimal (toy) example for my question: i= 1; Reap[Do[Sow[i = (i + 1)^2], {4}]] (* {Null, {{4, 25, 676, 458329}}} *) I presume the entire result is a ...
7
votes
1answer
141 views

What kind of creature is h[c] for definition h[c_][x_] := (* function of x and c *)

To implement "Hero's Method" for approximating $\sqrt{c}$, one iterates the function (x + c/x)/2 for a given number c (e.g., ...
1
vote
1answer
63 views

Display a triangle that rotates at certain rate when space bar is held down?

This question is a follow up on: Open a pop up window that runs a calculation in loop until it is closed? How can I open a pop up to show a picture of a triangle that rotates by ...
3
votes
1answer
66 views

Open a pop up window that runs a calculation in loop until it is closed?

How should I construct a code which opens a pop up window, displays a constantly updating image in it and is terminated once the pop up is closed? The constant updating would be an infinite loop of ...
0
votes
1answer
125 views
2
votes
1answer
43 views

How to use MakeExpression in terminal?

This is in continuation to the question in Infix form of PutAppend ( >>> ) does not work with variable. I was trying to use ...
1
vote
1answer
109 views

Summation over list elements

As we know, one of the simplest way to do a summation (with special intervals) over list elements is using Sum[list[[i]], {i, 3, 8, 2 }] (*with steps of 2*) for ...
12
votes
1answer
602 views

When to use @@@ vs. /@ [duplicate]

So much thanks to Szabolcs in improving sequence.. for complete explanation. I am so glad to read all explanation which fundamentally remove the problem. But in number 4 of its explanation pointed to ...
13
votes
1answer
244 views

ToExpression processing errors

Is their a way to get a more comprehensive return value when running ToExpression? For example when I run ...
5
votes
3answers
245 views

How to imitate list comprehensions for constant arrays?

In Python, ['a'] * 10 generates ['a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a'] and ...
4
votes
2answers
95 views

How to define UpValues of NBSpline when the length of argument is unknown?

I mimic the built-in BSplineBasis[] to build a user-defined function NBSpline[], Namely, ...