Questions tagged [expression-manipulation]
How to manipulate expressions structurally, not necessarily complying with the rules of algebra.
633
questions
1
vote
1answer
56 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 ...
3
votes
1answer
45 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 ...
4
votes
2answers
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 ...
2
votes
1answer
34 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:
<...
6
votes
1answer
67 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 ...
1
vote
1answer
57 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 ...
1
vote
2answers
57 views
0
votes
0answers
30 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 ...
-1
votes
1answer
57 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 ...
1
vote
0answers
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 ...
4
votes
1answer
87 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 ...
1
vote
1answer
140 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 ...
0
votes
1answer
48 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 ...
0
votes
1answer
79 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(ε²) == ...
1
vote
0answers
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 ...
1
vote
0answers
58 views
What is the difference between NSolve and N[Solve] [closed]
N[Solve]
NSolve
I am getting different results everytime I use these commands.
2
votes
2answers
73 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'...
0
votes
0answers
50 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 ...
1
vote
0answers
39 views
How to eliminate a variable from coupled ODEs?
I found this question with an answer:
How to eliminate variables in ODE?
...
3
votes
3answers
56 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.
...
1
vote
1answer
105 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:
...
7
votes
2answers
136 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 ...
2
votes
3answers
124 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:
...
5
votes
4answers
191 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 ...
0
votes
0answers
39 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: <...
2
votes
2answers
90 views
How to Simplify expression efficiently inside Power
How can I simplify trivial expressions under the Power?
Here is one example:
(z2p-z2p z3)^-ϵ
...
2
votes
1answer
59 views
How to extract terms from equation, and then set each of them to 0?
I have a long equation, namely,
...
6
votes
1answer
68 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 ...
1
vote
2answers
67 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 ...
2
votes
3answers
121 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} ...
2
votes
1answer
58 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:
...
0
votes
0answers
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:
...
1
vote
2answers
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
...
0
votes
1answer
129 views
How can I obtain the matrices of coefficients of quadratic form?
I'm trying to find the matrices of coefficients of a quadratic form:
...
5
votes
1answer
124 views
How can I emulate Orderless attribute?
Suppose I want an expression to automatically sort its arguments. This can be done via
SetAttributes[f, Orderless]
f[3, 2, 1]
(*output is f[1, 2, 3]*)
Just as an ...
1
vote
0answers
42 views
Finding the domain in which a function is analytic with no imaginary part
I was wondering if it is easy to see if a given expression evaluates to a real number in a given domain? Let e.g. f(x,y,z) be some function depending on three ...
0
votes
1answer
84 views
How to check if an expression is real in some domain
I was wondering if it is easy to see if a given expression evaluates to a real number in a given domain? Let $f(x,y,z)$ be some function depending on three variables $x,y,z$. I would like to know if $...
2
votes
0answers
41 views
Define quaternions by properties instead of coordinates
I'd like to manipulate an expression of quaternions and only use the following properties
...
2
votes
1answer
84 views
Converting an equation to the form $ax+by=c$
I have a linear equation that comes as a result of applying orthogonality on a non-homogeneous boundary condition with two unknowns $C_1$ and $C_2$. Can someone help me to express this equation in the ...
4
votes
1answer
140 views
Simplifying the final coefficient expression of the solution to a Laplacian
I have been trying to solve a boundary value problem analytically which involves a three-dimensional temperature Laplacian over a parallelepiped. In the final step of my solution, using the two non-...
0
votes
0answers
41 views
Calculate density of states for 1D system
The density of states for a 1D system can be written as:
$D\left(\omega\right)=\frac{L}{\pi}\frac{1}{d\omega\left(k\right)/dk}$
I have some expressions for $\omega\left(k\right)$:
...
1
vote
2answers
45 views
Substituting values from an association thread into a table of expressions
I have asked a question here. Yet I am trying to do the same procedure with AssociationThread Suppose I have the following function which is a normal distribution:
<...
5
votes
1answer
47 views
Substituting elements of lists into an expression
Suppose I have the following lists,
as = {1, 2, 3, 4};
bs = {10, 20, 30, 40};
and the following expression:
...
2
votes
1answer
53 views
Crown a list of two sublists with ErrorBar without losing list structure
I have a list with two sublists of numbers, e.g.
Sigmaf = {{1,2,3},{3,4,5}};
... and I would like to crown each number with ...
5
votes
1answer
75 views
Split Expression Into Constant And Non-Constant Summands
I have a partially t-dependent matrix which I want to split into its t-dependent and its t-...
5
votes
2answers
181 views
Replace a randomly chosen part of an expression
Given an arbitrary Mathematica expression, how can I choose a random part of the expression and replace it with another symbol of my choosing?
For example, given $a x^3 +2y\cos(x)- \tanh(x^{y+3})/(x^...
1
vote
1answer
117 views
Fixed Point Iteration - Finding Iteration Functions
When we use Solve, it attempts to solve the system for the variables, for example
Solve[x^3 + 4 x^2 - 10 == 0, x]
If we want to use Fixed Point Iteration to ...
2
votes
1answer
71 views
Extracting coefficients from a sum of exponential functions
I'm dealing with a sum of exponential functions with different exponents
...
2
votes
1answer
33 views
Problem with recursive relations
Continuing the topic of my previous questions (link1 and link2), let me ask one more question.
I have problems with the following code:
...
0
votes
0answers
56 views
check if one expression can be transformed into another
My question is how to use Mathematica to check if one expression can be transformed into another:
Example 1:
$ax^2+bx+c$ into $K\cdot(x+\alpha)^2+\beta$, and then show me $K(a,b,c)$ and so on.
...