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

7
votes
3answers
155 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
2answers
114 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 ...
4
votes
1answer
44 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 ...
4
votes
1answer
110 views

Products of Differential Operators

I have a differential equation defined as the product of operators which I want to expand out into a polynomial in powers of $z\frac{d}{dz}$ $\qquad \prod_{n=1}^p(z\frac{d}{dz}+a_n)$ However when I ...
55
votes
1answer
1k views

Incompatible Changes since Mathematica Version 7?

There is documentation of the incompatible changes made to Mathematica with each major release: Incompatible Changes since Mathematica Version 1 Unfortunately that documentation simply stopped ...
0
votes
1answer
63 views

Fastest way to make division between a number and elements in a list [duplicate]

I have a list y={{a,b},{c,d},...} of dimension {10^5, 2}, and number x. I want to divide only the second part of each element of the list by x, and have as result a new list {{a,b/x},{c,d/x},...}. ...
0
votes
1answer
66 views

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

What does the syntax; << X >> mean? Where X is a number? Cheers
57
votes
6answers
2k views

V10's Operator Forms - what are they good for?

V10 introduces an operator form for several functions perhaps primarily due to their role in queries as part of introducing data science functionality. At first pass it seems a lot of effort to add ...
2
votes
4answers
132 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: ...
0
votes
1answer
51 views

Compile decreases the number of returned list elements

I have: LogisticMap = Compile[{μ}, ({μ, #} &) /@ Union[Drop[NestList[μ # (1 - #) &, .2, 300], 100]]]; Then: ...
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 ...
0
votes
0answers
53 views

What makes items with head `Function` different?

I apologize beforehand for the muddleheadedness of this question. It reflects the fact that I'm trying to interpret outward "behaviors" of Mathematica expressions without having any understanding of ...
3
votes
1answer
103 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 ...
5
votes
5answers
214 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 ...
3
votes
0answers
37 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, ...
3
votes
0answers
113 views

Assign variables from list inside With or Module

I have found that it is possible to assign variables from lists, as follows. r = {1, 2, 3}; {a, b, c} = r; b 2 However, ...
22
votes
0answers
417 views

A documented syntax of FileNames doesn't work?

Documentation discrepancy present through 10.3 According to the documentation for FileNames under Details: However when I attempt to use this syntax I get an ...
2
votes
0answers
52 views

Import names into notebook namespace [duplicate]

I have function that at some point has list of strings (e.g. {"apple","pear"}) and I want to declare (initialize) those variables in notebook namespace to default ...
7
votes
3answers
81 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
182 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
144 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
314 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]]}
5
votes
3answers
605 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 ...
6
votes
2answers
502 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: ...
48
votes
2answers
1k views

Head and everything except Head?

I have been working on picking expressions apart using Head and Part and encountered a little mystery. Consider the canonical ...
11
votes
1answer
152 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
0answers
65 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 ...
8
votes
0answers
85 views

Syntax error in debug mode

Bug introduced in 8.0 and persisting through 10.3.0 It appears that in debug mode, the \[Piecewise] symbol and its associated grid give a syntax error. For a ...
4
votes
1answer
98 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, ...
40
votes
4answers
23k views

Is there a syntax for single-line comments for notebooks?

I'm aware that I can use (* ... *) to comment out stuff in a notebook. Many languages have a syntax for single-line comments, such as ...
20
votes
1answer
258 views

New AssociationThread forms in 10.2?

Bug introduced in 10.2.0 and fixed in 10.3.0 (The extension of AssociationThread is not (yet) implemented and the corresponding documentation has been removed) ...
1
vote
1answer
34 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
70 views

Intersection of all sublists of a list [duplicate]

I want to get the intersection of all sublists of list in an easy way. ...
1
vote
1answer
80 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
286 views

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

How can one write f /@ # & /@ # & /@ # & /@ # & /@ # & /@ # & /@ # & /@ matrix in one line with arbitrary level and without using ...
0
votes
0answers
44 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
122 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
112 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
115 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 ...
0
votes
1answer
36 views

Possibly syntax errors? [duplicate]

trying to graph, however graph is blank when i enter it. Please help! ...
0
votes
1answer
294 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
67 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 ...
11
votes
1answer
239 views

Extract what symbol is set by SetDelayed, Set, TagSet, UpSet, SetAttributes, etc

One of the recent features of the Mathematica Plugin for IntelliJ IDEA (www.mathematicaplugin.halirutan.de) is a Structure View which let's you see information about several definitions that are done ...
8
votes
1answer
171 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 ...
4
votes
0answers
84 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 ...
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
103 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 ...
7
votes
1answer
145 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., ...