# Questions tagged [expression-construction]

The tag has no usage guidance.

93 questions
Filter by
Sorted by
Tagged with
564 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 ...
91 views

### Is there a good reason why Slot[] is not an atomic expression?

Here's a good reason why I think it should be, Map[ If[AtomQ@#, #->"is an atom", #->"not an atom"]& , {"hello",Range@3, # &} , {-1} ] ...
49 views

### Replacements: using condition to restrict to parts that satisfy a Boolean expression

I need to replace all integers k in a list with {k} and tried: EDITED: as a clarification: I mean all integer elements of a list, not all integers in the list, so in the following example, only 4 ...
603 views

The goal is to assemble a SparseArray in an additive fashion. Let us assume we have a large List of indices (some will be ...
32 views

### Setting pieces of “matrices” - unwanted behavior

I am constructing matrices whose elements are lists themselves (of varying length), and am (re)setting the entries of these matrices using among others the "All" command. It seems that in ...
212 views

### Creating of the Jordan Canonical Form

I have a matrix polynomial P(s) and the Jordan blocks of P(s) corresponding to every eigenvalue sj (j=1,...,k). How can the Jordan Canonical Form be generated, i.e. the block diagonal matrix which has ...
115 views

2k views

### How to define constants in Mathematica like c1,c2,c3,…cn?

Manually defining the constants is tedious if the 'n' is large. how to do this?
76 views

### Generate multivariate monomials with constraints

I'm trying to generate multivariate monomials in variables $p_1, \ldots, p_n$. Each monomial has either $p_i$ as a factor, otherwise $(1-p_i)$. I need to generate all monomials which have exactly $k$ ...
83 views

### Creat a matrix with boundary condition

I would creat a symmetric matrix, but how can I set the boundary in Subscript? ...
201 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 ...
1k views

### An inverted pyramid

I want to draw a pyramid approximately like this ...
475 views

### How to find the lowest power in multi-variable expression?

I am sorry for asking a similar question again. I asked How to find the lowest power of variable in expression? and I got a wonderful answer, but I have one more question for a multi-variable ...
74 views

### Translation of GLSL expression (2) [closed]

What's the most compact WL translation of this GLSL expression: length(max(vec2(x,y),s)) ?
1k views

### Is expression in Mathematica well defined?

According to Mathematica, everything is an expression. So an atom is also an expression. But in other parts of documentation, they say that an expression is of form ...
76 views

### Generate a system of linear differential equations from a coefficient matrix

I want to generate a system of linear equations that is stable. For that I generated random coefficients and divided the 10 by 10 matrix by the largest eigenvalue and set the diagonal to -1: ...
80 views

### How to send Map[Plus[1, #] &, {1, 2, 3}] to Mathematica from C# via IKernelLink?

Here is a piece of my code ...
915 views

### Replace element of a matrix with condition

consider a matrix $\left( \begin{array}{ccccc} 0 & 0 & 1 \\ 1 & 0 & 0 \\ 1 & 1 & 0 \\ \end{array}\right)$ How do I do a program that does these steps 1-Replace each ...
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 ...
328 views

### Generating a family of 0-1 matrices satisfying a particular property

I'm looking for an elegant way to generate the set of all possible matrices that satisfy the following properties: Each matrix has 9 rows and c columns, where 1<=c<=9. Each matrix has exactly ...
50 views

### Producing the same output as Tuples[{0, 1}, 4]? [closed]

How can I use the functions decimalToBinary and padWithZeros to produce the same output as ...
299 views

### Handling multi-part equations

How are multi-part equations best handled? For example, take the torsion equation: We could express part of this equation like this: ...
238 views

I have an old notebook that uses the now obsolete Arrow package. For example, I have an expression containing ...
87 views

### How to generate expression a + a1 e1 + a2 e2 + a12 e12 (subscripted)?

Sorry to ask this twice. I thought I could get away with just a0 + a1 e1 + a2 e2 + a3 e1 e2, but for my application I can't. I can generate a + a{1} e1 + a{2} e2 + a{12} e12 (subscripted), but that's ...
314 views

### How can a generate an expression like a0 + a1 e1 + a2 e2 +a3 e3 + a4 e1 e2 + a5 e1 e3 + a6 e2 e3?

I wish to input n and then generate an expression. It would look like the above when $n = 3$. I would like to use subscripts for ...
180 views

### How to make RawBoxes to be Expression

expr = First@ Level[Values@ WolframLanguageData["Plot", EntityProperty["WolframLanguageSymbol", "DocumentationExampleInputs"]], {3}] Plot[Sin[...
638 views

### Elegant method of generating this matrix?

Good evening, I need to determine an elegant (as possible) method of computing an $n\times n$ matrix below (the matrix shown is just a $16\times16$ example). I've been toying with ...
279 views

### a function to extract all subexpressions from an expression

Can somebody help me with a function f such that it extract all sub expressions (i.e. looking down the expression tree) from any expression given to it and also a ...
59 views

### Is it the correct syntax with TransformedDistribution?

I define a function as f[x_] := ...;which is in fact the PDF of a random variable $X$. The PDF if given by $f_X(x)$. Let $Y$ is a random variable, which is the ...
83 views

### Solving equations with change of variables is not working?

I want to express it in the form $$\text{expr=}\int_{-\infty}^{\infty}C_1\exp\left(-t^2\right)f(t)dt$$, i.e., the integrand is a bounded smooth function $f(t)$ times $\exp(-t^2)$ and the domain of ...
77 views

### Proper formulation of Do expression [closed]

I'm having trouble with the following code: ...
72 views

### How Defer[1+Evaluate[1+1] work?

I want to generate some expressions. The expression is not evaluated expect some parts will evaluate first. A simple example is Defer[1+1+1] and in this expression ...
262 views

### How to overload the operator “*” as KroneckerProduct [closed]

Can I use the expression below a * b * c * d for short to instead KroneckerProduct[a,b,c,d] automatically when a,b,c,d are ...