Tag Info

New answers tagged

3

The documentation of Assumptions says: "The assumptions can be equations, inequalities, or domain specifications, or lists or logical combinations of these." I read this as implying ForAll is not included. An approach that seems to work is the following: f[x_] > f[y_] ^:= Piecewise[{{True, x > y}}, False] f[3] > f[4] (* False *) f[4] > f[3] ...


1

This expression, designated exp for convenience, can be simplified substantially as follows. num = Map[FullSimplify[#] &, Numerator[exp]]; Map[FullSimplify[#, θ[_] ∈ Reals && ϕ[_] ∈ Reals] &, Denominator[exp] /. Abs[z_]^2 :> FullSimplify[Abs[z]^2, θ[_] ∈ Reals && ϕ[_] ∈ Reals]; /. Abs[z_]^2 :> z^2] den = ...


9

One of the pitfalls new users face, especially if they have analysis (calculus) of only real functions of real variables, is that Mathematica assumes by default that variables are complex and functions are the complex functions. Power functions in particular can seem strange; even those who know it is complex sometimes forget. The cube root is a simple ...


3

To answer the question as asked, we modify the code as follows: replacementRule = Plus[ Dot[FRONT__, AA__, BACK__] , Dot[FRONT__, BB__, BACK__] ] :> Dot[FRONT, Plus[Dot[AA], Dot[BB]], BACK]}] w.a.b.r + w.c.d.r /. replacementRule First, we have changed -> (Rule) to :> (RuleDelayed) so that when the expression is re-written, it will write it ...


4

It can be done with w.a.b.r + w.c.d.r /. Dot[FRONT_, AA__, BACK_] + Dot[FRONT_, BB__, BACK_] :> Dot[FRONT, Dot[AA] + Dot[BB], BACK] w.(a.b + c.d).r However, I like function argument destructuring, so I would probably write f[Dot[w_, a__, r_] + Dot[w_, b__, r_]] := w.(Dot[a] + Dot[b]).r f[w.a.b.r + w.c.d.r] w.(a.b + c.d).r


0

You could put the arguments of Dot, which in general is not commutative but is commutative on vectors, in a canonical order with Sort. relations = p1.p1 == m && p1.p2 == 0 /. d_Dot :> Sort[d]; Simplify[2 (p1.q1) (p3.p2) + (p1.p2)^2 + (p2.p1) /. d_Dot :> Sort[d], relations] (* 2 p1.q1 p2.p3 *) Alternative, using $Assumptions to restrict the ...


2

A variant of the method from the other question: z = Sin[φ]*v; Dot[z, Conjugate[z]] (v Sin[φ]).Conjugate[v Sin[φ]] Simplify[%, φ ∈ Reals] //. Dot[a___, d_ b_ /; FreeQ[d, v], c___] :> d Dot[a, b, c] v.Conjugate[v] Sin[φ]^2 Integrate[%, {φ, 0, 2 π}] π v.Conjugate[v] Some explanation of the rule: //. -- "repeatedly apply the ...


1

It is not exactly what you asked about, but did you try this: list = {Cos[x], Sin[x], -(Cos[t3 (d1 - d2)]/(1728 tg^3 (d1 - d2)^2)) + Cos[t3 (d1 - d2)]/(864 tg^3 (d1 - d2) (-d1 + d2)) + Cos[t3 (d1 - d2)]/(864 tg^3 (d1 - d2) (2 (d1 - d2) - 2 (-d1 + d2))) - Cos[t3 (d1 - d2)]/(864 tg^3 (d1 - d2) (2 (d1 - d2) + 2 (-d1 + ...


3

Expanding Cos[2 x] to 1 - Sin[x]^2 and simplifying are somewhat opposite procedures. Simplify basically reduces the leaf count (see How do I invoke the default complexity function? for more details). As we can see the number of leaves in the goal is twice the numbers of leaves in the starting expression: LeafCount /@ {Cos[2 x], 1 - Sin[x]^2} (* {4, 8} ...


3

This appears to give you one approximate solution in a few seconds sol=NMinimize[ Norm[Abs[eta1]^2 + Abs[gamma1]^2 - 1] + Norm[Abs[eta2]^2 + Abs[gamma2]^2 - 1] + Norm[Abs[eta3]^2 + Abs[gamma3]^2 - 1] + Norm[Abs[tau1]^2 + Abs[kappa1]^2 - 1] + Norm[Abs[tau2]^2 + Abs[kappa2]^2 - 1] + Norm[Abs[tau3]^2 + Abs[kappa3]^2 -1 ] + Norm[Dot[q1, Conjugate[q1]] - ...


7

One way will be to add it to the definition of Cos by Unprotecting it. Unprotect[Cos] Cos[2 x] := 1 - 2 Sin[x]^2 Protect[Cos] Then evaluating the following: 2 Cos[2 x] + 3 x Cos[2 x] + Tan[x] Sin[x] Cos[2 x] + Exp[Tan[Cos[2 x]]] gives: Which you can further Simplify if you so please. Notice that the desired replacement has occurred everywhere ...


2

You could go ahead and modify the mathematica output manually by defining exactly what you want to have transformed. In your case this would look like this: MakeBoxes[Cos[2*x_], StandardForm] := RowBox[{MakeBoxes[1 - 2 Sin[x]^2]}]; This effectively turns every occurrence of Cos[2x] in StandardForm into 1 - 2 Sin[x]^2. I use this to get a certain standard ...


0

You cannot use underscore in a name Format[th[n_]] := Subscript[th, n] expr = Cos[th[1]]^2 + 2*Cos[th[1]]*Cos[th[2]] + 2*Sin[th[1]]*Sin[th[2]] + Sin[th[1]]^2 As suggested by Guess who it is expr // TrigExpand


1

(Caveat: I did the following experiments with paper, a pen, and Alpha, but I believe it should also work in Mathematica.) Through the use of a few well-known identities relating the incomplete gamma function and the partial sums of the exponential function, we have the following formula: f[n_Integer] := (n - 1) Sum[(n - k - 1)! Binomial[n - 1, n - k - 1], ...


0

I agree there seems to be something lacking here; I mean that there should be a way to get an exact integer expansion of this expression so long as it is within the capabilities of Mathematica to compute it. I haven't found that way. We can at least check if an expression is numerically equivalent to a given number of places: fix[extra_Integer: ...


5

This bug has been fixed as of version 10.2.0. g[k2_] := (-510 k2 + (25761/4 - 6619 E^-k2) Log[26476/23721])/(-k2 + Log[26476/23721]) ans = Solve[g[k2] == 0, k2, Reals][[1, 1, 2]]; FullSimplify[ans] (* 8587/680 Log[26476/23721] + ProductLog[-(( 10579732023355105126853211737189792087286301059526347 (23721/ 6619)^(427/680) Log[26476/23721])/( ...


4

The OP correctly notes that Collect with Simplify is essential for computing this double sum in a reasonable amount of time, if at all. It is straightforward to find that the LeafCount of the inner sum only without using Collect is 721809. With it, the size of the inner sum drops to 21158. However, we can do much better. Instead, define the inner sum as ...


1

expr = (b (1 - x)^n (-1 + x)^-n (-1 + x - w x)^n)/(n (-1 + w) (1 - x + w x)); Your stated assumptions including your comment assume = {Thread[Variables@Level[expr, {-1}] > 0], Element[n, Integers]} // Flatten {b > 0, n > 0, w > 0, x > 0, n \[Element] Integers} The simplified expression is expr // Simplify[#, assume] & (b (1 + (-1 + ...


1

Try using Simplify. x+(x*l) // Simplify


2

This is not a robust solution but since no one else was motivated to try to match your result here's my rough draft. expr1 = 225 a^4 + 600 a^3 b^2 + 520 a^2 b^4 + 160 a b^6 + 16 b^8 + 1200 a^4 b x + 2080 a^3 b^3 x + 960 a^2 b^5 x + 128 a b^7 x + 600 a^5 x^2 + 3120 a^4 b^2 x^2 + 2400 a^3 b^4 x^2 + 448 a^2 b^6 x^2 + 2080 a^5 b x^3 + 3200 a^4 b^3 x^3 + ...


2

e1 = 225 a^4 + 600 a^3 b^2 + 520 a^2 b^4 + 160 a b^6 + 16 b^8 + 1200 a^4 b x + 2080 a^3 b^3 x + 960 a^2 b^5 x + 128 a b^7 x + 600 a^5 x^2 + 3120 a^4 b^2 x^2 + 2400 a^3 b^4 x^2 + 448 a^2 b^6 x^2 + 2080 a^5 b x^3 + 3200 a^4 b^3 x^3 + 896 a^3 b^5 x^3 + 520 a^6 x^4 + 2400 a^5 b^2 x^4 + 1120 a^4 b^4 x^4 + 960 a^6 b x^5 + 896 a^5 b^3 x^5 + 160 ...


2

Here's some work-in-progress code I have been playing with. First we define a helper function which attempts to combine Anded comparisons (which result when using functions such as LogicalExpand) into Inequality, Equal and Unequal chains. It does this by making graphs of expressions, and finding paths connected components and cliques on them. It doesn't try ...


2

FullSimplify[] on the enormous expression gives this answer in less than a second: $(4 b^4 + 4 a^4 x^4 + 4 a b^2 (5 + 4 b x) + 4 a^3 x^2 (5 + 4 b x) + a^2 (15 + 8 b x (5 + 3 b x)))^2$ It would take me several days to calculate such a result "by hand," and no doubt I would make errors.



Top 50 recent answers are included