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

Mathematica Empty Plot FourierSinSeries function

I'm trying to get a plot of different order Fourier series of the function x-1, why does Mathematica give me an empty plot? ...
22
votes
0answers
419 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 ...
9
votes
0answers
117 views

Is there a linter to help write good Mathematica code?

I don't do much real programming, but I've recently been turned on to Atom, which has linter plugins for over 50 languages to make coding easier (most drawing on pre-existing lint-like programs). In ...
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 ...
7
votes
0answers
188 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 ...
6
votes
0answers
75 views

Negative accuracy numerics ( 0``-128 notation )

What does it mean to have a negative accuracy number? I understand 0``128 to mean "the number zero to 128 decimal points". Mathematica corroborates this: ...
6
votes
0answers
113 views

Design considerations behind `O` (a.k.a. BigOh, a.k.a. Landau Order)

This works without any warnings: O[Log[x]]. This raises a warning: O[x^2]. I have a few questions around this: Why is it a ...
4
votes
0answers
93 views

Why does FromDigits transpose its argument (sometimes)?

a = {{1, 2}, {3, 4}, {5, 6}} ; FromDigits /@ Transpose@ a == FromDigits @ a (* True *) The only "strange" syntax I've found in the docs is But it doesn't ...
4
votes
0answers
86 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 ...
4
votes
0answers
104 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 ...
4
votes
0answers
63 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 ...
4
votes
0answers
259 views

Syntax error for optional pattern, but only in debugger

This expression (explained here by Leonid) evaluates fine unless Evaluation->Debugger is enabled: h[x : (_Integer) : 1] := x Syntax::sntxf: "x:" cannot be ...
4
votes
0answers
112 views

Is there a way to check whether two notebooks share the same variables?

When I code in Mathematica, I often re-use code from old notebooks which fulfilled a specific purpose; for example, one testing for soft matches in strings, or one that identifies outliers on a graph ...
4
votes
0answers
121 views

Proper treatment of roots and powers in Series?

I have the following problem in Mathematica 9 on Linux. I let Mathematica compute the Series expansion: ...
3
votes
0answers
53 views

Pre-define list of variables to set them in bulk

I understand this is likely tremendously simple, but I cannot work out how to do the following: vars = {b,c} *define variables* vars = {1,2} *set them* Then I ...
3
votes
0answers
84 views
3
votes
0answers
38 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
60 views

Why is `Cell` > `Convert To` > `InputForm` not invertible?

I sometimes post code to PhysicsSE, and I usually convert it to InputForm first before posting, in order to avoid pages and pages of ...
3
votes
0answers
114 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, ...
3
votes
0answers
509 views

NonLinearModelFit with Two Dimensional List of Weights

I'm currently trying to fit Planck's law (B[λ, T]) to measurements, thereby determining Planck's constant. I have a list of triplets containing wavelength, ...
2
votes
0answers
396 views

Conditional statements in intial conditions?

This is potentially a daft question, but I thought I'd ask it; I have some material free to diffuse in a boundary between rn and ro; I've been able to get it working nicely for neumann type boundary ...
2
votes
0answers
206 views

Syntax colouring when using Symbolize

I need to use symbols with suffixes in order to make my code readable in relation to the Eurocodes. To do this I use Symbolize from the ...
1
vote
0answers
53 views

Using Nearest on a 2D List (seeing extra parentheses)

I am working a problem involving colliding particles. I define a list of particle diameters (effectively a bin distribution). I need to know if two particles collide, in what bin diameter should I ...
1
vote
0answers
93 views

SyntaxForm not correctly parsed by FrontEnd

When using TagBox with SyntaxForm, I noticed sometimes it is not well parsed by the ...
1
vote
0answers
79 views

Decapitating “explicit” and “implicit” heads

This is a follow up to this question. So far, I named "explicit" heads to those that appear explicitly in the expression. For example, f[x] has an explicit head. I ...
1
vote
0answers
44 views

Matching Root[…] objects with patterns, unexpected hidden argument

I needed to write patterns that could distinguish between arbitrary-function and polynomial forms of Root objects, for example, ...
1
vote
0answers
144 views

Defining an operator

Let s be a positive integer and let DifferenceDelta be this function with step = 1. Define ...
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
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 ...