# Tag Info

## Hot answers tagged simplifying-expressions

4

You can get some simplification by assuming k>0 A = {{0, 0, -1}, {0, 0, -1}, {0, 1, -2}}; Simplify[MatrixFunction[#^k &, A], Assumptions -> k > 0] // MatrixForm

4

One approach is to turn your expression into a polynomial in a new variable, say z expr2 = expr /. Exp[u_] :> Exp[(u /. t -> -I Log[z]/wm)] (* (4 E^((4 I L w)/c + (4 I L wm)/c) E0^2 r1 r2 tr^2)/z + 4 E^((8 I L w)/c + (2 I L wm)/c) E0^2 r1 r2 tr^2 z + 4 E^((6 I L w)/c + (4 I L wm)/c) E0^2 r1^2 z^2 + 4 E^((8 I L w)/c + (4 I L wm)/c) E0^2 r1 r2 t z^...

4

Short version of code for this model based on picture uploaded g = 9.81; m1 = 4.5; m2 = 4.25; m3 = 3.3; L2 = 1.2; L3 = 0.8; r1 = {q1[t], 0}; r2 = {q1[t] + L2/2 Cos[q2[t]], L2/2 Sin [q2[t]]}; r3 = {q1[t] + L2 Cos[q2[t]] + L3/2 Cos[q3[t] + q2[t]], L2 Sin[q2[t]] + L3/2 Sin[q2[t] + q3[t]]}; T = (m1/2 D[r1, t] . D[r1, t] + m2/2 D[r2, t] . D[r2, t] +...

3

A couple things: Mathematica generally doesn't require you to initialize arrays before constructing them or anything like that; you can just construct them! Array[A, 3] does not give any definitions to the variable A; it merely outputs {A[1], A[2], A[3]} without changing any variables. Only the next line does anything to affect the symbol A, and it defines ...

3

This has to do with the maximum number of non-linear variables which is set to 4 by default. Changing this parameter solves my issue: SetSystemOptions["SimplificationOptions" -> {"AssumptionsMaxNonlinearVariables" -> 10}];

3

Clear["Global*"] collect[expr_, wp_ : MachinePrecision, var : _Symbol : x] := expr // Simplify // Collect[#, var] & // N[#, wp] & poly1 = -4* E^(2*Pi*(4 + x))*(E^(-(Pi*x) - Pi*(8 + x))/2 - 8*E^(-(Pi*x) - Pi*(8 + x))*Pi) + 8*E^(-(Pi*x) + 2*Pi*(4 + x) - Pi*(8 + x))*Pi*x; poly1 // collect (* 98.531 + 25.1327 x *) poly1 // ...

3

Try define the matrix with exact numbers a = {{0, 25/2, 25/2 k1 - 5}, {25/2, 25/2 k1 - 5, 2 - 5 k1}, {k1, 0, 0}} and then FullSimplify[Inverse[a]]

3

Not really a solution of my own but, for sake of completeness I'll reproduce here with due credit. As explained here, the problem is caused by exceeding the number of non-linear variables. By expanding it, we'd get the expected result: Clear["Global*"] SetSystemOptions["SimplificationOptions" -> {"AssumptionsMaxNonlinearVariables&...

2

Mathematica can work with approximate numbers (as you do) or exact numbers. Exact numbers work much better in this case M = {{0, 25/2, 25/2 k - 5}, {25/2, 25/2 k - 5, 2 - 5 k}, {k, 0, 0}}; Inverse[M] // FullSimplify (* {{0, 0, 1/k}, {4/(125 k), 2/(25 k), -(1/k^2)}, {2/(25 k), 2/( 5 (2 - 5 k) k), 5/(k^2 (-2 + 5 k))}} *)

2

You do not need to use Simplify for this. Just try the replacement: 1/2 + ((\[Omega]1 - \[Omega]2)^2 + 4 J12^2 \[Pi]^2 Cos[ t Sqrt[4 J12^2 \[Pi]^2 + (\[Omega]1 - \[Omega]2)^2]])/(2 (4 \ J12^2 \[Pi]^2 + (\[Omega]1 - \[Omega]2)^2)) /. \[Omega]1 -> \ \[CapitalDelta] + \[Omega]2 with the following effect: Have fun!

1

Here's my solution. First, make $x$ and $g$ antisymmetric with proper function definitions as I've done here: Subscript[g, arg__] /; ! OrderedQ@{arg} := Signature@{arg} Subscript[g, ##] & @@ Sort@{arg} Subscript[x, arg__] /; ! OrderedQ@{arg} := Signature@{arg} Subscript[x, ##] & @@ Sort@{arg} Then define a function to rename the dummy indices. ...

1

I think this is a case where "Simplify" and "FullSimplify" fail to obtain the optimal answer. According to the manual: ComplexityFunction: how to assess the complexity of each form generated With the default setting ComplexityFunction->Automatic, forms are ranked primarily according to their LeafCount, with corrections to treat ...

1

About the dynamic modeling J2 = 1/12*m2*L2^2; J3 = 1/12*m3*L3^2; p1 = {q1[t], 0}; p2 = p1 + L2/2 {Cos[q2[t]], Sin[q2[t]]}; p3 = p1 + L2 {Cos[q2[t]], Sin[q2[t]]} + L3/2 {Cos[q2[t] + q3[t]], Sin[q2[t] + q3[t]]}; v1 = D[p1, t] v2 = D[p2, t] v3 = D[p3, t] omega2 = D[q2[t], t] omega3 = D[q2[t] + q3[t], t] T = 1/2 (m1 v1.v1 + m2 v2.v2 + m3 v3.v3) + 1/2 (J2 omega2^...

1

The solution you obtained is clearly not the right solution: Clear["Global`*"]; $Assumptions = {}; EQ = e == 1/2 (-2 ef + hvk - Sqrt[9 hvk^2 + 4 j^2]); sol = Solve[EQ, hvk] hvksol[ef_, e_, j_] = hvk //. sol[[1]]; N[EQ[[2]] //. {e -> 3, ef -> 4, j -> 2, hvk -> hvksol[4, 3, 2]}] And the ouput: -17.8059 Note that if you use$Assumptions\$...

1

@BobHanlon's Simplify solution is pretty fast, and the tweak below is a little faster. Simplify is not always fast, but without an example to show it is slower, it seems the way to go. A fairly quick way, though twice as slow as Simplify, is to evaluate the exponential at a numerical value of x. Given that the exponentials cancel out anyway, the ...

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