Tag Info

Hot answers tagged

13

Disclaimer: This is not a full answer, but perhaps it's a start. From an algebraic stand point this seems like a very hard problem. I attacked it with a more brute force approach. I guess a basis and use LatticeReduce to try to find a Diophantine relation. Note this code only tries to identify roots as the product of integral powers of trig. If it returns ...


10

You can use the internal function Internal`RationalNoReduce Internal`RationalNoReduce[4, 8] Internal`RationalNoReduce[4, 8]^2 + 5


9

Expand takes forever, because it is trying to expand (u + x + y + z)^10000. Tell it not to. Expand[e, Power[u + x + y + z, 10000]] (* 0 *)


7

Use two rules in the replacement with a dummy rule to replace exponents with themselves. Along the lines of. (ks-foo*bar) Exp[ks^foo-bar] /. {x:Exp[___]->x, ks->Y} So anything that is an exponent is 'caught' by the first rule and the kx replacement rule doesn't get a look in.


6

A simple solution to a simple problem PowerExpand[Sqrt[-Sqrt[1 + x^2]]] yields $$i \sqrt[4]{x^2+1} .$$


6

This sort of thing can be recast as a quantifier elimination problem, as below. Quantify the variables you want to remove, set conditions on them as needed, and use Resolve to do the elimination step. A postprocessing step of BooleanMinimize might be needed (not in the examples below though). Resolve[Exists[p, p == True, p \[Xor] q]] (* Out[324]= ! q *) ...


5

This transformation is not valid for arbitrary $x \in \mathbb{C}$. You can for example test that it is not valid for x -> 1+I. PowerExpand is one way to force the transformation. From the documentation: PowerExpand converts (a b)^c to a^c b^c, whatever the form of c is. with the caveat that The transformations made by PowerExpand are correct ...


4

While I like David's simplification, this can be taken further. As pointed out in a number of places, Table is inefficient both time-wise and space-wise, so it can often be replaced, especially in this case. a + b + Range[12] (*{1 + a + b, 2 + a + b, 3 + a + b, 4 + a + b, 5 + a + b, 6 + a + b, 7 + a + b, 8 + a + b, 9 + a + b, 10 + a + b, 11 + a + b, 12 ...


4

If you are willing to use Assuming, which acts by way of $Assumptions, you can use an $Assumptions-aware Condition to achieve what I believe you want. I shall use "success!" to illustrate that the definition is truly being used and not another transformation. f[x_] /; Simplify[x ∈ Reals] := "success!" Now: Assuming[x ∈ Reals, f[x]] "success!" How ...


4

Could use GroebnerBasis as below. rels = {a^2 - a, b^2 - b, c^2 - c}; gb = GroebnerBasis[Join[{a + b - (1 + 2 c)}, rels], {a, b, c}]; Thread[Complement[gb, rels] == 0] (* Out[337]= {-1 + a + b == 0, c == 0} *) Here it is packaged into a function: binarySimplify[eq_, vars_] := Module[{rels, gb}, rels = (#^2 - # &) /@ vars; gb = ...


4

Something like roots = λ /. Solve[v1^2 + v2^2 + (t1^2 + t2^2)/λ^2 + ( 2 t1 v1 + 2 t2 v2)/λ + 2 t1 Conjugate[t1] + 2 t2 Conjugate[ t2] + λ (2 v1 Conjugate[t1] + 2 v2 Conjugate[t2]) + λ^2 (Conjugate[t1]^2 + Conjugate[t2]^2) == ET^2, λ] /. {(v1 Conjugate[t1] + v2 Conjugate[t2]) -> vDts} /. {(t1 v1 + t2 v2) ...


3

You're looking for TagSetDelayed I believe: Unprotect@Integrate; Integrate /: Plus[Integrate[ft_, {t_, a_, b_}], Integrate[ft_, {t_, b_, c_}]] := Integrate[ft, {t, a, c}]; Integrate /: Plus[Integrate[ft_, {t_, b_, a_}], Integrate[ft_, {t_, b_, c_}]] := Integrate[ft, {t, a, c}]; Protect@Integrate; But be careful when you unprotect system ...


3

Try the following. Let this: expr = (ks - foo1*bar1) Exp[ks^foo1 - bar1] + (ks - foo2*bar2) Exp[ ks*foo2 - bar2]; This pos = Position[expr, Exp[__]]; returns the position of exponents in it. Then this: expr2 = MapAt[ReplaceAll[#, ks -> kg] &, expr, pos] /. ks -> Y /. kg -> ks (* E^(-bar1 + ks^foo1) (-bar1 foo1 + Y) + E^(-bar2 + ...


2

WRT your first example: Simplify[Xor[p, q] == True, Assumptions -> p == True] (* True == ! q *) Not /@ Simplify[Xor[p, q] == True, Assumptions -> p == True] (* False == q *) Edit Daniel's answer is probably the way. However just for reference (and because I already did it :) ), here is another more laborious possibility that works OK with ...


2

Yes, it does not. If you need to actually simplify some expressions containing powers of Kroneker deltas you might want to use this rule: rule = KroneckerDelta[x_, y_]^n_ /; n > 0 -> KroneckerDelta[x, y]; acting as follows: KroneckerDelta[a, b]^3 /. rule (* KroneckerDelta[a, b] *) Have fun!


2

You should use \[TensorProduct] and TensorTranspose instead the usual . and Transposematrix operations. TensorReduce[G\[TensorProduct]G - G\[TensorProduct]TensorTranspose[G]] returns 0


2

As long as this simple question was answered by the poser, I might as well fine tune it: Table[a = -1; b = 1; a + b + n, {n, 12}] or more efficient: a = -1; b = 1; Table[a + b + n, {n, 12}]


1

All you need to do is to remove the Print statement and let the line d = a + b + c be the output: Table[a = -1; b = 1; c = n; d = a + b + c, {n, 1, 12}] Output: {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}


1

Don't employ the simplification rule suggested in another proposed answer, since it will yield incorrect answers in many cases: FullSimplify[KroneckerDelta[x, y]^2 f[x, y]/KroneckerDelta[x, y]] (* f[x, y] KroneckerDelta[x, y] *) Correct. But if you apply the rule proposed elsewhere, rule = KroneckerDelta[x_, y_]^n_ /; n > 0 -> KroneckerDelta[x, ...


1

One may also use Inactivate/Activateconstruct. For example, try this expr = Inactivate[ Integrate[f[x], {x, 0, 1}] + Integrate[f[x], {x, 1, 2}], Integrate] yielding this: Then make the replacement: expr /. Inactivate[ Integrate[g_, {x, a_, b_}] + Integrate[g_, {x, b_, c_}], Integrate] -> Inactivate[Integrate[g, {x, a, c}], Integrate] ...


1

The following should do what you want eqnToBool={Times->And,Plus->Xor,i_Integer:>OddQ[i]}; boolToEqn={And->Times,Xor->Plus,True->1,False->0}; eqToRules={Equal->Rule}; reduceBool[eq_]:=Resolve[Exists[{},eq/.eqnToBool],Booleans] simplifyBool[eq_]:=Module[{newEqns={}}, ...


1

Have you tried these substitution? ReplaceAll[ ReplaceAll[ a + b == 1 + 2*c, {Times -> And, Plus -> Xor, i_Integer :> OddQ[i]} ], {And -> Times, Xor -> Plus, True -> 1, False -> 0} ] Or something along these lines? I also think your second example is wrong, because when you're performing a computation mod ...


1

Reduce[Join[{a + b == 1 + 2 c, {a, b, c} \[Element] Integers}, 0 <= # <= 1 & /@ {a, b, c}]] (*(a == 0 && b == 1 && c == 0) || (a == 1 && b == 0 && c == 0)*) Reduce[Join[{a + 2 b a + 2 c == 2 d, {a, b, c, d} \[Element] Integers}, 0 <= # <= 1 & /@ {a, b, c, d}]] (*(a == 0 && b == 0 ...


1

It looks like a job for Collect: expr = a*(x^m)*(y^n) + b*(x^m)*(y^n) + c*(x^(m - 1))*(y^n) + d*(x^(m - 1))*(y^n); Collect[expr, x, Factor] (* (c + d) x^(-1 + m) y^n + (a + b) x^m y^n *)



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