Skip to main content

Questions tagged [expression-manipulation]

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

89 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
11 votes
0 answers
132 views

Eliminate variable with partially documented Solve feature Solve[eqns,vars,elims]. Robust?

The Eliminating Variables section on Manipulating Equations and Inequalities documentation quotes an otherwise undocumented feature for Solve ...
rhermans's user avatar
  • 37k
11 votes
0 answers
114 views

Why does the kernel quit if I want to use minus a sum that I converted from a list?

Using Mathematica 11 when I define a list yy = {x*43, 32*y}; and then convert it to a sum yy[[0]] = Plus; yy I get, as ...
jak's user avatar
  • 950
6 votes
0 answers
260 views

Why doesn't Log[Gamma[]] simplify to LogGamma[] where it could?

I have been playing with various equations involving amount of permutations in relatively large sets. Easiest way to look at these is something like Log[10, bignumber!] . Often expressions, even ...
kirma's user avatar
  • 19.1k
3 votes
0 answers
398 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 ...
Hell stormer's user avatar
3 votes
0 answers
184 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
3 votes
0 answers
121 views

Select certain term containing some patterns and confusing pattern Alternatives in FreeQ

I am considering a function termsContain[func_,list_] which select in an expression func the terms containing the ones in the ...
XiaoaiX's user avatar
  • 397
3 votes
0 answers
62 views

How to find where in a large expression Power::infy is generated?

Consider the following expression: ...
Ruslan's user avatar
  • 7,182
3 votes
0 answers
377 views

Bringing rational functions to canonical form

I have a complicated expression, which among other things has stuff like functions of rational functions: expr = f[x/(-x^2 + y)] + f[-(x/(x^2 - y))] (* + ...*) ...
QuantumDot's user avatar
  • 19.7k
3 votes
0 answers
362 views

Force expression in certain form

Is there a function in Mathematica to force an expression to be transformed into a given form. For example f[x] is a function of ...
tmlen's user avatar
  • 131
3 votes
0 answers
133 views

Check an Option without Evaluation

Consider the following: ...
Mark Messa's user avatar
3 votes
0 answers
114 views

How to combine DifferenceRoot objects for odd and even-indexed terms

I'm trying to analyze a certain infinite sequence $S$, indexed by positive integers starting from $1$. It can be split into two subsequences: $S^{odd}$ by removing all even-indexed elements and ...
Vladimir Reshetnikov's user avatar
3 votes
0 answers
100 views

Why do I need to generalize/parameterize an integral sometimes to get a closed form result?

...
Vladimir Reshetnikov's user avatar
2 votes
0 answers
95 views

Don't simplify integer square roots

How can I rewrite an expression like $\frac{1}{2\sqrt{3}}$ as $\frac{1}{\sqrt{12}}$? This works in principle, but gets immediately simplified back to the original expression ...
infinitezero's user avatar
  • 1,441
2 votes
0 answers
52 views

Define quaternions by properties instead of coordinates

I'd like to manipulate an expression of quaternions and only use the following properties ...
deepfloe's user avatar
  • 201
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,651
2 votes
0 answers
147 views

General rule to rewrite function and argument into a new symbol

I am trying to convert Mathematica output into equations I can plug into C. I am presently trying to convert expressions of the form Derivative[1,0,0][f][t,x,y] ...
physics_researcher's user avatar
2 votes
0 answers
175 views

Substitution of expressions using Groebner basis

I know this topic came up numerous times (most of the results are detailed in the comments of this link Is there a way to to substitute for symbols, simplify, and back-substitute?). However, I have ...
kowalski's user avatar
  • 375
2 votes
0 answers
108 views

Manipulating Equations: Substracting two equations

I was wondering why I fail to substract two equations using thread, while it works properly, as described here for additions. Example: Let a system of equations be given: ...
Paul Saturday's user avatar
2 votes
0 answers
72 views

Generating a list of 4-digit integers by simulating four dice being thrown eight times

I simulate throwing four dice and merge their values together to form a 4-digit number. This is done eight times and I want to get a list like this one: ...
beemen's user avatar
  • 193
2 votes
0 answers
78 views

Create Association from Expression

I have a set of algebraic expressions of a certain form, and I would like to make them into Associations in a specified way. My expressions are formed of two heads, ...
Jojo's user avatar
  • 1,278
2 votes
0 answers
270 views

ReplaceAll and derivatives

I have the following coming from a computation, $$h_1 (u,v,w) = \frac{1}{v}\partial_v g(u,v,w)$$ and in Mathematica I have different quantities in terms of $h_1$ and its derivatives like $\...
Oscar's user avatar
  • 203
2 votes
0 answers
109 views

TrigExpand Idiosyncracies

TrigExpand[Sin[x]^2 Log[y]] returns sin^2(x) log(y), as one would expect. However, ...
bbgodfrey's user avatar
  • 62k
2 votes
1 answer
155 views

Problems with 'DumpSave' and 'Save' in Mathematica 13.1 on Windows 11

My Mathematica 13.1 crashes when I try to see the result of 'Save' for some very long expressions, and produces short DumpSave files which when clicked on contain only Null. I have a system ...
florin's user avatar
  • 1,982
1 vote
0 answers
37 views

Replacing an expression with pre-defined function

I am asking Mathematica to do a long calculation with functions I am defining at the beginning of the script. Because the resulting expressions are long, I want to replace them with the functions I ...
emir sezik's user avatar
1 vote
0 answers
59 views

Putting a polynomial into a multilinear form

Consider the polynomials in $x$ with positive-integer parameters $a,b,c$ ...
PalmTopTigerMO's user avatar
1 vote
0 answers
45 views

Simplify argument of Logs

I have the following expression ...
BabaYaga's user avatar
  • 1,897
1 vote
0 answers
43 views

Evaluate coefficients of delta functions in a given expression

Suppose that I have a function of the form: myfn[x_] = smoothfn[x] + A[x] DiracDelta[x-x0] + B[x] DiracDelta'[x-x0], where ...
Patrick.B's user avatar
  • 1,533
1 vote
0 answers
48 views

Generalizing Collect

Collect only seems to work with Times and Plus. How can we generalize ...
userrandrand's user avatar
  • 5,957
1 vote
0 answers
28 views

How to attach Upvalues to CompoundExpression?

I'm trying to make something like this work: Evaluating someData // Query[whatever...] /* summarizeInPrettyWay /* promptToRemoveCompoundExpression ; should produce ...
joka's user avatar
  • 342
1 vote
0 answers
37 views

Replace subexpression with variable in result from Laplace transform

I'd like to clean up the result I obtained from an inverse Laplace transform: First of all, I'd like to replace the square root expressions in the hyperbolic function arguments (part encircled in ...
Hans's user avatar
  • 11
1 vote
0 answers
30 views

TreePosition with multiple (not just node data) conditions

Given a Tree object, TreePosition takes patterns only on the "data" of the node plus a level spec. ...
user5601's user avatar
  • 3,780
1 vote
0 answers
79 views

Can one collect with respect to two groups of variables?

Here is a toy example of what I want: given ...
მამუკა ჯიბლაძე's user avatar
1 vote
0 answers
108 views

Same displayed expressions produce different outputs

I know EngineeringForm is a wrapper which prevents evaluation of content, but pasting chunks of other cells with an EngineeringForm number, got these two simple expressions w/ the same input ...
Fernando's user avatar
1 vote
0 answers
166 views

How to make a function in terms of constants to inherit the attribute of being constant

I have defined two variables a and b: SetAttributes[a, Constant]; SetAtributes[b, Constant]; I have defined a function c as ...
Alex97's user avatar
  • 420
1 vote
0 answers
181 views

Extracting expressions from LHS of an assignment

I need to list all variables in a notebook containing several Set assignments, lhs=rhs, and equations, ...
Robert's user avatar
  • 435
1 vote
0 answers
80 views

Coefficient works on $\pi$, $x$ and $x^2$, but not on $\pi ^2$

Consider (\[Pi] + 2 \[Pi]^2 + 3 x + 4 x^2) Executing ...
ThunderBiggi's user avatar
  • 1,205
1 vote
0 answers
62 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 ...
cesss's user avatar
  • 313
1 vote
0 answers
47 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 ...
apt45's user avatar
  • 1,658
1 vote
0 answers
39 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 ...
aresnick's user avatar
  • 111
1 vote
0 answers
48 views

How to eliminate a variable from coupled ODEs?

I found this question with an answer: How to eliminate variables in ODE? ...
LGB's user avatar
  • 11
1 vote
0 answers
69 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 ...
CAF's user avatar
  • 510
1 vote
0 answers
96 views

Fast way to apply permutations in large list?

I have one Polynomial in the form of FF[x1,x2,x3,x4,x5,x6,x7,x8], where xi pick numbers from ...
Xuemei's user avatar
  • 1,648
1 vote
0 answers
33 views

Lexicographical Search and Conjugate

I bid you a good day. I want Mathematica to plug this assumed solution into the left hand side of a differential equation. Then collect terms of powers of $\alpha$. $\psi (x,y)=\alpha f_1(y)e^{i x}+...
Carlos Villeda's user avatar
1 vote
0 answers
63 views

Finding a selected expression

How can I find all expressions matching the one I am selecting? This features exists in Matlab and is quite helpful: Just trying to make my debugging easier. Thanks!
MathematicaUser's user avatar
1 vote
0 answers
93 views

Canceling factors from numerator and denominator with complex number

I have the following expression: $\text{expr} = i \frac{\sqrt{a-b}}{\sqrt{b-a}}x$. Clearly simplifying expression gives $\text{expr}=x$ by cancelling the numerator and denominator. However, I am not ...
abhijit975's user avatar
1 vote
0 answers
61 views

How can I force the output of a computation to be as compact as possible, yet complete, by using functions?

I am computing some derivatives in Wolfram Mathematica 11.3. The functions that I have to differentiate (with respect to the state variables) are the equations of motion of a rocket in the atmosphere. ...
Boris Benedikter's user avatar
1 vote
0 answers
223 views

how to sort an expression with descending coefficients?

I have an expression for example psi = 0.24 FF1[0] FF2[1] FF3[-1] + 0.23 FF1[0] FF2[0] FF3[1] + 0.5 FF1[1] FF2[0] FF3[1] + 0.25 FF1[1] FF2[1] FF3[1] I wonder how ...
Xuemei's user avatar
  • 1,648
1 vote
0 answers
51 views

Do replacement only on certain specific forms

If I want to replace, say, a with a1 + a2 in an expression, I can write ...
usumdelphini's user avatar
1 vote
0 answers
72 views

Collect/Expand with D

I am new to MMA and have a basic question. I am trying to separate the derivatives of an expression for simplification. E.g. on doing ...
DuaneAllman's user avatar
1 vote
0 answers
171 views

Split expression into nested list of summands, times and dot products

In order to avoid the XY Problem we might have encountered in another question I asked, here I ask a new question with full context: I want to get a list representation of an expanded expression, ...
infinitezero's user avatar
  • 1,441