Questions tagged [expression-construction]
The expression-construction tag has no usage guidance.
23
questions
56
votes
3
answers
19k
views
How to form a block-diagonal matrix from a list of matrices?
For example, like this:
I know Join works, but it is a bit troublesome for multiple matrices. I also tried DiagonalMatrix, but ...
19
votes
2
answers
786
views
Additive SparseArray Assembly
The goal is to assemble a SparseArray in an additive fashion.
Let us assume we have a large List of indices (some will be ...
11
votes
1
answer
307
views
Why can't a string be formed by head String?
Since everything is an expression in Mathematica, why must a string object be formed by "abc" but not by a String[abc] ...
15
votes
2
answers
2k
views
Need help coding/creating a recursive list
I have two lists A and B, each with 99 real numbers. I want to form a list, C, whose ...
8
votes
2
answers
265
views
Using `With[...]` with a list specification as a variable [duplicate]
If you have some defined function, say f[a_, b_ c_, x], one can initialize this by using With[...] as
...
7
votes
1
answer
475
views
Arrange equation in normal form
Is there a way, or if not, how could one define a function which takes an equation in any form (for example as given by FullSimplify):
$$(A+X_0) x+By=3x$$
and ...
5
votes
1
answer
339
views
How to represent 1 as Symbol["Integer"]
Maybe this is a boring question, but I cannot figure it out. Because every expression has a Head, and Head[1] is ...
2
votes
2
answers
932
views
Generating complete lists of polynomials
I would like to generate a list of all $3$-variable Laurent polynomials with non-negative integer coefficients using a looping construct so that I can, one-by-one, check them for specific ...
8
votes
3
answers
1k
views
How to create a large sparse block matrix
I need to generate a very large sparse block matrix, with blocks consisting only of ones along the diagonal. I have tried several ways of doing this, but I seem to always run out of memory.
The ...
7
votes
4
answers
815
views
Concatenating strings, unevaluated expressions and evaluated expressions/values
Maybe this is something very simple to some of you. Anyway, I think this can be useful to many others like me.
I would like to build an output that involves strings, unevaluated expressions and ...
7
votes
2
answers
234
views
Constructing expressions using Sum vs Array[... Plus] vs Plus@@Table[...]
For constructing a sum of terms which are symbolic, I noticed that in addition to
...
6
votes
1
answer
4k
views
Order of operations, precedence in Mathematica [duplicate]
I get confused in the order of operations in Mathematica.
For example,
f /@ 10^{1, 2, 3}
{10, 100, 1000}
In my head, that ...
5
votes
3
answers
750
views
Getting a usable expression tree
I need to get the expression tree for some expression.
expr //TreeForm
The above grabs the expression tree but it isn't in some sort of usable format. Just an ...
5
votes
3
answers
218
views
How to make RawBoxes to be Expression
expr = First@
Level[Values@
WolframLanguageData["Plot",
EntityProperty["WolframLanguageSymbol",
"DocumentationExampleInputs"]], {3}]
Plot[Sin[...
4
votes
3
answers
1k
views
How to find the lowest power of variable in expression?
If I have expression like
a1/x +a2/x^2 + a3/x^3
I want to return 1/x^3. In general case,
...