# Tag Info

## New answers tagged simplifying-expressions

3

From Daniel Lichtblau's answer, Working with symmetric polynomials, it's easy to do as much as is specified. I interpret "factor" to mean "write in terms of," but I'm not sure exactly what quadratic terms are implied. subs = {q1 -> (k12^2 - k21^2), q2 -> (k22 - k11)^2, q3 -> (k12 + k21)^2}; polys = Subtract @@@ subs; gb = GroebnerBasis[polys, {x, ...

3

You can also make StandardForm handle this case the way TraditionalForm does, and ensure all other expressions are formatted as StandardForm normally does them. You might like that if you don't have TraditionalForm notation for special functions memorized. Besides that this is an instructive example that you can read here.

0

You could use ComplexExpand as an intermediate step (that assumes all symbols are real). FullSimplify[Conjugate@ComplexExpand[F1[r, ϕ]], Element[_Symbol, Reals]] (E^(-(r^2/ 2)) (-Sin[β] + r^2 (Cos[α - 2 ϕ] + Sin[β] - I Cos[β] Sin[α - 2 ϕ])))/Sqrt[2 π] but the star notation you are using is puzzling - it doesn't seem ...

12

It is not Simplify that changes b-a to -a+b. It happens automatically, and it cannot generally be prevented except by using Hold or HoldForm which will make it impossible to use the expression for calculations (until you remove the Hold wrapper again). But while you can't prevent changing b-a to -a+b internally, you can change how it will be displayed on ...

0

I think HornerForm as a wrapper will do what you're after... HornerForm[Simplify[a - b]]

2

You cannot use Except in $Assumptions like you do. Just use ComplexExpand which assumes that are variables are real. E.g.: conj = TrigToExp@ComplexExpand@Conjugate@# &; Then conj[ Exp[-I*a]*a + Exp[-I*b]*b ] gives a*E^(I*a) + b*E^(I*b) 1 What Simplify does is not very well defined. It tries to put expressions in a simpler form, but what is usefully simpler is both subjective and depends on the context. Simplify aims for "smaller" expressions, for some definition of smaller. Because of the nature of this function the user doesn't have a lot of control over what it does (though it does ... 1 As was the case for your previous (and also downvoted) question, there might be a problem of over-determination. I count eight parameters ($\alpha$,$\beta$,$\gamma$,$\Theta_{12}$,$\theta_1$,$\theta_2$,$\phi_1$and$\phi_2$) but 12 relationships between them, several of which probably do not have unique solutions, being trigonometric relationships. ... 3 Assuming there's not a typo in your question, it's doing exactly what it should, meaning perhaps your equation or its entry is incorrect. Using a simplify wrapper: fs[a_] := FullSimplify[a, 0 < r < 1 && r ∈ Reals] I applied it to the blocks of your equation as follows: s1 = fs[4* Pi*(-(r*(1 + r)^2* Sqrt[-(((1 + r)^4 + (-1 + ... 2 Simplify[Sqrt[(a - Sqrt[a^2 - b]) (a + Sqrt[a^2 - b])], Assumptions -> (a > 0 && 0 <= b <= a^2)] Sqrt[b] I found what assumptions to use by evaluating Reduce[Sqrt[a - Sqrt[a^2 - b]]*Sqrt[a + Sqrt[a^2 - b]] == Sqrt[b], {a, b}, Reals] (a == 0 && b == 0) || (a > 0 && 0 <= b <= a^2) 0 The documentation states that: Assuming affects the default assumptions for all functions that have an Assumptions option. Since ComplexExpand does not have an Assumptions option, it does not use the assumptions you specified in Assuming. 0 Given: expr = Cos[2 B g t] Sin[u]^2 - I Sin[2 B g t] Sin[u]^2 ... one approach is: FullSimplify[expr, ExcludedForms -> {Cos[_], Sin[_]}] (Cos[2 B g t] - I Sin[2 B g t]) Sin[u]^2 Another approach worth exploring is to use a custom ComplexityFunction, as per: FF[ee_] := 1000 Count[ee, _Exp, {0, Infinity}] + LeafCount[ee] FullSimplify[expr, ... 2 This can be accomplished by dynamically analyzing the expression and generating the explicit assumptions from the given assumptions pattern. ClearAll[psimp, psimpStep, ptn2explicit]; ptn2explicit[expr_, pattern_List, RHS_] := With[{cases = Cases[expr, #, {0,Infinity}, Heads -> True] & /@ pattern, ruleLHS = {___, #, ___} & /@ pattern, ... 2 One possibility is to execute your entire code in some dynamic environment, where certain simplification rules are permanently or temporarily blocked. Here is the generic environment generator: ClearAll[withBlockedSymbols]; withBlockedSymbols[syms : {__Symbol}] := Function[code, Block[syms, code], HoldAll]; We can now produce an environment generator ... 0 I am not sure if the solution I proposed is over-complicated. Nevertheless, I have been unsatisfied about the power of TransformationFunctions. It appears to me that give a condition (as assumptions) in Simplify is better than a transformation function. For example, Simplify[x + y, x + y == z] z However, the conditions as assumptions does not ... 5 You can do : expr = (-1)^(1/4) π (Cot[(-1)^(3/4) π / Sqrt[x]] + I Cot[(-1)^(1/4) π / Sqrt[x]])/(4 Sqrt[x]); FullSimplify[ComplexExpand[expr, TargetFunctions -> {Re, Im}], Assumptions -> {x > 0}] (* (π (Sin[(Sqrt[2] π)/Sqrt[x]] - Sinh[(Sqrt[2] π)/Sqrt[x]])) / (2 Sqrt[2] Sqrt[x] (Cos[(Sqrt[2] π)/Sqrt[x]] - Cosh[(Sqrt[2] π)/Sqrt[x]])) *) ... 2 As Simon Woods said in his comment, use the form Collect[AAA (4 Sin[x]^2 Cos[x]^2) + AAA 4 Sin[x] Cos[x] + AAA, AAA, Simplify[#, Trig -> False] &] AAA (1 + 2 Cos[x] Sin[x])^2 0 Having now thought about it a bit further, the following seems to do the trick: PolynomialSimplify[expr_, var_] := Simplify[expr] /. poly___Plus ? (PolynomialQ[#, var] &) :> HornerForm[poly, var] There is probably a better way to achieve this though. 0 What about try to estimate the expense for numerical calculation using an estimatiExpense function, and use it as the ComplexityFunction? estimateExpense[t_] := Apply[Times, 10^# & /@ Cases[t, _^n_?NumericQ :> n, Infinity]] + 10*Count[t, Times, Infinity] + LeafCount[t] FullSimplify[8 + 13 r^2 + 11 r^4 + 5 r^6 + r^8, ComplexityFunction -> ... 1 Since you apparently only want to effect the output I recommend using$PrePrint as follows: \$PrePrint = # /. n_Integer /; IntegerLength[n] < 100 :> With[{fi = FactorInteger[n, 2] /. {{b_, x_ /; x > 1}} :> Defer[b^x]}, fi /; ! ListQ[fi] ] &; After evaluating this every integer in the output that factors to a single prime ...

8

If you look in the help file for Integrate under the section on "Possible Issues", there is an explanation. The docs comment: "Parameters like n are assumed to be generic inside indefinite integrals:" and the example is given of Integrate[x^n, x] which returns x^(1 + n)/(1 + n). As with the OPs integral, the answer is true for generic n, but not for a ...

0

This will do it for any numbers that can be represented as some power of a distinct integer, and the list is still usable for calculation by releasing the hold, unlike converting to string, etc. keepPowers[lst_] := Module[{powers, reps}, powers = HoldForm[#1^#2] & @@@ # & /@ FactorInteger[lst]; reps = lst[[#]] -> powers[[#]][[1]] & /@ ...

1

You could factor any integers and pick out the ones that are a power of a prime: ClearAll@powerForm powerForm[n_Integer /; With[{factors = FactorInteger@n}, Length@factors == 1 && Last@Last@factors != 1]] := powerForm[Sequence @@ First@FactorInteger[n]]; Format[powerForm[b_, e_]] ^:= HoldForm[b^e]; powerForm[n_] := n; To use: powerForm ...

1

It's a little bit roundabout, but this may work: aa = {2^31, 1103515245, 12345, 12345}; If[IntegerQ[Log[2, #]], 2^ToString[Log[2, #]], #] & /@ aa

0

The problem was solved after I used this file: https://github.com/Expander/FlexibleSUSY/blob/master/meta/Format.m and put it to here: C:\Users\tang\AppData\Roaming\Mathematica\Applications\format Thanks Update: there is another problem: v = Det[{{1, 1, 1, 1}, {x1, x2, x3, x4}, {y1, y2, y3, y4}, {z1, z2, z3, z4}}]/6; b1 = -Det[{{1, 1, 1}, {y2, y3, ...

Top 50 recent answers are included