Questions tagged [expression-manipulation]

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

57 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
11
votes
0answers
104 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 ...
5
votes
0answers
231 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 ...
3
votes
0answers
87 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 ...
3
votes
0answers
54 views

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

Consider the following expression: ...
3
votes
0answers
265 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))] (* + ...*) ...
3
votes
0answers
125 views

Check an Option without Evaluation

Consider the following: ...
3
votes
0answers
106 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 ...
2
votes
0answers
37 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
0answers
27 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 ...
2
votes
0answers
54 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. ...
2
votes
0answers
52 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] ...
2
votes
0answers
129 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 ...
2
votes
0answers
63 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: ...
2
votes
0answers
59 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, ...
2
votes
0answers
231 views

Derivative of vector dot product with respect to a vector

I have the expression: Transpose[gvecI, {2, 1}].x (m[1] + m[2]) gvecI and x are [3x1] ...
2
votes
0answers
98 views

TrigExpand Idiosyncracies

TrigExpand[Sin[x]^2 Log[y]] returns sin^2(x) log(y), as one would expect. However, ...
1
vote
0answers
41 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 ...
1
vote
0answers
49 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 ...
1
vote
1answer
44 views

Optimizing an equation - show the length of an equation, including operators

A simple, but I think useful question to know the answer for. How can I quickly count the length in my equation, including +,-, and so on? For example, $x^2+1$ has a length of 4.
1
vote
0answers
28 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}+...
1
vote
0answers
55 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!
1
vote
0answers
38 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 ...
1
vote
0answers
52 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. ...
1
vote
0answers
71 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} ] ...
1
vote
0answers
100 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 ...
1
vote
0answers
48 views

Do replacement only on certain specific forms

If I want to replace, say, a with a1 + a2 in an expression, I can write ...
1
vote
0answers
62 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 ...
1
vote
0answers
146 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, ...
1
vote
0answers
152 views

Showing Cosh(I x) and Sinh (I x) rather than cosx and sinx?

The following code gives a function expressed in terms of sines and cosines. How to get the analogous with sinh and cosh, coming from the identities: sinx=sinh(Ix)/I and cosx=cosh(Ix)? ...
1
vote
0answers
192 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 $\...
1
vote
0answers
189 views

How to invert an Elliptic function where the elliptic nome is a function of an independent variable?

I have a Jacobian elliptic function as a function of two independent variables $x$ and $y$. The elliptic parameter $m=m(y)$, $0 \leq m \leq 1$, is also a function of the variable $y$, and thus the ...
1
vote
0answers
86 views

How can PowerExpand be made to evaluate the ArcTan form that takes two arguments?

Consider c = Cos[phi]; s = Sin[phi]; ArcTan[c, s] // PowerExpand ArcTan[s/c] // PowerExpand which yields ...
1
vote
0answers
50 views

Factoring rationals from equation based on digit complexity?

Consider an equation of the following type: ( poly = (3 x)/35 + (6 y)/7 ) == 0 If we apply the command Factor to this ...
1
vote
0answers
60 views

Matching Root[…] objects with patterns, unexpected hidden argument

I needed to write patterns that could distinguish between arbitrary-function and polynomial forms of Root objects, for example, ...
0
votes
0answers
32 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)$: ...
0
votes
0answers
54 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. ...
0
votes
0answers
32 views

Expanding complex expression and replacing variables in the result

When I'm finished expanding my expression I would like the result to be expressed again in terms of the original variables (like α, S1, T1, T2). I've tried replace, ...
0
votes
0answers
38 views

Rearranging expressions by DragAndDrop

I see that the DragAndDrop option for editing is not supported anymore. However, I think this could be a really useful feature, for instance to rearrange the terms of an expression in the form we ...
0
votes
0answers
18 views

Comparing fractions by using partial fractions or a specific factorisation?

Trying to reproduce the results of a paper I had to solve a difficult integral. I obtain: \begin{equation} A=-N\left ( \epsilon r+\log(1+r) +\frac{rx^2(1-r\tau + \tau r^2 (\tau +1))}{1+r}+\frac{ry^2(-...
0
votes
0answers
20 views

Evaluating meta expressions of (partial) derivatives

I have created some meta expressions for many derivative calculations such as ...
0
votes
1answer
77 views

Transform rational equations to polynomial equations

I have a list of rational equations and I would like to convert it to a list of polynomial equations. I know that none of the variables and none of the denominators could ever be 0. So far I have ...
0
votes
0answers
42 views

Wrong derivative for a function that I try to define without explicitly giving number of variables

What I actually want is to define functions depending on the number of variables which will be specified during some computation. My (probably wrong) attempt is ...
0
votes
0answers
59 views

How to use replace for only one term in a long expression in Mathematica?

I am doing some Cauchy integration and in some intermediate steps I have something that looks like that: (..many_terms...+I*\epsilon(k1-p1))/k1 where ...
0
votes
0answers
59 views

How to show the sign of an algebraic expression?

I defined a long expression ...
0
votes
0answers
66 views

How to solve a Poisson's differential equation with a boundary condition at infinity?

Context: This question is relevant to the physical problem of calculating potential for a set of p-n-p junctions. We have to solve a Poisson's differential equation for a p-n-p junction with ...
0
votes
0answers
42 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: ...
0
votes
0answers
46 views

How to use === with condition?

I have two expressions, and they are same when k is positive and x is non-zero real number. Below code gives me ...
0
votes
0answers
56 views

Assume Symbolic Elements as Scalars in Distribute

So yesterday I asked about TensorExpand but it turns out that it is way too slow for my needs. I want Mathematica to know that my symbolic variables are scalars, so I don't have the parentheses in my ...
0
votes
0answers
48 views

Proving $d(dx)=d^2x$

Is it possible to carry out the following differential in Mathematica? $$d(dx) = d^2x$$ I tried to write: Dt[1*Dt[x]] the result is: ...