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

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 <...
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 ...
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 ...
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, ...
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&...
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) ...
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 ...
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 ...
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 ...
4
votes
1answer
69 views

How to define an expression which is differently evaluated in calculations and printed

Let's say, we have a list: values = {1.2, 0.04, 0.9}; Is it possible to replace 0.04 by some expression, which displays as <...
0
votes
1answer
126 views

Can't get a plot from piecewise parametric function [closed]

I can't seem get a 3D plot from r[t]. Any suggestions? ...
1
vote
1answer
137 views

How to make a StreamPlot with three variables and two expressions

I'm trying to make a StreamPlot in Mathematica with three variables. I already have two variables, x and y, that make an ellipse via StreamPlot[{-y,x}] but I ...
2
votes
2answers
131 views

What is the meaning of Range[10] /. {x_ /; PrimeQ[x] -> x^2}? [closed]

I'm currently doing a unit at university that touched briefly on Mathematica, but the final exam will feature multiple choice questions from Mathematica (along with excel and matlab). This leads to ...
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
1answer
109 views

Mathematica and special functions

How is it possible that Mathematica doesn't recognize it's own definitions of special functions ? I tried as input: ...
2
votes
1answer
81 views

Failure in the use of FullSimplify

My question is about an apparent failure of the function "FullSimplify" to simplify an easy algebraic expression. This is the expression that I ask Mathematica to evaluate: ...
-2
votes
1answer
79 views

Sign of a symbolic expression as a function of parameter values

I need to know the sign of the following expression for p[t] = z/(1-a), as a function of the parameters {a, b, c, z}: ...
1
vote
1answer
138 views

How to evaluate sum with different coefficient in each term?

I would like to know if there is a syntax that allows me to enter a sum that has coefficients that vary for every term? I have no interest in evaluating them numerically, but rather to keep them as ...
1
vote
2answers
103 views

Matrix with infinity on main diagonal

The question is trivial, however, there might be unexpected solutions. What would be nice way to create a square matrix with $\infty$ on main diagonal, and some arbitrary constant everywhere else? My ...
2
votes
1answer
77 views

how to manipulate indices in a table/vector

Perhaps I'm missing something very basic. Could somebody guide me how to manipulate indices of a list. For example, if I have ...
1
vote
1answer
152 views

GCD of Table entries

This question is from a newbie, so please be gentle in thrashing if I'm missing something very basic. How can I use GCD on a matrix/vector entries stored as Table. For example, if ...
0
votes
0answers
46 views

Treating expressions as symbols [duplicate]

I'm trying to do something like this: test = {x, y}; With[{test[[1]] = 3}, x/y] However, the following error is printed: With::lvset: "Local variable ...
0
votes
0answers
54 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 ...
0
votes
1answer
40 views

Testing Conditions in For Loops

I am attempting to create a set of coefficients that satisfy a set of conditions using the Do function and If statements. I did this successfully with a basic set of conditions: ...
12
votes
2answers
594 views

Why aren't parentheses ( ) an expression in Mathematica?

Why aren't parentheses ( ) an expression in Mathematica? Can I get an expression in a form where parentheses are represented by an expression?
6
votes
1answer
105 views

Why are SetProperty and PropertyValue not working here?

I have a very simple graph, a loop: ...
3
votes
1answer
87 views

Why minimization does not work with symbolic array as arguments

If I try to minimize with constraints a function of several variables, with Gamma regularized function involved in the constraints it seems to works, as shown below (this is just a dummy example ...
6
votes
0answers
77 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: ...
-1
votes
1answer
95 views

How to make sure input is an ODE

I'm having trouble wrapping my head around why this isn't an ordinary differential equation. ...
0
votes
1answer
256 views

How To Use D[ ] to Define a System of PDEs

We have two variables $u_{1}$ and $u_{2}$ which are functions of $x,t$. That is, $u_{1}=u_{1}(x,t)$ and $u_{2}=u_{2}(x,t)$. Consider the the system of partial differential equations $$\frac{\partial ...
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 ...
3
votes
2answers
232 views

Integrate using \[Esc] int \[Esc]

I like writing integrals symbolically instead of using Integrate[]. I suddenly seem to not be able to do this and am confused. I type \[Esc] int \[Esc] then ...
1
vote
1answer
134 views

Partial derivative of defined function with vector input

Background: Have written a formula for the refractive index for a glass slab (n) that depends on the variables t,a and d. Now I want to calculate for example some sort of error and I'll be needing to ...
1
vote
1answer
59 views

What is the correct idiom for mapping a 0 value in a modulo n expression back to n?

What is the correct idiom for mapping the $0$ value in a modulo $n$ expression back to $n$. For example if I want to be sure that any integer value maps back to the index for a character in the ...
0
votes
0answers
35 views

What does this “Cos[1.theta]”mean in Mathematica? [duplicate]

{{u[theta] -> 2.22328*10^8 - 2.22328*10^8 Cos[1. theta]}}
0
votes
1answer
81 views

Block Matrix Multiplication [closed]

I have a = {{-1}, {0}, {0}} b = IdentityMatrix[3] c = {a, b} d = {{7}, {2}, {0}, {0}} and would like to compute e = c.d ...
0
votes
1answer
69 views

How do I apply a conditional append rule to plot randomly chosen points?

I'm working on an attempt at forming a sort of "Mandelbrot" set using Newton's method and randomly chosen points. Effectively I need to define a loop for Newton's method to determine whether my points ...
23
votes
2answers
672 views

What is the difference between Composition (@*) and sequential applications (@)?

What is the difference between f@*g@*h@x and f@g@h@x Both evaluate to f[g[h[x]]] ...
27
votes
2answers
2k views

What are the cool kids talking about when they use ##&[]? [duplicate]

All the cool kids are apparently using ##&[] for Unevaluated @ Sequence[] but I have no idea what either means. ...
0
votes
0answers
33 views

What does a single @ do? [duplicate]

I have a simple expression: N@Log2@g[2048] I understand that N is Numerical value , that a function called g is being ran with 2048 as its first argument. But ...
4
votes
4answers
292 views

Get Axes Range of Plot?

Say I have some plot plot = Plot[Sin[x], {x,0,10}] (*as an example*) Is there a way I can get the x and y axes min/max values from the "plot" variable? If I ...
1
vote
1answer
27 views

SetterBar Display using MatrixForm

I have vAwGOptns = { {{0}, {0}}, {{1}, {0}}, {{0}, {1}}, {{1}, {1}} }; and would like to select ...