Skip to main content

Questions tagged [expression-construction]

The tag has no usage guidance.

1 vote
2 answers
73 views

How to exclude singularities for `NMinimize`

I have an messy expression and want to apply NMinimize to it, have no idea how to force NMinimize to ignore the singularities it ...
seva011's user avatar
  • 336
0 votes
1 answer
78 views

How to modify the order of symbols to make the result look more well and use some fixed expression 1-q, 1-c-q and so on?

In most cases, my expressions are quite complex, like the following expr and expr2. How can I make them look better, for instance, I want to use expressions like 1-q or 1-c-q and so on.
Chin Ching CHAN's user avatar
2 votes
1 answer
43 views

Conversion of an expression to function yields Tag Plus in ... is Protected error

I'm trying to implement polynomial interpolation. My current implementation involves generating an expression that is the final equation that will be plotted. While plotting the function itself works ...
Jason Ham's user avatar
3 votes
2 answers
167 views

Precise control of fraction expression

It seems that expression for fraction differs when the number of terms in the numerator is more than 2. ...
imida k's user avatar
  • 4,315
0 votes
2 answers
132 views

Elegant way to validate expression?

Suppose I'm using the expression Person[fn_String, ln_String] as a data expression, and want to prohibit the creation of expressions where ...
Michael Harrison's user avatar
1 vote
1 answer
130 views

Fitting an inverse power law [closed]

Is there any reasonably fast way of finding a function of the type that best fits a given data, for some K and n? For example, the following data closely follows an inverse power law ...
sam wolfe's user avatar
  • 4,903
0 votes
1 answer
55 views

Generating a 2 variables polynomial with constraints

I would like to generate automatically a polynomial in two variables $(s,t)$ which is symmetric under the exchange of those variables. There are three kinds of terms; at order $k$, we have $$(s+t)^k, \...
Rubilax96's user avatar
-1 votes
1 answer
51 views

Swap Composite Command Components

Let's take a composite Mathematica command: A[B[]] where A and B - two arbitrary ...
ayr's user avatar
  • 2,444
1 vote
1 answer
74 views

Clarification of the $MemberQ$

There are a number of expressions: ...
ayr's user avatar
  • 2,444
1 vote
1 answer
172 views

Need to find a unique mathematical expression (not in documentation) that is as short as possible but takes a good amount of time to evaluate

I am writing a public ResourceFunction and I need a good clever use case that should not appear to emulate any examples in the official documentation but will ...
Jules Manson's user avatar
  • 2,467
1 vote
1 answer
120 views

How to convert this Mathematica expression to another, as described here?

I am working on a function of which the core will consist of something like: ...
nilo de roock's user avatar
2 votes
0 answers
116 views

Store pattern names in variables, and use them in Condition (/;)

I am trying to create patterns whose form is not hard-coded, and which are not explicitly directly written. For that I want to use one list of pattern names to name some parts of a ...
abcd's user avatar
  • 483
0 votes
2 answers
63 views

How to turn FindFit result into function within a Module context

I'm trying to construct a 'normal' function (with formal parameter) from the FindFit result within a Module context. While this works on a global level: In := ...
Anatoly Ressin's user avatar
4 votes
1 answer
251 views

Why isn't this expression returning true to being positive when it is clearly positive?

Consider: ...
Math's user avatar
  • 407
4 votes
1 answer
127 views

Alternatives in pure function construction

When I declare a function f in the following form: f[a|b] := 1 then I can use it like: ...
Pedro Sobota's user avatar
1 vote
2 answers
67 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 ...
ExpressionCoder's user avatar
2 votes
0 answers
34 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 ...
Stijn's user avatar
  • 332
3 votes
2 answers
755 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 ...
xelen's user avatar
  • 31
1 vote
4 answers
319 views

Creating a block diagonal matrix when the submatrices in the diagonal are unknown

Let us assume that we have an integer $j$ $(j=1,2,...,k)$ and that for every $j$ is generated a matrix $P$ of dimensions $j$x$j$ . For example, if $j=1$ then $P=(-2)$. If $j=2$ then $$R = \begin{...
arod's user avatar
  • 51
1 vote
2 answers
194 views

How to sort out/ extract positive and negative powers as list?

I have the following expression expr = x1^d1 * x2^d2 * x3^d3; where d1,d2,d3 can contain negative values/expression i.e. in ...
BabaYaga's user avatar
  • 1,897
2 votes
1 answer
43 views

Formula: setting parameters vs replacement, different results?

I have a question that may sound stupid and have an easy answer - but I currently do not see it. I have defined a function of four variables, $f[a,b,c,d]=...$, in what I think is correct Mathematica ...
Al Waurora's user avatar
0 votes
1 answer
51 views

Nest expressions of several arguments

I have the following function: Q[r_, f_, s0_] := Q[r, f, s0] = F[r, s0] D[f[s0], s0] By calling Q[r, Q[r, f, s0], s0] I ...
Svetlana's user avatar
  • 153
3 votes
0 answers
183 views

Computations with OptimizedExpressions without completely expanding them

I have to manipulate huge expressions that are rational functions of many (∼30) variables with integer coefficients. Storing them just as a ratio of two polynomials would be impractical. But they can ...
Vladimir Reshetnikov's user avatar
2 votes
0 answers
60 views

How to do an arbitrary expression growth in Mathematica?

I want to write a function that can be used to grow an expression from a seed or another existing expression based on part specification. ...
user13892's user avatar
  • 9,523
0 votes
1 answer
178 views

Help with printing table data

I am looking for the way of building a Table in a fast way. My true table evaluates huge functions with a system of differential equations . Let us for simplicity consider this: ...
aluuzz's user avatar
  • 67
0 votes
0 answers
50 views

How to generate nested expression?

I've found some related questions, but nothing has really helped me to do what I want to do. Given a list of variables L and a parameter ...
TumbiSapichu's user avatar
  • 1,613
1 vote
0 answers
107 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} ] ...
Fortsaint's user avatar
  • 2,060
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 ...
user27119's user avatar
  • 2,520
1 vote
3 answers
86 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 ...
Y.L's user avatar
  • 181
0 votes
1 answer
87 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 ...
ExpressionCoder's user avatar
0 votes
1 answer
134 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: ...
Xavier's user avatar
  • 3
0 votes
0 answers
65 views

Transform String to Expression [duplicate]

I have a variable postVector and another called CHKpostVector. Both are global variables. Only the variable ...
Rby's user avatar
  • 159
2 votes
3 answers
3k 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?
acoustics's user avatar
  • 1,719
3 votes
1 answer
105 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$ ...
Milind Hegde's user avatar
3 votes
1 answer
95 views

Creat a matrix with boundary condition

I would creat a symmetric matrix, but how can I set the boundary in Subscript? ...
ABCDEMMM's user avatar
  • 1,854
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 ...
QuantumDot's user avatar
  • 19.7k
-4 votes
1 answer
87 views

Translation of GLSL expression (2) [closed]

What's the most compact WL translation of this GLSL expression: length(max(vec2(x,y),s)) ?
ChrisJJ's user avatar
  • 618
0 votes
0 answers
103 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: ...
holistic's user avatar
  • 2,995
22 votes
4 answers
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 ...
Bob Ueland's user avatar
  • 1,069
1 vote
0 answers
108 views

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

Here is a piece of my code ...
Emilio's user avatar
  • 11
5 votes
6 answers
1k 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 ...
user avatar
4 votes
4 answers
475 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 ...
fishbacp's user avatar
  • 183
10 votes
3 answers
184 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} \...
ConvexMartian's user avatar
-1 votes
1 answer
51 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 ...
tamir's user avatar
  • 1
4 votes
3 answers
327 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: ...
Tyler Durden's user avatar
  • 4,102
1 vote
2 answers
95 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 ...
matrixbud's user avatar
  • 435
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[...
yode's user avatar
  • 26.9k
1 vote
4 answers
369 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 ...
matrixbud's user avatar
  • 435
5 votes
3 answers
371 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 ...
user13892's user avatar
  • 9,523
0 votes
1 answer
80 views

Proper formulation of Do expression [closed]

I'm having trouble with the following code: ...
David_Shmij's user avatar

15 30 50 per page