Tag Info

New answers tagged

1

fullFactor[f_, x_] := Roots[f == 0, x] /. Equal -> ((#1 - #2) &) /. Or -> Times fullFactor[x^5 - 1, x] (* (-1 + x) ((-1)^(1/5) + x) (-(-1)^(2/5) + x) ((-1)^(3/5) + x) (-(-1)^(4/5) + x) *)


2

Cos[a + b] Sinc[a + b] == Sinc[2 (a + b)] /. Sinc[x_] -> Sin[x]/x // Simplify Cos[x/2] Sinc[x/2] + Cos[y/2] Sinc[y/2] == Sinc[x] + Sinc[y] /.Sinc[x_] -> Sin[x]/x // Simplify FullSimplify[ Cos[x/2] Sinc[x/2] + Cos[y/2] Sinc[y/2] == Sinc[x] + Sinc[y], TransformationFunctions -> {Automatic, Reduce[#, {x, y}, Reals] &}]


2

Sometimes, a preliminary application of FunctionExpand[] works wonders: Cos[a + b] Sinc[a + b] == Sinc[2 (a + b)] // FunctionExpand // FullSimplify True


2

You can try proceeding this way: rule = Cos[x_] Sinc[x_] -> Sinc[2 x] Cos[x/2] Sinc[x/2] + Cos[y/2] Sinc[y/2] == Sinc[x] + Sinc[y] /. rule Cos[a + b] Sinc[a + b] == Sinc[2 (a + b)] /. rule Which both give True as expected. Also note that your assumptions make no difference as Cos[x/2] Sinc[x/2] == Sinc[x] // FullSimplify gives True without any ...


1

Check the tutorial here. a.(-b.c) + a.b.c // TensorExpand (* ==> 0 *)


1

You can teach Mathematica to factor out any number from inside a dot. Unprotect[Dot]; x__.(c_?NumberQ y__) := c x.y (c_?NumberQ x__).y__ := c x.y Protect[Dot];


1

This answer is only for exercise. It works only with products but I believe it can be eaily extended. Also for exercise, because I think rm -rf is right about approach. I've taken Māris Ozols formula and extended it. EDIT: it works now with integer and rational powers sub[expr_, parts_, var_] := Module[{reduce, p, n, list, ct, red, l2}, reduce := ...


1

You can use the following code Repeat[x_, n_] := Row@ConstantArray[x, {n}]; expr /. Power[x_, Rational[p_, q_] | p_] :> Repeat[x^(Sign[p]/(1*q)), Abs@p] where expr is your expression. This will display things the way you wanted. If you don't need things to be displayed, you can just leave the Repeat function undefined.


15

The engine behind this inside Compile is a well-hidden function called OptimizeExpression. it has two levels, 1 and 2. Setting to 2 makes it work harder to find CSEs. e1 = (G u^2 (6 p (2 h + p) - 8 (h + p) u + 3 u^2))/(12 h^2); e2 = (G (3 h + 3 p - 2 u) u^2)/(3 h^2); Experimental`OptimizeExpression[{e1, e2}, OptimizationLevel -> 2] (* Out[40]= ...


5

Level may provide a means of getting started. Level breaks down your polynomials into their constituent parts, with various "levels" of complexity. As @Rex Kerr noted in a comment, Level 1 happens to be interesting in the present example. a=(G u^2 (6 p (2 h+p)-8 (h+p) u+3 u^2))/(12 h^2); b=(G (3 h+3 p-2 u) u^2)/(3 h^2); ...


6

Since you are going to work with numeric functions, Compile will optimize your functions along those lines. If you define : f = Compile[{{g, _Real}, {u, _Real}, {h, _Real}, {p, _Real}}, {(g u^2 (6 p (2 h + p) - 8 (h + p) u + 3 u^2))/(12 h^2), (g (3 h + 3 p - 2 u) u^2)/(3 h^2)} ] you can already see some of it in the output. To get an even more in ...


6

Simplify uses as few assumptions as possible when simplifying an expression. This means that it doesn't presume that anything is real, or positive for example. At first this may seem perverse, but in fact it saves you from making incorrect assumptions a lot of the time. Simplify is however very adaptable and allows you to not only include your own ...


10

FullSimplify[ ComplexExpand[ Conjugate[(-1 + E^(2 I k l)) m^2 V^2 + 2 I k m V \[HBar]^2 + k^2 \[HBar]^4], {k, V, m, \[HBar], l} \[Element] Reals]] is probably as simple as it's going to get E^(-2 I k l) m^2 V^2 + (-I m V + k \[HBar]^2)^2 There are a range of functions for dealing with complex numbers and equations: FullSimplify, ...


3

My attempt, using a combination of replacement rules, Factor and PowerExpand simple = PowerExpand[Factor //@ #] //. {1/Sqrt[x_] :> Sqrt[1/x], Sqrt[x_] Sqrt[y_] :> Sqrt[x y]} &; Testing on various expressions found among the comments: exprs = {Sqrt[a]/Sqrt[b], Sqrt[-(1 - b)] Sqrt[1/(b - 1)], (a + 3 w Sqrt[-(1 - b)] Sqrt[1/(b - 1)])/(r ...


5

We have, for all integer a and n Sum[Fibonacci[n + i], {i, 0, a}] == Fibonacci[n + a + 2] - Fibonacci[n + 1] (-> True) This can be seen by evaluating Table[ Sum[Fibonacci[n + i], {i, 0, a}] == Fibonacci[n + a + 2] - Fibonacci[n + 1], {a, 1, 10}, {n, 1, 10} ] which gives a bunch of True's. You can then simply do n = 1000; fibRatio[a_, b_] := ...


13

Sometimes I use the following: FullSimplify[ 1 + Sqrt[2] Log[2] - Sqrt[3] Log[3] - Sqrt[5] Log[5] + Sqrt[2 (9 + 4 Sqrt[2]) Log[2]^2 + 3 Log[3]^2 - 2 Log[2] (Sqrt[3] (4 + Sqrt[2]) Log[3] + 4 Sqrt[5] Log[5]) + Log[5] (-Sqrt[10] Log[4] + 5 Log[5] + Sqrt[15] Log[9])] + Log[16], TransformationFunctions -> {Automatic, If[Not[AtomQ[#]] ...


6

Well, I had worked out an answer to the question of how to tell if the six points were coplanar: MatrixRank[ Simplify[# - points[[1]] & /@ points, a > 0 && b > 0 && c > 0 && n > 0], ZeroTest -> (Expand@PowerExpand@# == 0 &)] (* 2 *) So they are coplanar. But now the question has changed somewhat, ...


5

You have to let Mathematica know that the arguments inside the square roots are positive and real. So you can add the assumptions that a and c are positive and that b>1 (so that b-1 is positive). expr = (a + 3 w Sqrt[-(1 - b)] Sqrt[1/(b - 1)])/(r Sqrt[c] Sqrt[1/c]); FullSimplify[expr, {a > 0, c > 0, b > 1}] The answer is (a + 3 w)/r


2

How about this? expr = (a + 3 w Sqrt[-(1 - b)] Sqrt[1/(b - 1)])/(r Sqrt[c] Sqrt[1/c]); Simplify[expr, Positive[Cases[expr, Power[stuff_, 1/2 | -1/2] :> stuff, ∞]]] (a + 3 w)/r


2

Another approach: Simplify[ExpToTrig @ Re[E^(I x)], x ∈ Reals] Cos[x]


3

Try! (1/2)*(Exp[x*I] + Conjugate[Exp[x*I]])// ComplexExpand Cos[x] Also note that TraditionalForm is a formatting tool mainly for displaying the formulas in a nice manner. After you have applied TraditionalForm on an expression other Mathematica built in functions (e.g FullSimplify) may have problem to deal with the expression as an input. Hence ...


3

As the other answers have mentioned, you can confirm the solution without specifying values for C[1] and C[2] lhs = q''[x] + 2 x/(x^2 - 1) q'[x] - 4*q[x]/(x^2 - 1); sol = DSolve[lhs == 0, q, x][[1, 1]]; FullSimplify[lhs /. sol] 0 When C[2] is set to zero, FullSimplify is unable to find the right transformations to reduce the expression to zero, and ...


1

You can do : sol[x_] = q[x] /. First@DSolve[q''[x] + 2 x/(x^2 - 1) q'[x] - 4*q[x]/(x^2 - 1) == 0, q[x], x] FullSimplify[Derivative[2][sol][x] + 2 x/(x^2 - 1) Derivative[1][sol][x] - 4*sol[x]/(x^2 - 1)] (* 0 *)


0

I think you may not chose one parameter to 0. E.g. try c2=2 and c1=1: FullSimplify[ D[LegendreP[1/2 (-1 + Sqrt[17]), x] + 2 LegendreQ[1/2 (-1 + Sqrt[17]), x], {x, 2}] + 2*x/(x^2 - 1)* D[LegendreP[1/2 (-1 + Sqrt[17]), x] + 2 LegendreQ[1/2 (-1 + Sqrt[17]), x], x] - 4*(LegendreP[1/2 (-1 + Sqrt[17]), x] + 2 LegendreQ[1/2 (-1 + Sqrt[17]), x])/(x^2 - 1)] ...


8

If you make any assumptions you have to share them with Mathematica as well. For Example: Assuming[R > 0, FullSimplify[(R^3)^(1/3)]] (*R*) The default assumption is that all variables are complex. (As @J.M. noted in the comments).


5

It's just not always true that $(R^3)^{1/3} = R$. How about $R=i$, for example? N[(I^3)^(1/3)] (* Out: 0.866025 - 0.5 I *) If you expect this, you might have more luck with the real-valued CubeRoot function. For example: FullSimplify[CubeRoot[R^3]] (* Out: R *)


0

This should work Exp[x_] /; x < 0 :> 0 Sticking a negative in front of a pattern variable will not accomplish what you want.


4

Independently I arrived at something similar to Michael's answer, yet different. I borrowed his formatting function after seeing it as it works better than what I had. Perhaps this will also be of use: evalFromBottom[expr_, lv_: 1] := If[lv > Depth@expr, expr, With[{ev = Replace[expr, x_ :> RuleCondition[x], {-lv}]}, If[expr === ev, ...



Top 50 recent answers are included