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.
0
votes
1answer
12 views
Evaluation of a Laplace transform for e^-at does not give expected results
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
61 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 ...
5
votes
1answer
103 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
130 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., ...
0
votes
0answers
48 views
memory aid frequently used commands [closed]
I am looking for links to a summarized list of most used commands of Mathematica or a reference manual with examples that only includes commands and syntax.
I would also like a list of keyboard ...
1
vote
1answer
47 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
36 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
42 views
2
votes
1answer
37 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
92 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 ...
11
votes
1answer
585 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 ...
12
votes
1answer
183 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
229 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 ...
1
vote
0answers
101 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
93 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}}}}\\
...
19
votes
0answers
188 views
New AssociationThread forms in 10.2?
Is this another case of "documented" but "not implemented" ? or at least it is not explained clearly as I cannot make it work:
Two new forms appears in the new 10.2 doc. of ...
3
votes
0answers
46 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
65 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
89 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
50 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?
...
5
votes
2answers
160 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
80 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
65 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
83 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
80 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 ...
1
vote
2answers
73 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
149 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
103 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
66 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
64 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
87 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
87 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
48 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've
u = Table[Subscript[u, i], {i, 1, lp + 1}].
I've these u in an expression, ...
1
vote
1answer
49 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
45 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
1answer
38 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
525 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?
5
votes
1answer
80 views
3
votes
1answer
79 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
63 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
2answers
93 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
187 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 ...
3
votes
2answers
142 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
60 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
55 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
33 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
51 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
65 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 ...
20
votes
2answers
568 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]]]
...