13
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 ...
answered Jan 11 '17 at 19:21
Sjoerd C. de Vries
63.5k1414 gold badges175175 silver badges311311 bronze badges
12
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 ...
12
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[2] < x < Sqrt[2]]}} *)
This ...
11
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[...
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, ...
answered Jan 7 '19 at 1:00
Henrik Schumacher
85.4k66 gold badges132132 silver badges244244 bronze badges
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
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,
...
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]]
answered Aug 22 '14 at 12:50
b.gates.you.know.what
18.8k22 gold badges3636 silver badges7575 bronze badges
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}}}...
answered Oct 7 '15 at 9:45
Sjoerd C. de Vries
63.5k1414 gold badges175175 silver badges311311 bronze badges
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 *)
answered Mar 22 '16 at 20:02
Dr. belisarius
113k1212 gold badges187187 silver badges430430 bronze badges
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]
8
n = 5;
Sum[1/r[j, k]^α, {k, 1, n}, {j, 1, k - 1}]
r[1, 2]^-α + r[1, 3]^-α + r[1, 4]^-α +
r[1, 5]^-α + r[2, 3]^-α + r[2, 4]^-α +
r[2, 5]^-α + r[3, 4]^-α + r[3, 5]^-α +
r[4, 5]^-α
Alternatively,
Sum[Boole[1 <= j < k <= n]/r[j, k]^α, {j, 1, n}, {k, 1, n}]
r[1, 2]^-α + r[1, 3]^-α + r[1, 4]^-α +
r[1, 5]^-α + r[2, 3]^-α + r[2, 4]^-α ...
8
What do you prefer:
Resolve[ForAll[{x, y}, a*x^2 + b*y^2 - c*x*y + 1 > 0], Reals]
(*(a == 0 && b >= 0 && c == 0) || (a >= 0 && b >= 0 && c == 0) || (a > 0 && 4 a b - c^2 >= 0*)
or
FindInstance[ Resolve[ForAll[{x, y}, a*x^2 + b*y^2 - c*x*y + 1 > 0],Reals],{a, b,c}, Reals,3]
(*{{a->96,b->12,c-...
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[...
answered Dec 19 '13 at 17:05
Daniel Lichtblau
52.4k22 gold badges8989 silver badges182182 bronze badges
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[1]:= 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
(...
7
If you are OK with turning the Ors into Columns, you can do something like:
result = Reduce[
h1 >= 0 && h2 >= 0 && 2*x >= 0 && -m + h1 + y >= 0 &&
m + x - y >= 0 && h2 - x + 2 y >= 0, {x, y}];
TraditionalForm[
result //.
{Or -> (Column[#, Right, Background -> {{White, LightGray}}, ...
6
You need to specify all of the variables you want to reduce over:
In[1]:= Reduce[Abs[z^2 - r1] > Abs[z^3 - r2], {z, r1, r2}, Complexes]
Out[1]= (* 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,...
6
Mainly just to see how Reduce@Exists[..] stacks up against FindInstance[]. I suspect the heuristics of FindInstance will often beat symbolic reduction, but apparently not in this case.
Clear[xg1, Mtot, PL, xg2, mac, xga, stab, xgtot];
xgtot = -(xg1 PL + xg2 Mtot)/(Mtot + PL);
stab = (xga - xgtot)/mac;
Reduce[
Exists[{xg1, Mtot, PL, xg2, mac, xga},
0....
answered May 18 '16 at 13:29
Michael E2
191k1515 gold badges258258 silver badges601601 bronze badges
6
First of all I get five solutions for your system from Solve:
m = {x1, x2, x3} /.
Solve[{x1 >= x2, x1 >= x3, ##} & @@ (# == 0 || # == 1 & /@ {x1, x2, x3})]
{{0, 0, 0}, {1, 0, 0}, {1, 0, 1}, {1, 1, 0}, {1, 1, 1}}
From that output I can compute inequality relations like this:
Union /@ Sign[ Subtract @@@ Subsets[m\[Transpose], {2}] ]
{{0, ...
answered Jun 10 '17 at 7:59
Mr.Wizard
259k3333 gold badges539539 silver badges12171217 bronze badges
Only top voted, non community-wiki answers of a minimum length are eligible
Related Tags
inequalities × 274equation-solving × 93
plotting × 36
simplifying-expressions × 30
regions × 21
mathematical-optimization × 15
functions × 12
linear-algebra × 11
calculus-and-analysis × 10
numerics × 9
assumptions × 9
list-manipulation × 8
symbolic × 8
algebraic-manipulation × 8
matrix × 7
computational-geometry × 7
findinstance × 7
graphics × 6
performance-tuning × 6
resolve × 6
algebra × 4
boolean-computation × 4
constraint × 4
proof × 4
differential-equations × 3