# Questions tagged [expression-manipulation]

How to manipulate expressions structurally, not necessarily complying with the rules of algebra.

645 questions
Filter by
Sorted by
Tagged with
43 views

### Converting a vector of expressions into functions with the index being an input

I am trying to generate a list of functions from a vector of expressions. I have the list $H=[1,x,x^2+1,3x^3+2x,4x^2+2x]$ and I want to define a function $f$ using two inputs such that $f(n,x)$ ...
51 views

### How to delete certain terms in a polynomial with variables in subscript?

I have a polynomial in the following style, ...
38 views

### Display function definition when function has list argument

[MMA 11.0.1] I have defined various activation functions, and plotted them using a little helper to put the equation into the plot ...
29 views

### Force Mathematica to take real values of cube roots in expressions when simplifying [duplicate]

I am dealing with an algebraic mess of variables for a project and for some reason, even though the function is real, Mathematica had been spitting out imaginary values to me. This issue has been ...
57 views

### Exponential matrix, run during infinit amount of time

Context: I want to apply an exponential matrix on a vector. The size of the matrix (which then I apply the MatrixExp on) is size of 50x50, and not diagonal. For reason I don't know, Mathematica take a ...
93 views

### Extracting n-th part of an expression without any evaluation

Is it possible to extract n-th part of an expression as a string, without any evaluation? For example, ...
27 views

### Rearranging an expression for floating point accuracy?

Does Mathematica have the feature of rearranging an expression with the goal of minimizing floating point accuracy errors? I'm asking this because I have some long expressions that really suffer when ...
40 views

### How to filter out “relevant” information from expression

I have an expression of the form op = a3 b2 c1 d0 - a2 b3 c1 d0 - a3 b1 c2 d0 + a1 b3 c2 d0 + a2 b1 c3 d0 +... that is, each term is of the form $a_i b_jc_kd_l$, ...
34 views

### How do I integrate the result of a DSolve operation?

I've got the following result from evaluating a DSolve problem: ...
145 views

### I want to turn an equality statement into a function

I've got a statement (condition?) that I want to integrate. r'[t] == (2*(c + A*t)*(1 + z))/(2 + z) What's the best way to integrate just the RHS of this equality? ...
102 views

### Map a function at one “part” of each term in a multivariate polynomial

I have polynomials in several variables x[i] and y[j], and I am using First@SymmetricReduce@ ...
42 views

### Unpacking list of arguments into parameters

I have a list in the following form: list = {{a,1,3},{b,1,3},{c,1,3}} Now I want to apply this list as parameters for the Sum function so that I end up with the ...
40 views

### How can I use a replacement rule as part of a simplification?

I am using Mathematica to symbolically calculate the likelihood for a simple linear regression model. As part of this I want to substitute ...
38 views

### How to change numbers in variables defined with a loop?

I am trying to change the number which is part of the variable name with a loop. What I want to changue is the following: ...
60 views

### Writing mathematical expression in a file

I am trying to write a mathematical expression as variable = expression in the output file. The current method that I am doing is through ...
46 views

### Rationalizing only specific terms in an expression

How can I change an expression like A = (-1. a)/(x + y) - (2.1 b)/(x + y) + 4.1 + 2. x + (3. r s)/(x + y) so that -1. a becomes ...
1k views

### Write x^3 as x*x*x

I use mathematica compute functions I need for some external coding. However I can't use terms like x^2+y^3 since my programming language needs this term written as ...
50 views

### Replace small expressions in larger expressions?

How can I replace small expressions in larger expressions? Simple example Replace[a^2 + b^2 + 2*a*b + x, (a + b)^2 -> c] I want to get ...
37 views

### Passing an expression to the Plot Function does not Work

Solving a differential equation I found that its solution was analytic, and I stored it as an expression from the default rule output of the DSolve[] function: <...
70 views

### Compile - Optimization of function calls - does it matter?

I was surprised to see that, in the results of CompilePrint for a function made with Compile, calls to ...
69 views

### Exploring curl of a gradient of a scalar function

Suppose I want to explore $\nabla \times \nabla V$ where $V$ is some scalar function. It basically results in a zero. But I would only know why if I solve it on paper. I wanted to use Mathematica for ...
60 views

### Collect terms in inverse powers of three variables

I have the following expression ...
35 views

### Simplify the coefficient of an expression after calling Collect

I have an expression for which I have run Collect to get the expression in terms of a few variables. I now want to run Collect ...
61 views

### Combining multiple graphs in one photo without consulting external programs [closed]

I want to add many plots from Mathematica into one picture and export as a PDF. Usually I select the plot and copy it as an image to Word, however the image reduces the accuracy of some plots. How can ...
42 views

### Reading product of same ByteArrays

I am handling a huge set of data and I am trying to optimize my code. I have very large expressions to expand and simplify and I've seen that converting the expressions to ByteArrays improves a lot ...
92 views

### Force results to be displayed in a way often seen in traditional math [closed]

I want to get my output in the form that I would write by hand. I have tried with TraditionalForm, but it did not work. I've looked at several answers in this SE ...
223 views

### Desktop vs. Cloud option, home plan vs. basic plan: syntax differences

I do not understand why the following simple expression is accepted using a browser (cloud option), but is not accepted using the installed software (desktop option) with the plan basic of Wolfram ...
49 views

### Find n-th derivative of the function, display it and then evaluate it at a point of choice

What would be the correct syntax to find the order derivative "$n$" in MMA, and to be able to evaluate it in a certain point. We ask for an example ; Find the order derivative 2 and evaluate ...
83 views

### Mathematica refuses to distribute a scalar through parentheses

I’m working on a problem involving Kelvin-Helmholtz instability and I’m trying to perform the linearization on Mathematica. For some reason when I get to my first order equation (ε × stuff + O(ε²) == ...
27 views

### Distinguishing function calls from multiplication when importing LaTeX via ToExpression and TeXForm

I'm trying to parse a LaTeX representation of a Desmos calculator (like this one) via Mathematica. Desmos exposes a JSON representation of its calculators, including a LaTeX representation of ...
136 views

### What is the difference between NSolve and N[Solve] [closed]

N[Solve] NSolve I am getting different results everytime I use these commands.
84 views

### How can I get output from Reduce assigned to a variable? [closed]

I use Reduce to solve an 3rd order equation, and the output is given as the OR'd combination the solution variable. Normally, I can do a replacement to assign the value to a variable, but that doesn'...
51 views

### Any way to automate solving problems where the answer from one question is used in the next?

I am a total Mathematica beginner. I just want to use it to do some calculations, and the reason it is so interesting and attractive to me as an engineering student is that it allows me to write maths ...
41 views

### How to eliminate a variable from coupled ODEs?

I found this question with an answer: How to eliminate variables in ODE? ...
61 views

### Computing the sum of the first row of a matrix

I wish to compute for the sum of the reciprocals of the first row of the distance matrix of a particular circulant graph. My code is as follows for the ordinary sum of the first row. ...
136 views

### Quantum bra and ket notations

Is there a way to define the above quantum expression in Mathematica. I am using an add on package in this link. http://homepage.cem.itesm.mx/lgomez/quantum/ What I have tried is: ...
137 views

### Better way to rename arguments to a functional form so that duplicate arguments are sequentially enumerated

I need to modify expressions that such as f[w, w, a, y, x, a, x, a] into f[w1, w2, a1, y, x1, a2, x2, a3]. In short, I have ...
143 views

### Simplifying expressions containing binary variables

Consider an expression with two binary variables, $a,b\in\left\{ 0,1\right\}$, given by $F=(1-a-b)^{3}(1-b)$, with truth table: ...
196 views

### Equivalent of select/remove for Mathematica?

What is the Mathematica equivalent of Maple's select/remove? To quote Maple: A typical application that uses select and remove ...
47 views

### Shorten a sum of many terms by introducing a rule for scalar product and Kronecker deltas and using repeated replacements

There is a sum of many terms that I would like to simplify by introducing a notation for scalar product of two vectors. Each term is a product of constants and of several components of 3D vectors: <...
94 views

### How to Simplify expression efficiently inside Power

How can I simplify trivial expressions under the Power? Here is one example: (z2p-z2p z3)^-ϵ ...
62 views

### How to extract terms from equation, and then set each of them to 0?

I have a long equation, namely, ...
70 views

### Collecting common powers of terms

How to collect the common powers appearing in the following function using MATHEMATICA, such that if I input (4 m^6)/((m - n)^2 (m + n)^4 (2m+n)^4) then the ...
76 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 ...
130 views

### Split matrix expression into multiple lines

Given a matrix expression testm = {a + b, c + d, e}; {# , testm[[ # ]] // Simplify} & /@ Range[ Length[testm] ] // MatrixForm \begin{equation}\begin{pmatrix} ...
59 views

### How to get the result in terms of a previously defined expression?

Say I have a vector X[n_] := Table[Subscript[x, i], {i, 1, n}] and a matrix of connections: ...
28 views

### Why are these expressions with shifted delta functions not equal?

I have the following equation Exp[a-t]*DiracDelta[t-a] == DiracDelta[t-a] which cannot be evaluated. However, if I plug in 0 for a: ...
39 views

### Substitute an expression iteratively

I have defined this function replaceIteratively[expr_, x_, list_] := Module[{n = 0}, expr /. x :> (n++; list[[n]])] which does the following job ...