# Tag Info

8

What is "simpler" or more complex is a very subjective question. The topic has come up a few times before (see e.g. my previous answer to Advice for Mathematica as Mathematician's Aid and links therein). The Simplify functions fiddle with an expression systematically in an attempt to minimize a pre-defined "complexity function", which is loosely based on ...

7

I presume that you wish to eliminate some variables in the last expression in terms of variables defined in the other expressions. Let me begin with two pieces of advice: Do not use subscripted variables. They may look nice, but they can cause problems. Simplification is in the eye of the beholder. Mathematica's idea of simplification, based on LeafCount,...

6

Check numbers for zero precision and replace with 0. foo = x + 12345673 - 12345673 (* 0.*10^3 + x *) foo /. x_Real /; Precision[x] <= 0. -> 0 (* x *) Edit: Another way is to use SetPrecision instead of Chop. That sets zero precision numbers in the expression to exactly zero. SetPrecision[foo, Infinity] (* x *)

6

The result is 0, and we can show it by a smart choice of transformation. expr is what I define as the expression that OP wants to simplify: expr=Sin[t] (b^2 Cos[t] (1/Sqrt[(Sqrt[a^2-b^2]-a Cos[t])^2+b^2 Sin[t]^2]+1/Sqrt[(Sqrt[a^2-b^2]+a Cos[t])^2+b^2 Sin[t]^2])-a ((-Sqrt[a^2-b^2]+a Cos[t])/Sqrt[(Sqrt[a^2-b^2]-a Cos[t])^2+b^2 Sin[t]^2]+(Sqrt[a^2-b^2]+a Cos[t]...

6

vsol = V1 /. NSolve[(Sqrt[u1^4 + A1] - u1)/(A1*D1) + L1/(Sqrt[u1^3 + A1]), V1][[1]] Plot[vsol, {u1, 0, .01}] This is a case where I would recommend rescaling your units so you are not multiplying large numbers with small numbers and then adding and subracting them. Or you could do something like this: V5 = 0; Q1 = Rationalize[1.6021*10^(-19), 10^(...

6

Because it isn't always true that the simplification can be made. Consider the following substitutions: subs = {L -> 1/2, c -> -1, r -> 1}; Then, c^-L (c*r)^-L /. subs yields -1 but r^-L /. subs yields 1

5

Another option is to help it a little ClearAll[x, y]; expr = Sin[Sqrt[x + y]]/Sqrt[x + y] expr /. {1/Sqrt[x + y] -> 1/z, Sqrt[x + y] -> z}

4

You can simplify using Surd[ ,2] instead of Sqrt Sin[Surd[x + y, 2]]/Surd[x + y, 2] /. Surd[x + y, 2] -> z Sin[z]/z

4

The positive definiteness will be handled with the NCAlgebra Suite 5,0 from here With the codes for convexHull and ExtractElements given here you can proceed as follows << NC << SDP PosChar[p_, c_] := ToExpression[StringJoin[ToString[p], ToString[c]]] SymmetricalMatrix[name_, dim_] := Module[{dummy, vars = {}, i, j, k, c}, dummy = Table[0, {...

4

Clear["Global*"] expr = (25 A^2 hbar Sqrt[π])/Sqrt[hbar m w]; Presumably, your E is not intended to be the numeric constant 2.71828... Using \[DoubleStruckCapitalE] instead rule = \[DoubleStruckCapitalE] -> Sqrt[m w/hbar] x; Assuming that {m > 0, w > 0, x > 0, \[DoubleStruckCapitalE] > 0} expr /. Solve[Equal @@ rule, hbar][[1]] // ...

3

Yet an other way: sol = First@Solve[Sqrt[x + y] == z, x] (* {x -> -y + z^2} *) Sin[Sqrt[x + y]]/Sqrt[x + y] /. sol // PowerExpand[#, Assumptions -> z > 0] & Or Sin[Sqrt[x + y]]/Sqrt[x + y] /. sol // Simplify[#, Assumptions -> z > 0] & (* Sin[z]/z *)

3

Try TensorReduce $Assumptions = {A ∈ Matrices[{n, n}], B ∈ Matrices[{n, n}]}; expr = Commutator[A + B, Commutator[A + B, A - B]] - Commutator[A - B, Commutator[A + B, A - B]]; TensorReduce[expr] (* A.MatrixPower[A - B, 2] + 2 A.MatrixPower[B, 2] + A.MatrixPower[A + B, 2] + B.MatrixPower[A - B, 2] - B.MatrixPower[A + B, 2] + 6 MatrixPower[B, 2].A - 6 ... 3 Along with the equations, include the inequalities as constraints g = 9.81; m = 2; ρ = 2; v0 = 6; sol = Solve[{Fw == m g, Fw Sin[Θ] == m an, an == v^2/ρ, -ρ g Sin[Θ] == 1/2 (v^2 - v0^2), v > 0, 0 <= Θ < 2 Pi}, {Θ, v, Fw, an}] // Quiet (* {{Θ -> 0.658108, v -> 3.4641, Fw -> 19.62, an -> 6.}, {Θ -> 2.48349, v -> 3.... 3 Recently there's someone who asked me for this, I prepared an answer and now post it here. SumHeld /: MakeBoxes[SumHeld[expr_, ranges__], form_] := MakeBoxes[Sum[expr, ranges], form] SumHeld /: SyntaxInformation[SumHeld] = {"LocalVariables" -> {"Table", {2, Infinity}}}; IndexUnify[HoldPattern@Plus[sums:SumHeld[_, __]..]] := Plus@@With[ { ... 2 Since I had a similar problem same problem some time ago I'd like to expand on the other answers why mathematica does not simplify the expressions with the initial second attempt. ReplaceAll (/.) does not hold its arguments. That means both arguments will be evaluated before any replacements are performed. The left hand side of /. after evaluation can be ... 2 Another way: Sin[Sqrt[x + y]]/Sqrt[x + y] /. (x + y)^(r_) :> z^(2 r) (* Sin[z]/z *) 2 It is true if c is positive: FullSimplify[c^-L (c*r)^L, Assumptions -> {c > 0}] r^L 2 Not an answer, as I could not figure out why, just to confirm that it should be zero Clear[a, b, c, t, e, r] L[vektor_] := Sqrt[Total[vektor^2]]; r = {a Cos[t], b Sin[t]} e = {Sqrt[a^2 - b^2], 0}; c = ((r - e)/L[r - e] + (r + e)/L[r + e]).D[r, t] Manipulate[ Plot[c /. {a -> a0, b -> b0}, {t, -200, 200}], {{a0, 1, "a"}, -100, 100, 1}, {{b0, 1, "b"},... 2 Clear["Global*"] f1 is f1[λ_, n_] := (1/ 64) (-64 - (8 λ (-4 + 2 r + λ + (-2 + r) r λ + 2 λ^2 + λ^3) ((-2 + r)^4 + (2 - r)^ n (1 + λ)^(4 - n)) (5 + (-4 + r) r + λ (2 + λ)))/((-2 + r)^4 r (1 + λ)^3 (-1 + ((2 - r)/(1 + λ))^n)) + 64 (1 - ((-1 + λ)^2 (((2 - r)/(1 + λ))^ n + (-2 + r)^... 2 As Rohit mentioned, what you see on the screen is not necessarily what Mathematica sees. Using FullForm on your function shows that Mathematica actually sees Times[Power[a, -1], Power[b, Rational[-1, 2]]] whereas Sqrt[b]//FullForm gives Power[b, Rational[1, 2]] (note the difference in the first argument of Rational). You actually need something ... 2 Define your own function. Clear["Global`*"] gamma[x__] := Module[{g = Gamma[x]}, If[FreeQ[g, _Gamma], Inactive[Gamma][x], g]] gamma /@ {6, x} (* {Inactive[Gamma][6], Gamma[x]} *) gamma @@@ {{1, z}, {a, z}} (* {Inactive[Gamma][1, z], Gamma[a, z]} *) gamma @@@ {{1, 0, -a}, {a, z0, z1}} *) (* {Inactive[Gamma][1, 0, -a], Gamma[a, z0, z1]} 2 expr = Sqrt[1 + 10^(rdb/10) + 2^(1 + rdb/20) 5^(rdb/20) Cos[pdiff]]; fd = FunctionDomain[expr, {rdb, pdiff}] (* 10^(rdb/10) + 2^(1 + rdb/20) 5^(rdb/20) Cos[pdiff] >= -1 *) As you stated, Simplify or FullSimplify change the domain exprs = expr // Simplify (* Sqrt[1 + 10^(rdb/10) + 10^(rdb/20) Csc[pdiff] Sin[2 pdiff]] *) FunctionDomain[exprs, {rdb, ... 2 You say, you know, that c should be zero. Let Reduce test whether it can be unequal zero. Reduce[{a > b, b > 0, t > 0, c != 0}, {a, b, t}] (* False *) Edit Another way to show c == 0 Substitute the a-b-squareroute by d and take the b-solution that is > 0. sol = Solve[Sqrt[a^2 - b^2] == d, b] (* {{b -> -Sqrt[a^2 - d^2]}, {b -> Sqrt[... 1 I am assuming they want Conjugate[Exp[I a]^(2 n)] to become (Exp[I a]^(-2 n) ? By using a rule (De Moivre’s formula) (I do not see how it is possible otherwise) ClearAll[a, n, r, m]; expr = Exp[I a]^(2 n); e1 = ExpToTrig[expr] /. r_. (Cos[a_] + I Sin[a_])^(m_.) :> r^m (Cos[m a] + I Sin[m a]); FullSimplify@Conjugate[e1] Using ComplexExpand (just to ... 1 The answer that I was looking for is sim = Pochhammer[ x_. (z_. n + a_), m___] :> Pochhammer[ x a, m + x z n]/ Pochhammer[x a, x z n] It does the following simplifications in:= Pochhammer[2 n + a, m] //. sim out:=Pochhammer[a, m + 2 n]/Pochhammer[a, 2 n] in:=Pochhammer[n + 3 a, m] //. sim out:=Pochhammer[3 a, m + n]/Pochhammer[3 a, n] in:=... 1 To ascertain the nullity we can follow with s = Normal[Series[c, {t, 0, 5}]] // Factor and a null common factor appears$\$ a^2 \left(-\sqrt{-2 a \sqrt{a^2-b^2}+2 a^2-b^2}\right)-a^2 \sqrt{2 a \sqrt{a^2-b^2}+2 a^2-b^2}-a \sqrt{a^2-b^2} \sqrt{-2 a \sqrt{a^2-b^2}+2 a^2-b^2}+a \sqrt{a^2-b^2} \sqrt{2 a \sqrt{a^2-b^2}+2 a^2-b^2}+b^2 \sqrt{-2 a \sqrt{a^2-b^2}+...

1

f[x_, y_] := (1 - Exp[-y x] - y x); Use TagSet or TagSetDelayed If the variables u and v are not literal ClearAll[f] f /: (f[s[v_], u_] /; u =!= v) = f[s[v], v]; f[s[v], u] - f[s[v], v] (* 0 *) f[s[x], y] - f[s[x], x] (* 0 *) If the variables u and v are literal ClearAll[f] f /: f[s[v], u] = f[s[v], v]; f[s[v], u] - f[s[v], v] (* 0 *) f[s[x], y]...

1

I am trying to find the norm of 1 over 1 plus ri using Mathematica (where r is the variable and i is the imaginary number i). I would be expecting the answer to be 1 over the square root of 1 plus r squared One way is ClearAll[r] expr = 1/(1 + r I); ComplexExpand@Norm@expr

1

This should cover most cases: List @@ Collect[expression, Select[#, ! FreeQ[#, x] &] & @ DeleteDuplicates @ MonomialList[expression] /. z_Times :> Select[z, !FreeQ[#, x] &] ] There is also a more general function available here

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