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
0answers
79 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
87 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
99 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
24k 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
260 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
72 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
45 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
135 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
121 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
118 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
38 views

Possibly syntax errors? [duplicate]

trying to graph, however graph is blank when i enter it. Please help! ...
0
votes
1answer
382 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
82 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
244 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
177 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
94 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
42 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
105 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., <...
3
votes
4answers
227 views

How can I make a summary of all the commands of Mathematica?

I would like to have a simple way to get summary information about all the many commands built into Mathematica. How could I do this? Is there a site I may refer to?
9
votes
5answers
6k views

Notation of partial derivative

I want to write partial derivatives of functions with many arguments. Why is it that when I type f[x,y] ctrl+6 (0,1) it turns out to be bad syntax? The output of ...
1
vote
1answer
65 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
83 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 ...
13
votes
1answer
309 views

ToExpression processing errors

Is their a way to get a more comprehensive return value when running ToExpression? For example when I run ...
2
votes
1answer
47 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
115 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
609 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 <...
14
votes
2answers
993 views

How can one define an infix operator with an arbitrary unicode character?

You can setup "UsefulFunction[a, b]" to use custom infix notation "a [LeftRightArrow] b" as follows: ...
7
votes
2answers
270 views

HoldForm[Operator ##] on some list

Recently in response to this question Mr.Wizard suggested an unusual way to summing numbers. This doesn't seem to be documented. ...
21
votes
3answers
1k views

How is + as an infix operator associated with Plus?

How is + associated with Plus? Suppose I want to define a head FooBar and have it ...
5
votes
3answers
252 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 ...
8
votes
2answers
977 views

Evaluating an If condition to yield True/False

I would like to decide whether an option passed to my custom function has the value Automatic or something else. This is my attempt: ...
1
vote
0answers
395 views

How can I solve the 2D Laplace equation with Neumann boundary conditions? [closed]

I would like to solve the following boundary value problem for $u(x,y)$: PDE $\quad \quad \frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2} = 0$ Domain $\quad \quad 0 \le x \le ...
1
vote
2answers
173 views

How to define a sequence of piecewise functions and then plot them altogether?

The following is the piecewise functions I want to define ${f_k(x)} = \left\{ {\begin{array}{*{20}{c}} {\frac{{j - 1}}{{{2^k}}}}&{\frac{{j - 1}}{{{2^k}}} \le f(x) \le \frac{j}{{{2^k}}}}\\ k&...
4
votes
0answers
65 views

String option names for Cells

They seem to be correctly interpreted. I'm asking because of some minor reasons and a major one: NotebookWrite a Cell with WholeCellGroupOpener option I don't know any official confirmation so let ...
2
votes
2answers
103 views

Simplify set-theoretic expressions [duplicate]

As I can get set-theoretic simplifications of expressions and corresponding Venn diagram for example ...
1
vote
0answers
41 views

Mathematica Workflow [duplicate]

What methods/tools/tips have you found that dramatically improved your Mathematica workflow? I have a love/hate relationship with Mathematica. It is useful no doubt, but defies my intuition at every ...
0
votes
1answer
116 views

How to enter piecewise functions into Mathematica [closed]

I'm trying to enter a piecewise function (named eq30) into Mathematica. However, it seems not to work. The expression I entered is ...
2
votes
2answers
339 views

Writing a function that returns a (usable) function

I am trying to create a function that returns Arnold's Cat Map of size n iterated k times. I can get something out of the Function command, but I can't figure out ...
22
votes
1answer
636 views

Shorter syntax for Fold and FoldList?

I find it tedious to write out the following: a = {1, 2, 3, 4}; Fold[f, First @ a, Rest @ a] f[f[f[1, 2], 3], 4] It ...
17
votes
3answers
2k views

Why does Mathematica use [[ ]] notation for array indexing?

I am confused by why Mathematica uses [[3]] to get the 3rd element, or [[i,j] to get the i,j-th element of a 2D array. This ...
0
votes
1answer
53 views

A question about the syntax [closed]

I have $3$ elementary questions to ask and I thank you in advance. Question N°1. What is the right syntax for $$y\equiv0\pmod {2}$$ in the code below? ...
6
votes
2answers
176 views

How to Write Partition with Infix?

The documentation says that using Infix ~, the following input f[e1,e2,e3,...] can be rewritten as ...
7
votes
0answers
198 views

What is a good way to code long, complex, compilable algorithms?

The functional paradigm of the Wolfram Language used in Mathematica is all around wonderful. For intense numerics, Mathematica comes with the ability to Compile ...
2
votes
2answers
92 views

Using Table with arbitrary number of variables [duplicate]

Let $P=\{p_1,...p_n\}$. I would like a way to implent Table[Expression,{$p_1$,lim},{$p_2$,lim},...,{$p_n$,lim}] where n and lim are parameters defined by the user. Any ideas?
6
votes
1answer
92 views

What is the role of _ in this expression?

I'm fairly familiar with basic Mathematica, but some of its more advanced syntax (especially certain special characters) eludes me. In the Scope section in the documentation of ...