Tag Info

Hot answers tagged simplifying-expressions

12

This is not a bug; it is an implicit representation of the domain. Note that condition $1-x^3 \neq 0$ cannot be simplified further over the complexes or, at least, Reduce doesn't simplify it further: Reduce[1 - x^3 != 0, x, Reals] (* Out: x < 1 || x > 1 *) Reduce[1 - x^3 != 0, x, Complexes] (* Out: -1 + x^3 != 0 *) A similar thing can happen ...

7

This is an example related to limitations of standard symbolic capabilities of Mathematica, there are many similar issues ( usually they come from arbitrary choices of branches of complex functions), see e.g. analogous problems Why does Integrate declare a convergent integral divergent? or Bug in mathematica analytic integration?. Functions like Log and ...

7

An alternative method to WReach's method is to use SparseArrayExpressionToTree which produces the same output without string wrappers: expr = a[b[c, d[e][f], g], h]; ett = SparseArrayExpressionToTree[expr] (* {{a,0,a[b[c,d[e][f],g],h]}->{b,1,b[c,d[e][f],g]}, {b,1,b[c,d[e][f],g]}->{c,2,c}, {b,1,b[c,d[e][f],g]}->{d[e],3,d[e][f]}, ...

6

The problem is that b^(1/3) has three roots. You are choosing the real root, -(3/2^(2/3)), while Mathematica is choosing, (3 (-1)^(1/3))/2^(2/3) which is complex. To get the result you want, rewrite your expressions for Y and Z like this: Y = 12 Q/ Sqrt[A (2 - (3 2^(1/3) a)/Surd[Sqrt[b^2 - 4 c^3] + b, 3] - Surd[Sqrt[b^2 - 4 ...

4

One way to do something similar is to use rules instead of using equals. rules = {Cos[t] -> a, Sin[t] -> b} 2 Cos[t]^2 + 3 Sin[t] //. rules 2 a^2 + 3 b

4

Although kguler posted an answer using a nice internal function that does this (almost) directly I find this kind of expression manipulation interesting in itself so I'm going to see what can be done without it. expr = a[b[c, d[e][f], g], h]; edges = Reap[Replace[expr, h_[___, c_[___] | c_?AtomQ, ___] /; Sow[h -> c] :> 1, {0, -1}]][[2, 1]]; ...

3

Please check the result by doing the following eqn = FullSimplify[ 2*a*b*n*c*Q - 3*a*b*n*p*c*Q + a*b*n*p^2*c*Q - 4*a^2*b*n*p*Q^2 - 4*a*b^2*n*p*Q^2 + 6*a^2*b*n*p^2*Q^2 + 6*a*b^2*n*p^2*Q^2 - 2*a^2*b*n*p^3*Q^2 - 2*a*b^2*n*p^3*Q^2 + a^2*b*c*Q^2 + a*b^2*c*Q^2 - 2*a^2*b*p*c*Q^2 - 2*a*b^2*p*c*Q^2 == 0] // TraditionalForm This returns ...

3

You can use ExpandNumerator and ExpandDenominator in conjunction with Together. ExpandDenominator@Together[1/(2 x + 7) - 4/(x + 2)] (* (-26 - 7 x)/(14 + 11 x + 2 x^2) *)

3

There are two problems. One is that you want SolveAlways to find values for the parameters for which the expressions are equivalent. The second is that, as stated, it's not possible because the system is overdetermined. You'll want to allow for a constant term in your second expression. expr1 = -0.433284 - 0.758719 x + 0.00289158 x^2 - 0.443672 y + ...

3

Use Assuming[a > 0, a^2 + b^2 + 2 a b // FullSimplify] or a^2 + b^2 + 2 a b // FullSimplify[#, a > 0] &

2

One way to do that is as follow: Unprotect[Cos, Sin]; Cos[t_] = a; Sin[t_] = b; c = 2*Cos[t] + Sin[t]^2 (*2 a + b^2*) But be careful if you are going to use Cos or Sin to do calculations. they will return a and b.

2

How about this? ArcTan[Simplify[TrigExpand[Tan[5 ArcTan[a] + ArcTan[b]]]]] Could save yourself some work! Explanation: The trick here is to understand the identity you mentioned is about Tan, not ArcTan: Tan[x+y] = (Tan[x]+Tan[y])/(1 -Tan[x]Tan[y]). TrigExpand does the above type of expansion for trig functions. Replace x and y with ArcTan[a] and ...

2

Kxx1 = -((\[Pi]^2 (x - x0) Cosh[\[Pi] (x - x0)])/(2 (-Cos[\[Pi] (y - y0)] + Cosh[\[Pi] (x - x0)]))) + (\[Pi]^2 (x - x0) Cosh[\[Pi] (x - x0)])/(2 (-Cos[\[Pi] (-1 + y + y0)] + Cosh[\[Pi] (x - x0)])) + (\[Pi]^2 (x - x0) Sinh[\[Pi] (x - x0)]^2)/(2 (-Cos[\[Pi] (y - y0)] + Cosh[\[Pi] (x - x0)])^2) - ...

2

Others are certainly correct in pointing out that (x^3)^(1/3) is only equal to x under certain circumstances. But if you know that, and just want to simplify while assuming that x is positive, then just use PowerExpand PowerExpand[(x^3)^(1/3)] (* x *) PowerExpand[(x^3 y^3 z)^(1/3)] (* x y z^(1/3) *)

2

Well, it's not generally true. For example: ((-1)^3)^(1/3) N[%] (* Out: (-1)^(1/3) 0.5 + 0.866025 I *) I suppose you could do FullSimplify[(x^3 y^3 z)^(1/3), Assumptions -> {x > 0, y > 0, z > 0}] (* Out: x y z^(1/3) *)

1

It's really simple. Just use Together. f1 = 1/x; f2 = x/(x^2 - 1); f1 + f2 1/x + x/(-1 + x^2) Together[f1 + f2] (-1 + 2 x^2)/(x (-1 + x^2))

1

I'm afraid there's no simple way or shortcut to properly implement tensor symmetries. Manual rules that move indices might work in simple situations, but inevitably fall short when dealing with more complicated symmetries, more indices, or bigger contractions. That being said, we can take @Szabolcs' cue and rewrite everything in terms of the (as of ...

1

Maybe this type of visualization will help understand the evaluation order better. Things are printed in InputForm here, but please "think" FullForm when you look at expressions. In[2]:= On[] Plus[3^3,6*9] Off[] During evaluation of In[2]:= On::trace: On[] --> Null. >> During evaluation of In[2]:= Power::trace: 3^3 --> 27. >> During ...

1

This particular problem can dealt with algebraically by completing squares, equating coefficients and subtracting constants. (I am making the assumptions this is a left hand side whose right hand side is 0). pol = -0.433284 - 0.758719 x + 0.00289158 x^2 - 0.443672 y + 0.00149027 y^2; cr = CoefficientRules[pol, {x, y}] {p, q, r, s, t} = cr[[All, 2]]; {h, ...

1

How about: 5 ArcTan[a] + ArcTan[b] /. {(m_Integer: 1) ArcTan[a_] + (n_Integer: 1) ArcTan[b_] /; Positive[m] && Positive[n] :> With[{min = Min[m, n]}, (m - min) ArcTan[a] + (n - min) ArcTan[b] + min ArcTan[(a + b)/(1 - ab)]]} (* 4 ArcTan[a] + ArcTan[(a + b)/(1 - ab)] *) Works on positive integral coefficients, which is how I read ...

1

e[k_, t_] := Cos[Pi (k - 1) t]; cosIntRaw[k_, l_, m_] := Integrate[e[k, t] e[l, t] e[m, t], {t, 0, 1}]; cosIntRaw[k, l, m] // Simplify -((Sin[(k - l - m)*Pi]/ (1 + k - l - m) + Sin[(k + l - m)*Pi]/ (-1 + k + l - m) + Sin[(k - l + m)*Pi]/ (-1 + k - l + m) + Sin[(k + l + ...

Only top voted, non community-wiki answers of a minimum length are eligible