Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

# Tag Info

17

Are you looking for Subtract? eq=x>=y Subtract@@eq>=0 gives: x-y>=0 Edit If one wants a function, which keeps the order sign and adds the 0, one may use: oneSide=(Head[#][Subtract@@#,0]&) and call e.g. eq//oneSide

17

The proof of the original statement that $f(x)\equiv x\sin\frac{\pi}{x}$ is a monotonically increasing function of $x$ for $x>1$ can be done as follows: First, we show that the second derivative $f''(x)$ of the function is negative: Simplify[D[x Sin[π/x], x, x] < 0, Assumptions -> x > 1] True This means that the first derivative $f'(x)$ is ...

15

Mathematica often responds well when provided a little expert assistance. Let's focus on techniques that have a wide application rather than just to this problem. Can the function be decomposed into simpler pieces? Yes, obviously: $f(x)$ is the product of $x$ and $\sin{\pi / x}$. Both are obviously increasing for $x \in [1,2]$. After that, \$\sin{\pi / x}...

13

From the documentation: Less gives True or False when its arguments are real numbers. Regardless of what x or y are, it is clear that {x,y} is not a real number, so Less doesn't do anything with it (for the most part, some simplifications may still be performed). Note that other functions may also treat {x,y}<0 specifically, and that you can ...

13

Generally, this is an invalid use of <. Both the left and the right-hand side should be expressions representing real numbers. However, there are a few special cases where Mathematica will accept a list with <, ==, >, such as Solve[{x, y} < 2 && y == x^2] (* {{y -> ConditionalExpression[x^2, -Sqrt < x < Sqrt]}} *) This ...

12

This approach works by using the fact that an inequality or equality can be traversed by Map in the same way that a regular list can. It can take an arbitrary inequality or equation eqn, and you don't have to know in advance whether it's >, < or anything else. First I define the equation eqn, and then I use the fact that the second part of eqn is the ...

12

What I believe is the issue here is what a statement in your Reduce like c ∈ Reals actually means. You say it's a condition (and I feel you mean assumption), I say it's an expression, a Boolean expression. An expression like x>0 doesn't state that x is greater than 0. It's an undetermined claim about x that is True when x is indeed greater than 0, and ...

11

f[ineq_, var_] := RegionMeasure[ImplicitRegion[ineq, var], Length[Flatten[{var}]]] f[1 <= x <= 2.5, x] 1.5 This works also for some systems of inequalities in several variables: f[{1 <= x <= 2.5, 0 <= y <= x}, {x, y}] 2.625 Edit: This one-argument version treats all symbols in the first argument as variables: f[ineq_] := f[ineq, ...

10

SetSystemOptions[ "ReduceOptions" -> {"DiscreteSolutionBound" -> 10000000}]; f[n_] := Module[{eqn}, eqn = (n1 + n3 + n5 == n2 + n4 + n6) && (n1 >= n2) && (n1 - n2 + n3 - n4 >= 0) && (n1 <= n) && (n1 - n2 + n3 <= n) && (n1 - n2 + n3 - n4 + n5 <= n) && (2 n <= n1 + ...

10

If we want exact values we should work with them from scratch. eq[t_, x_] := Abs[-x Exp[-1/2 x^2/(t^2)]/(t^2)] The boundary of the set of our interest can be described when we fix one of the two variables, therefore we can define e.g.: r[t_] := Reduce[ eq[t, x] < 1/100 && t > 0 && x > 0, {x}] We need the function r because in ...

9

Since Mathematica 11.3 you can use SubtractSides, that works for equations and inequalities, for example eqns = { x >= y, x^2 == b c + c, 2 x < x + 1 }; SubtractSides /@ eqns (* {x - y >= 0, -c - b c + x^2 == 0, -1 + x < 0} *)

9

You can do : p = ImplicitRegion[y <= 3/10 x + 18 && y > x^2/8, {x, y}] points = Reduce[Element[{x, y}, p], {x, y}, Integers] pp = Cases[points, x == xx_ && y == yy_ -> {xx, yy}] pp // Length (* 286 *) Show[RegionPlot[p], ListPlot[pp]]

9

As I stated in my comment below the post, the filling syntax used by the OP is correct. The behavior seen in the plot is a bug. A workaround is to simply increase the number of plot points. The following works: Plot[{x^2, x^4}, {x, -2, 2}, PlotRange -> {-1, 5}, PlotStyle -> {Automatic, Red}, Filling -> {1 -> {{2}, {LightBlue, White}}}...

9

The assumptions mechanism used by Simplify has a bound on the number of variables in a system of nonlinear inequalities. If the number of variables exceeds the bound, the assumption mechanism does not attempt to decide whether the system has solutions. (Simplify proves that an inequality follows from the assumptions by showing that assumptions && Not[...

8

con = Thread[{a, b, c} > 1/2 + Sqrt[5/4]]; Simplify[Reduce[Flatten[ {a b c (a + b + c) > 3 a b c + a b + b c + c a, con}], {a, b, c}], con] True Graphically, Show[ RegionPlot3D[ a b c (a + b + c) > 3 a b c + a b + b c + c a, {a, 0, 3}, {b, 0, 3}, {c, 0, 3}, PlotStyle -> Directive[Blue, Opacity[0.25]]], RegionPlot3D[And @@ con, ...

8

eqn = y <= 3/10 x + 18 && y > x^2/8; sol = Reduce[eqn, {x, y}, Integers]; Length @ sol (* 286 *) points = {x, y} /. {ToRules[sol]}; (* thanks: BobHanlon *) RegionPlot[eqn, {x, -15, 18}, {y, -5, 25}, GridLines -> {Range[-15, 18], Range[-5, 25]}, PlotStyle -> Directive[{Opacity[0.5], Red}], Epilog -> {...

8

Since Reduce doesn't seem to like the inequality, I tried FullSimplify with Assumptions instead. This works in three steps: differenceByTerm = SeriesCoefficient[(1 + x)^n - (1 + n x), {x, 0, m}] $$\cases{ 0 & m=0 \\ \binom{n}{m} & m>1 \\ 0 & \text{True} \\ }$$ FullSimplify[ differenceByTerm >= 0, Assumptions -> n > 1 ...

8

And @@ Thread[{a, b} > {c, d}] (* a > c && b > d *)

8

re = Reduce[f1[x, y] < f2[x, y], {x, y}, Reals] Reduce[f1[x, y] > f2[x, y], {x, y}, Reals] x < 1 && -Sqrt[1 - x] < y < Sqrt[1 - x] (x <= 1 && (y < -Sqrt[1 - x] || y > Sqrt[1 - x])) || x > 1 Edit: You can also directly plot the reduced result. RegionPlot[re, {x, -10, 5}, {y, -5, 5}, ImageSize -> Small]

7

Here is another solution using V10 functionalities: region = ImplicitRegion[y <= 3/10 x + 18 && y > x^2/8, {{x, -15, 18}, {y, -5, 25}}]; lis = Tuples[{Range[-15, 18], Range[-5, 25]}]; We create a RegionMemberFunction rm = RegionMember[region]; Now we select from lis the points that are in the region: in = Select[lis, rm]; Length @ in ...

7

Basically it amounts to using CoefficientArrays along with a bit of massaging for sense of inequality. getLinearForm[ineqs : {(_LessEqual | _GreaterEqual) ..}, vars_] := Module[ {mults, lpolys, rhs, lhs}, mults = Map[Head, ineqs] /. {LessEqual -> 1, GreaterEqual -> -1}; lpolys = mults*Apply[Subtract, ineqs, {1}]; {rhs, lhs} = Normal[...

7

Yes, Mathematica can prove these inequalities symbolically. To be more precise, it can Reduce them to True. Generating human-readable proofs is also possible but that's one broad topic. First, we'll use a “coordinate change”. Notice that your expressions for R, s, r are all symmetric in x, y, z. This hints that we might benefit from using symmetric ...

7

Yes, it is documented that the result of Reduce[expr, vars] always describes exactly the same mathematical set as expr, i.e. the result of the reduction is equivalent to the original system. Another way to state the above is In:= s1 = c > 0 && ((d <= -2 - c && a > 0 && b > (-c - d)/a) || (-2 - c < d ...

7

Posting this here as community wiki because we answers should not stay only as comments. You have many options Using Resolve and ForAll Resolve[ForAll[x, x > 0, Abs[x] == x]] Using Refine Assuming[x > 0, TrueQ[Refine[Abs[x] == x]]] But assumptions can be placed inside Refine, as in Refine[Abs[x] == x, x > 0] Using Simplify Simplify[Abs[x] =...

7

By trial and error, if we plot Plot3D[{f1[x, y], f2[x, y]}, {x, -2, 2}, {y, -2, 2}] we see that x== 1-y^2 is the boundary? ContourPlot[{f1[x, y] == f2[x, y], x == 1 - y^2}, {x, -2, 2}, {y, -2, 2}, ContourStyle -> {, Dashed}] Indeed eq = f1[x, y]^2 == f2[x, y]^2 // FullSimplify eq /. x -> 1 - y^2 // FullSimplify // PowerExpand (...

6

I think that this problem (like most algebraic manipulations) is best approached with pattern matching and rule replacement than by directly exploiting the index/list structure that inequalities share with practically every Mathematica expression. Both approaches will work, but rule replacement is, in my opinion, clearer, more precise, more flexible, and ...

6

Here's a simple way to enumerate all the conditions: fs = {x, y, z, 0}; conds = Table[{Equal @@ fs1, And @@ Table[First@fs1 >= f, {f, Complement[fs, fs1]}]}, {fs1, Subsets[fs, {2}]}] (* {{x == y, x >= 0 && x >= z}, {x == z, x >= 0 && x >= y}, {x == 0, x >= y && x >= z}, {y == z,...

6

You need to specify all of the variables you want to reduce over: In:= Reduce[Abs[z^2 - r1] > Abs[z^3 - r2], {z, r1, r2}, Complexes] Out= (* a huge pile of Im, Re and Sqrt omitted *)

6

The issue is pre-evaluation of the pattern. For the ones that evaluate to False: Inequality[___] (* True *) and Inequality[1, _, x, LessEqual, 2] (* Inequality[1, _, x] && x <= 2 *) Neither of those evaluated forms will match Inequality[1, Less, x, LessEqual, 2] To fix this, merely add HoldPattern. For instance, MatchQ[Inequality[1, Less, x,...

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