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

learn more… | top users | synonyms

4
votes
1answer
133 views

How to efficiently find all combinations of the letters in an alphabet given a condition

Problem: I want to find all unique expressions with n number of terms that contain all the digits (or characters) in alphabet. ...
9
votes
4answers
1k views

How to completely delete the head of a function expression

Is there any way to completely remove the head of an expression function? For example, how would I remove the head Cos from ...
3
votes
2answers
215 views

Is there a function in Mathematica which removes brackets wrapping an expression?

Is there a function in Mathematica which removes brackets from an expression? RemoveBrackets[ {3} ] 3 Note: inspired by @garej's answer to this question ...
9
votes
4answers
173 views

Evaluation of Alternatives

I recently stumbled upon a few examples that suggest patterns containing Alternatives do not evaluate for individual alternatives. For example: ...
2
votes
2answers
68 views

intermediate steps of simplification of algebraic expression without evaluation [closed]

I am using MMA do do some algebra and I need to do some simplification. For example, I have the following expression $$ x^2 \left( \frac{6 \left(2 c_1 x^6+c_2\right)}{x^4} \right)-x \left( 4 c_1 ...
1
vote
2answers
74 views

What's the easiest way to remove overall factors from polynomials?

I have code that outputs polynomials (in #1) such as the ones below (note that the trailing Function character ...
4
votes
1answer
137 views

How do I disable that Mathematica orders terms in lexicographic order?

I have matrices with entries where the order of the entries is important. Unfortunately Mathematica resorts terms in products in a lexicographic order. For example, ...
0
votes
1answer
44 views

Simple grouping equations [closed]

I'm new in the Mathematica world. A very basic question. I have been using the command Eliminate on a set of equations as follow: ...
0
votes
1answer
55 views

Eliminate variable on multiple equations [closed]

I'm pretty new with Mathematica. I have to perform a really simple operation, but I'm really struggling with that. I have a set of 4 equations, for example (they can also be more complex): $ AA = 2 ...
1
vote
1answer
33 views

Formatting the prime factorization of expressions

I have a series expansion in $x$ and $a,b$ are constants which I want to type in $LaTeX$. But the numbers/integers are pretty large (have a lot of digits) so it becomes a bit messy in $LaTeX$. ...
5
votes
1answer
62 views

Display position of expression as Tooltip

How could we display the position of any sub expression in an expression using Tooltip? This would be useful for example in order to locate the position of an ...
4
votes
2answers
47 views

Is it possible to match a sequence with multiple heads without using Condition

Suppose I have: expr = Times[2, a[x,r], a[y,1], c[z,0,0], d[w,m]]; If I want to match a sequence of expressions with the same head ...
3
votes
5answers
164 views
5
votes
1answer
69 views
1
vote
1answer
57 views

Is there some way to implement automatic TimeSeries extrapolation or series continuation?

I am working with a large number of TimeSeries of irregular length. This means that if I sum them, or compute the mean, it cuts off at the terminus of the shortest ...
5
votes
2answers
138 views

How to name a repeated pattern sequence inside Plus?

Here is a sample expression that contains a bunch of f and some other stuff: ...
0
votes
0answers
56 views

How do I use Replace All? [duplicate]

I have an expression: a + b 2^(1/2) + (c + d 2^(1/2))*I I want to replace each occurrence of 2^(1/2) with ...
6
votes
3answers
82 views

How to organize expression by symbols (like Collect), but apply different functions to each coefficient

I want to mimic the functionality of Collect[expr, {vars}, func], but with the following modification: The function f that is ...
0
votes
0answers
35 views

Replace function and its derivatives [duplicate]

When I have a complicated expression that depends on some variable, say, $f$, the following usually works ok: Expression ./ { f-> x^2 } But if $f$ is a ...
0
votes
1answer
37 views

Solving a trigonometric equation for all $x$ using constant coefficients

I want to find the coefficients $a$, $b$, $c$, etc. that make an equation like $a+bx=x$ true for all $x$, but for trigonometric functions of $x$. For example ...
1
vote
1answer
44 views

Count number of summands?

Consider fun = a+b+c+d/e If we want to get the number of summands, we can use Length[fun], which properly gives ...
1
vote
1answer
64 views

Extract coefficients from trigonometric polynomial [closed]

Suppose I have: f[r_, ϕ_] = C1 Cos[ϕ]r + C3 Sin[3 ϕ] r + C4 Sin[4 ϕ] r^4; How do I extract the coefficient of a chosen trigonometric term, let's say ...
0
votes
1answer
50 views

Misunderstanding of Replace code

I am looking for the right way to replace $\delta \, \, \text{by} \, \, 0.05 \, \, \, \beta \, \, \, \text{by} \, \, \, 1.77 \, \, \, \text{and} \, \, \, n \, \, \, \text{by} \, \, \, 12$ in this ...
6
votes
1answer
304 views

Using FunctionExpand to evaluate symbolic derivatives

Some symbolic derivatives of certain special functions are not expanded automatically, but FunctionExpand often helps to get a derivative-free closed form ...
2
votes
2answers
68 views

How to update values of nested association using AssociateTo?

Saying we have an association: asc = <|"A" -> <|"a" -> 1, "b" -> 2, "c" -> 3|>|>; I want to updated values of ...
48
votes
2answers
1k views

Head and everything except Head?

I have been working on picking expressions apart using Head and Part and encountered a little mystery. Consider the canonical ...
0
votes
1answer
48 views

How can I prevent exponents from appearing in an expression?

I've found posts dealing with showing/hiding exponents for numbers, like in scientific notation. But what if I have a general expression? I have an expression like this, ...
7
votes
2answers
374 views

Summa package problem

I need to use the features of the Summa package but it doesn't work in Mathematica 9. It gives the error Cannot open Utilities`FilterOptions` My question is: ...
1
vote
0answers
33 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 ...
2
votes
1answer
40 views

How to label outputs from Print [closed]

I have problem with Print in Mathematica. The data that I get from it, is not labelled so that I can use it elsewhere, therefore I have got to label them manually. ...
26
votes
3answers
8k views

Is it possible to change the color of plot in Show?

For example: p = Plot[Sin[x], {x, 0, 1}] Is it possible to write options in Show to change the curve's color for example into ...
5
votes
2answers
84 views

Extracting factors from an expression

I want to transform expressions into lists of elements. For example, b*c + a*b*c /. Plus -> List /. Times -> List ...
7
votes
1answer
75 views

Separate integer fractions from variables?

Whenever I write a rational number times a variable, i.e.: (2/3)a the result Mathematica displays looks very cringeworthy: $$\frac{2a}{3}$$ I would prefer ...
10
votes
7answers
495 views

How to replace the first Head of a currying expression like “a” in a[b,c][d]?

How do we replace the first Head of a currying expression such as a[b,c][d]? When accessing the ...
6
votes
1answer
96 views

When is the righthand side of a RuleDelayed evaluated?

The documentation on RuleDelayed states that lhs :> rhs represents a rule that transforms lhs to rhs, evaluating rhs only after the rule is used. Consider the following rule: ...
5
votes
1answer
79 views

The role of comma in the syntax of `Part`

I can't understand the syntax of Part, namely what does , do. The documentation says that ...
1
vote
1answer
51 views

Replacing product of functions wih another function

I have a function which depends on w,x,y,z. Let me call ...
4
votes
1answer
59 views

ToExpression to Latex Parenthesis

Everytime I use ToExpression to transform a TeX expression into mathematica input form, Mathematica always interprets parenthesis ('(' and ')') as square brackets, ...
10
votes
2answers
351 views

Get rational and irrational parts

Consider an expression of the form $a + b \sqrt{2}$, where $a,b \in \mathbb{Q}$. How can I extract $b$ (or equivalently $a$) from this expression?
0
votes
0answers
45 views

Prevent `Plus` from reordering terms by default? [duplicate]

Writing Plus[a,b]//FullForm gives back Plus[a,b], while Plus[b,a]//FullForm again returns ...
1
vote
1answer
150 views
0
votes
1answer
38 views

Get dominant terms in asymptotic expansion

I'd like to find the dominant terms of an expression given the conditions $x,y >> 1$: $c_0 y+\frac{y^2 \left(4 c_0^2 y - 12 c_1 c_2^2+y^2\right)}{24 x^2 \left(\text{c1}^2+\text{c2}^2+y\right)}$ ...
1
vote
1answer
78 views

Can I map a function over a sequence of arguments without making the arguments into a list first?

I would like to set evenFunction[f_][a_, b_, c_, ...] = f[Abs[a], Abs[b], Abs[c], ...] I have come up with two ways to do this so far. Use pure functions ...
2
votes
1answer
144 views

Factoring out a common term

Very simple question, but I can't find a simple answer here or in the documentation. I have an expression: qq = a x + b x^2 + c x^3 and wish to factor out a ...
8
votes
4answers
544 views

Counting multiplications (complexity function)

I'm trying to count the number of times multiplication appears in an expression (for the purpose of constructing a ComplexityFunction that would help me simplify a terrible algebraic expression for ...
2
votes
2answers
90 views

How to neglect some part of an expression

I have an expression of the form $a\,x^3 + b\,x^2 + c\,x$ in my answer. I want to avoid those terms in my answer of order 1, but want to keep those of order > 1 in $x$. Can you suggest how to do in ...
3
votes
1answer
275 views

Derivatives of functions with arbitrary number of variables?

I am trying to define a function f[x1,x2,...,xn] with n integer but not specified. And then I would like this funktion to behave ...