# Tag Info

## Hot answers tagged simplifying-expressions

16

It is proposed an improvement based on VOISimplify: ExpressionUnknownSymbols[expression_]:=Union@Cases[expression,Except[__Symbol?(Context@#==="System"&),_Symbol],{1,Infinity},Heads->True] SetAttributes[ExpressionUnknownSymbols,Listable]; (*Mathematica's default ComplexityFunction*) SimplifyCount[p_]:=Which[ Head[p]===Symbol,1, ...

9

InverseLaplaceTransform[(2 s^2 + s + 13)/((s - 1) ((s + 1)^2 + 4)), s, t] 2*E^t + (3/4)IE^((-1 - 2*I)t) (-1 + E^(4*I*t)) % // ComplexExpand // Simplify 2*E^t - (3*Cos[t]*Sin[t])/E^t % // TrigReduce ((1/2)*(4*E^(2*t) - 3*Sin[2*t]))/E^t In "one" step InverseLaplaceTransform[(2 s^2 + s + 13)/((s - 1) ((s + 1)^2 + 4)), s, t] // ...

7

Expanding on my comment above, expr = Inactivate[x Integrate[Exp[-t^2], {t, 0, x}], Integrate]; D[expr, x] You can also convert existing Erf's to Integrate: ErfToIntegrate[e_] := e /. { Erf[z_] :> 2/Sqrt[π] Inactive[Integrate][Exp[-t^2], {t, 0, z}] } ErfToIntegrate[Sqrt[π]Erf[x] + Exp[-x^2] - Sqrt[π] Erf[x + a]]

7

One idea is to extend the domain with a piecewise function by taking limits at singularities. ExtendFunctionDomain[expr_, vars_] := Module[{domain, antidomain, locassums, lims}, domain = FunctionDomain[expr, vars, Reals] /. { NotElement[f_, S_] :> Not[f == C[1] && Element[C[1], S]] }; antidomain = ReduceToDNF[Reduce[!domain, vars, ...

6

Use the TrigFactor[] function, as in TrigFactor[1/2*(Sqrt[3]*Cos[x] - Sin[x])] Output Cos[Pi/6 + x].

4

Such an equation cannot be solved symbolically by Solve, but a solution might be approximately determined with FindRoot. Looking at the left-hand side: Plot[(1 - ((-1 + x)^E x^(1 - x) Log[x]^-E)^(1/(-1 + E)))/(-1 + x), {x, 0, 10}] which has a (real) domain of x > 0, we see that the only integers for which the equation is likely to have a solution ...

4

Simplify[PowerExpand[ 2 wb Z - 2 w xiR^4 Zb - 2 xiR^2 Sqrt[(wb Z - w xiR^4 Zb)^2/xiR^4]]] (*0*)

4

Simplify does not simplify held arguments of a function (that's a \[CapitalNu], not an N, just for fun): ClearAll[foo]; SetAttributes[foo, HoldAll]; Simplify[foo[E^((2 I k π (1 + Ν))/Ν) ], {k, Ν} ∈ Integers] Simplify[E^((2 I k π (1 + Ν))/Ν), {k, Ν} ∈ Integers] (* foo[E^((2 I k π (1 + Ν))/Ν)] E^((2 I k π)/Ν) *) This should seem perfectly reasonable, ...

3

The behavior seems to be a bug of Mathematica. Here is an excerpt from an email I got from Wolfram after asking them about the problem: It does seem that the answer of FullSimplify is incorrect especially since the exponential function is not identical to zero (or a very-close-to-zero constant). Therefore, I filed a report with our development team ...

3

You might find it helpful to define TransformationFunctions, which is an option to FullSimplify. For example: t[term_][expr_] := Simplify[Numerator[expr]/term]/Simplify[Denominator[expr]/term] expr = R^2 (g m[1] - g m[2])/(J + m[1] R^2 + m[2] R^2); FullSimplify[expr, TransformationFunctions -> {Automatic, t[R^2]}] (* (g (m[1] - m[2]))/(J/R^2 + ...

2

fulldata = Table[RandomReal[], {10}, {30}]; If you want short/simple plotting code: ListLinePlot[ Drop[fulldata,{5}], PlotLegends -> Delete[Range[10], 5]]

2

Apparently, simplifying a Sum does not result in simplifying each term in the Sum. Try Subscript[ϕ, 1] == Subscript[ϕ, II + 1] /. Exp[a_] :> Simplify[Exp[a], Assumptions -> k ∈ Integers] (* True *) Undoubtedly, there are more elegant approaches.

2

Root-expressions are very useful. It is worth reading the documentation about it. Often, doing computations with Root-expressions is simpler and more general than with Radicals. Having said that, it might be that you are looking for something like this: FullSimplify[1/4 (-(1/4)+Sqrt[5]/4+I Sqrt[5/8+Sqrt[5]/8]) (-1-Sqrt[5]+2 Sqrt[7/2+(5 Sqrt[5])/2]), ...

2

There are many ways to make this. For example, this one is simple, but is a bit not regular, that is, depends upon the structure of the expression at hand: expr = (R^2*(g*m1 - g*m2))/(J + m1*R^2 + m2*R^2); (expr /. J -> j*R^2 // Simplify) /. j -> J/R^2 (* (g (m1 - m2))/(m1 + m2 + J/R^2) *) This one is more regular though a bit longer: ...

1

It seems you want to collect scaling factors ce = Collect[ 1/2 (Sqrt[3] Cos[x] la - Sin[x] la - lb + Sqrt[3] Cos[x + y] lc - Sin[x + y] lc), {la, lb, lc}] -(lb/2) + 1/2 la (Sqrt[3] Cos[x] - Sin[x]) + 1/2 lc (Sqrt[3] Cos[x + y] - Sin[x + y]) which allows one to use TrigFactor /@ ce -(lb/2) + la Cos[\[Pi]/6 + x] + lc Cos[\[Pi]/6 + x + y]

1

expr = 1/2*(Sqrt[3]*Cos[x]*la - Sin[x]*la - lb + Sqrt[3]*Cos[x + y]*lf - Sin[x + y]*lf) FullSimplify[expr, TransformationFunctions -> {Automatic, TrigFactor}] -(lb/2) + la Cos[π/6 + x] + lf Cos[π/6 + x + y]

1

One way to do it would be Total@TrigFactor@ Level[HornerForm[ 1/2*(Sqrt[3]*Cos[x]*la - Sin[x]*la - lb + Sqrt[3]*Cos[x + y]*lf - Sin[x + y]*lf)], 1] I just put it in Horner Form, Broke the sum terms into a list(Level["expression", 1]), factored each list element, then added them all together. The output in this case being what you desired, -(lb/2) + ...

1

You could call a function that fetches all WolframAlpha alternate expression forms: AlternateExpressionForms[expression_]:=Module[{alternateFormData}, alternateFormData={}; alternateFormData=Quiet[Check[TimeConstrained[ReleaseHold[WolframAlpha[ToString[expression,InputForm],{"AlternateForm","Input"}]],60],{}]]; ...

1

Radicals are traditional bronze-age mathematics, but they aren't the nicest way to express the roots of a polynomial. Radical expressions are numerically unstable when a discriminant is near zero, and they often require complex arithmetic even for real results, as you've seen. In the space age, we have Root objects, one of the real gems of Mathematica. ...

1

One possibility is the following: Suppose you put this into a file called f.m : If[FindFile["FeynCalc"] === \$Failed, (* as explained here: https://github.com/FeynCalc/feyncalc/wiki/Installation *) Import["http://users.ph.tum.de/ga57tah/feyncalc/FeynCalcInstallNightly.m"] ]; Needs["FeynCalc"]; (* assuming you use Fortran 90 or newer*) ...

1

In its core, an assignment in Mathematica is always just a replacement rule. If I understood you correctly, then the solution to your problem is to simply use replacement rules instead of trying to assign your first equation. Let me show you what I mean: g3expr = -1 + G (1 - x) + G^2 x; poly = 2 G^2 + 6 G^2 x + 4 G^3 x + 3 G^2 x^2 - 8 G^3 x^2 - 2 G^4 x^2; ...

1

Second update (2015-05-11): Amandeep, you recently left a comment with the following expression: xpr = a1*D11*Cos[n*x] + a0*a1*D11*Cos[n*x] + 1/2*a1*a3*D11*Cos[n*x] + 1/2*a2*a4*D11*Cos[n*x] + a2*a3*a4*Sin[n*x] I believe that you may have left out a multiplication sign on the argument of the last Sin function. Once we add that back in, the approach using ...

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