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

learn more… | top users | synonyms

1
vote
1answer
72 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
78 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
345 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
87 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 ...
49
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
49 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
432 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
36 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
46 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
9k 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
96 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
84 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
509 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 ...
7
votes
1answer
105 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
81 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
54 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
77 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
359 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
159 views
0
votes
1answer
47 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
80 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
283 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
586 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
96 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 ...
4
votes
1answer
305 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 ...
21
votes
2answers
748 views

List of atomic expressions

I was surprised to see Graph objects are atomic. Is there a way (through documentation or programmatically) to find all atomic heads? The ones I know of are: ...
6
votes
1answer
180 views

First order approximation

How can I neglect higher orders of approximation in Mathematica? Suppose I want to find the roots of a simple quadratic equation like ...
17
votes
1answer
197 views

SeriesData sucks when it can. How do I keep SeriesData from sucking?

When I run Series[f[x]*Sin[x],{x,0,3}, Analytic->False] I get: f[x](x-x^3/3+O[x]^4) as expected. In ...
0
votes
0answers
108 views

More simplification tricks in Mathematica? [duplicate]

I need to simplify the following expression in order to operate on it using InverseLaplaceTransform. This result will be used in further work, so ideally I would ...
1
vote
1answer
49 views

Extract list of values associated with specific header within an expression

I would like to have a function that can extract from an expression a list of values that are within the brackets of a certain header at any level: ...
0
votes
1answer
52 views

Avoiding misconversion of data with ToExpression function [closed]

I've got a list of data with the following structure which can be easily converted To expresion by some manipulation such as ...
0
votes
1answer
42 views

Manipulating form of output redux [duplicate]

To clarify the question that I posted here, I have the following question: I am generating a very large term by the following: ...
4
votes
0answers
105 views

Simplest identity that cannot be proved by FullSimplify [closed]

Apparently, FullSimplify is not able to prove all true identities, but usually it does pretty well when it comes to elementary functions. I'd like to know what are ...
3
votes
1answer
148 views

What role to sub/superscripts play in Mathematica?

I'm not sure I understand the role of subscripts and superscripts in the Mathematica language. For me, the expression: ...
13
votes
1answer
278 views

ToExpression processing errors

Is their a way to get a more comprehensive return value when running ToExpression? For example when I run ...
6
votes
2answers
212 views

ReplaceAll problem

Bug introduced in 10.1 and persisting through 10.2 or later Confirmed, as bug, by WRI: [CASE:3402234] I am trying to combine terms of the type ...
21
votes
2answers
690 views

Given an exact formula, how can Mathematica find a probability distribution whose PDF matches it?

So, given some data, Mathematica 10.2 can now attempt to figure out what probability distribution might have produced it. Cool! But suppose that, instead of having data, we have something that is in ...
0
votes
0answers
61 views

Simplifying sums of rational trigonometric functions

After simplifying the trigonometric functions as advised before (cf. Simplifying Expressions for FindMinimum), I obtained a sum of 62 similar expressions, the first three as in the below: ...
4
votes
1answer
82 views

Returning all branches of a multiple-valued function

This question and answer was inspired by this closed as duplicate question. One possible definition of the n-th order root of x ...
0
votes
1answer
71 views

Extract all elements of an expression in order into a list [closed]

I have and expression a + b + c - d and I would like to generate a list of {a, +, b, +, c, -, d}. I have tried ...
4
votes
5answers
135 views

Assigning the numerical results of Minimize to variables [closed]

I need to use the numerical values returned by Minimize in further computations. Consider, ...
3
votes
1answer
286 views

Separating exponential terms

Suppose I have a lot of expressions multiplied by factors such as: $$e^{-i\theta[1]-i\theta[2] - i\theta[3]-i\theta[4]-i\theta[5]}$$ I would like to separate this into a product of exponentials of ...
2
votes
1answer
147 views

Select largest number using pattern

I have the following expression: myExpr=R[C[2],B].(II+R[C[3],C[2]].(II+R[C[4],C[3]])) I need to create a pattern which would replace the ...
-1
votes
4answers
107 views

Converting an expression to function [duplicate]

I have the following problem. I current can automatically create the variable positionPayload, for instance: ...
2
votes
1answer
115 views

Simplifying Expressions for FindMinimum

I am currently trying to apply the FindMinimum function to find the lowest energy of an expression. My current expression as of now is relatively complicated. It is the summation of 48 similar terms, ...