Questions tagged [expression-construction]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
0answers
68 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} ] ...
5
votes
2answers
140 views

Using `With[…]` with a list specification as a variable

If you have some defined function, say f[a_, b_ c_, x], one can initialize this by using With[...] as ...
1
vote
3answers
80 views

Summation and product term expressed in Mathematica [duplicate]

I have the following term which I would like to express correctly in Mathematica: $$\sum_{i=1}^{m}\frac{1}{\prod_{j=1,j\neq i}^m(\rho_i-\rho_j)}$$ This means that for $m=3$ for example you should ...
0
votes
1answer
31 views

Displaying positions in expression tree

Can one display the position of each character in an expression tree? For instance: g[h[i, h], l] should be displayed using TreeForm where each character is ...
0
votes
1answer
74 views

How to pass an expression as list elements for a Mathematica command

I'm trying to build a generic function that will calculate sums on different iterators. To simplify let consider: ...
0
votes
0answers
17 views

Transform String to Expression [duplicate]

I have a variable postVector and another called CHKpostVector. Both are global variables. Only the variable ...
2
votes
3answers
783 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?
3
votes
1answer
59 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$ ...
3
votes
1answer
76 views

Creat a matrix with boundary condition

I would creat a symmetric matrix, but how can I set the boundary in Subscript? ...
7
votes
2answers
164 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 ...
-5
votes
1answer
63 views

Translation of GLSL expression (2) [closed]

What's the most compact WL translation of this GLSL expression: length(max(vec2(x,y),s)) ?
0
votes
0answers
54 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: ...
19
votes
4answers
936 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 ...
1
vote
0answers
59 views
4
votes
4answers
603 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 ...
4
votes
4answers
274 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 ...
9
votes
3answers
161 views

Graph that shows how symbols are used in an expression

I would like to make a graph to show how symbols build up an expression. For example, the matrix multiplication $$ \left( \begin{array}{ccc} a & b & c \\ d & e & f \\ \end{array} \...
-1
votes
1answer
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 ...
4
votes
3answers
252 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: ...
1
vote
2answers
80 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 ...
5
votes
3answers
141 views

How to make RawBoxes to be Expression

expr = First@ Level[Values@ WolframLanguageData["Plot", EntityProperty["WolframLanguageSymbol", "DocumentationExampleInputs"]], {3}] Plot[Sin[...
1
vote
4answers
239 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 ...
4
votes
3answers
220 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 ...
0
votes
1answer
76 views

Proper formulation of Do expression [closed]

I'm having trouble with the following code: ...
1
vote
0answers
57 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 ...
0
votes
1answer
57 views

Get these edges whose degree is 2 [closed]

...
1
vote
1answer
198 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 ...
0
votes
1answer
81 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 ...
6
votes
3answers
499 views

How to convert a string into a structured list

I am trying to use an efficient notation for the timing of sounds that i can play in Mathematica. I would like to parse the string "{ab{c{de}}f}" as the list ...
0
votes
1answer
55 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 ...
1
vote
2answers
353 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 ...
2
votes
2answers
553 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, ...
3
votes
2answers
96 views

Find most general 3-tensor under given constraint?

Consider A to be a general $2\times 2\times 2$ tensor: A = Table[ a[i,j,k], {i, 1, 2}, {j, 1, 2}, {k, 1, 2}]; pictorially one ...
5
votes
1answer
257 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 ...
0
votes
1answer
517 views

Convert string to function with an argument

I am trying to build an expression by first writing it out as a string and then using ToExpression to convert it to an expression. However, I cannot figure out how to make expression recognize x as an ...
7
votes
5answers
1k views

Create a list of all possible multivariate monomials of a certain order

Given variables x[i] for i=1,2,...,n I would like to create a list of all possible multivariate monomials of order ...
0
votes
0answers
59 views

What is the meaning of #, Root and & [duplicate]

I am new, but can any one tell me what is the meaning of formulas of x and y in the picture?
3
votes
3answers
99 views

Specify number of elements instead of step in Table [duplicate]

I think I have seen what I was looking for a ong time ago but I can't see nothing such in documentation. Quite often, I would like to create a Table with given ...
1
vote
1answer
87 views

How to obtain differential consequences of linear transport equation automatically?

Motivation Here I've asked how to derive coefficients of numerical approximation of the linear transport equation $$ u_t + u_x = 0, \tag{1} $$ on a fixed 3-point stencil automatically and here I've ...
0
votes
1answer
61 views

Misunderstanding of Replace code

I am looking for the right way to replace $\delta \, \, \text{by} \, \, 0.05 \, \, \, \beta \, \, \, \text{by} \, \, \, 1.77 \, \, \, \text{and} \, \, \, n \, \, \, \text{by} \, \, \, 12$ in this ...
0
votes
1answer
111 views

I have a term 'Keff' in terms of 'W'. I need to write 'W' in terms of 'Keff'. Does Mathematica provide an option for that

I have read similar answers on this topic. I am still not able to execute my code.The code is as follows. ...
0
votes
1answer
277 views

Defining a function to use in another function dependent on similar parameters [closed]

I want to define a variable dependent function which can be used to define another function which depends on the same variable and other variables. For example, I have a system where I define ...
0
votes
0answers
63 views

Determine class of special function from algebraic constraints?

Consider vectors x_i in arbitrary dimension. Let's say I have an expression in six variables F[x_1,x_2,x_3][x_4,x_5,x_6], which ...
4
votes
3answers
185 views

Find six vectors with rational entries under constraints?

Define six vectors v[i] with i=1,2,3...,6. Each v[i] is six dimensional and all entries in ...
0
votes
1answer
424 views

How does one initialize large arrays in Mathematica with a structured format? [closed]

I want to create a 10 by 10 matrix that increases by 1 every unit across like: 1 2 3 4 5 6 7 8 9 10 11..... Is there a function that does this without having ...
1
vote
3answers
194 views

How do I make a definition/function/method as I would in Java/MATLAB/Python

I've been trying to figure this out for a few hours now and it's driving me nuts. I am trying to confirm that, after transforming a Schrodinger equation, that the new wavefunctions satisfy the new ...
1
vote
1answer
140 views

Is there a way to convert a string to a Table indicator? [closed]

I have a list like this: list = {"k1","k2"} I want to use the elements in the list as Table indicators: ...
1
vote
2answers
71 views

Subsituting expressions for expressions

I'm trying to define functions using other functions, like so: f[a_, b_] := a/b; a[c_] := c; b[d_] := d; Now what I want to be able to do is two things: ...
1
vote
1answer
71 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 ...