# Tag Info

## Hot answers tagged simplifying-expressions

6

FullSimplify[Cos[(i + j + k)*Pi], Assumptions -> Element[i + j + k, Integers], ComplexityFunction -> LeafCount] (-1)^(i + j + k) Simplify[Cos[t*Pi], Element[t, Integers]] /. t :> i + j + k (-1)^(i + j + k)

4

expr2 = Sum[(8^(-11 - 2 t) (22 + 4 t)!)/(t! (11 + t)! (11 +2 t)!) 1/(q + t), {t, 0, Infinity}] % /. q -> 32 FunctionExpand[%]

4

Maybe TimeConstraint is helpful: y = Gamma[1 - x] Gamma[x] Sin[Pi x] + Gamma[x] Gamma[1 - x] Sin[Pi (1 - x)]; FullSimplify[y, TimeConstraint -> 0.000001] FullSimplify[y, TimeConstraint -> 0.0001] FullSimplify[y, TimeConstraint -> 0.01] Gamma[1 - x] Gamma[x] Sin[π (1 - x)] + Gamma[1 - x] Gamma[x] Sin[π x] 2 Gamma[1 - x] Gamma[x] Sin[π x] 2 π

4

The only method I can think of that will use the built-in simplification routines is to snoop on transformations using either TransformationFunctions or ComplexityFunction. Unfortunately neither of these will be restricted to the entire expression therefore what is produced may not be usable. Nevertheless as an example: FullSimplify[Gamma[1 - x] Gamma[x] ...

4

Resolve[Exists[z, Abs[(Sqrt[1 + 2 z] - 2)/(2 z - 3)] > 1], Complexes] (* False ... after a few looong minutes *) Edit Slightly faster: Reduce[FullSimplify[Abs[(Sqrt[1 + 2 z] - 2)/(2 z - 3)]] <= 1, z, Complexes] Edit 2 Much faster: See that: FullSimplify[Abs[(Sqrt[1 + 2 z] - 2)/(2 z - 3)]] (* 1/Abs[2 + Sqrt[1 + 2 z]] *) So: ...

3

Element is not Listable, also, Positive is not valid domain so it is reasonable to me that it is not working. If you put the assumptions more carefully then everything is alright: Simplify[Cos[(i + j + k)*Pi], Element[{i, j, k}, Integers] && And @@ (# > 0 & /@ {i, j, k}), ComplexityFunction -> LeafCount] ...

3

I usually set up a wrapper function that transforms if input is valid and otherwise acts like Identity: pickyTransform[expr_] := 0 helper[expr_] /; ! AtomQ[expr] && FreeQ[expr, _?NumericQ] := pickyTransform[expr] helper[expr_] := expr FullSimplify[a^3 + x^y, TransformationFunctions -> {helper}] (* a^3 *) This works fine most of the time, but ...

2

Using FunctionExpand as suggested by Vladimir can improve the simplification, but for some inputs FunctionExpand is very slow in this case MeijerG is the one causing problems. By replacing all occurances of MeijerG with a temporary symbol it is possible to get improved results quicker: safeApply[f_, expr_, bad_List] := Module[{ badOnes = ...

2

I managed to teach Mathematica calculate the integral for arbitrary $n$, with a little aid: $$\int_0^L\rho(n,x)\ln(\rho(n,x))dx = (2/L)\int_{0}^{L}\sin^2(n\pi x/L)\ln\left[(2/L)\sin^2(n\pi x/L)\right]dx$$ Mathematica has trouble, apparently, handling all the parameters $(n,L,x)$, so I resort to the following substitution: \$n\pi x/L=u \Rightarrow (n\pi/L) ...

2

There is a simple Combine function , which in essence is just: Combine[x_] := Module[{combinet1, combinet2}, combinet2 = Together[ x /. Plus -> ( If[ FreeQ[{##}, _^_?Negative] && FreeQ[{##}, Rational], combinet1[##], Plus[##] ] &) ] /. combinet1 -> Plus] ...

1

While this won't work in general with very complicated expressions (see the other post for more general approaches), you could try simple replacement rules to get a reasonable degree of simplification. If you had only linear relations, that would work for sure. In the case of your 'toy' example expr = h (140 + Current - lastU1 + (lastV1 + 1/2 h (140 + ...

1

Another way is basically use the Mathematica's build in Head for all expressions. The following may seem less elegant but works for arbitrary number of summands: Cos[(intp[a]+intp[b]+intp[c]+intp[d])*Pi]/.Cos[(Plus[x__])*Pi]:>Hold[-1^x] /;SameQ@@((Head/@List@@x)~Join~{intp}) (* Hold[-1^(int[a]+int[b]+int[c]+int[d])] *) where intp is positive integer. ...

1

The problem is that though FullSimplify does its best to find as simple form as possible in a reasonable time, it's not smart enough to handle all possible cases (and, actually, that would be an undecidable problem in general). But your indentity seems to be well-known and compelling, so I would recommend to send it as a suggestion to support@wolfram.com.

1

By squaring both expressions and making some assumptions we can show them equal.. Simplify[ (Sqrt[L^2 M + Sqrt[L^2 (-J^2 + L^2 M^2)]]/Sqrt[2] )^2 == ( Sqrt[L]/2 (Sqrt[L M + J] + Sqrt[L M - J]))^2 , Assumptions -> { L > 0, M > Abs[J/L]}] (* True *) As near as I can tell under those ...

1

Are you sure that the first expression can be simplified to the second? o1 = Sqrt[L^2 M + Sqrt[L^2 (-J^2 + L^2 M^2)]]/Sqrt[2]; o2 = Sqrt[L]/2 (Sqrt[L M + J] + Sqrt[L M - J]); and ru = {L -> 5, M -> 2, J -> 3.}; Then just o1 /. ru o2 /. ru

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