Solving system of non-linear equations in Mathematica - wolfram-mathematica

I am trying to numerically solve the below system of six equations (g0-g5) for a0-a5 in Mathematica. I am no expert in Mathematica and am not entirely sure how to do this.
f[x_, y_] := Exp[a0 - 1 + a1*x + a2*y + a3*x*x + a4*y*y + a5*x*y]
g0[x_, y_] := Integrate[f[x, y],{y,-Infinity,Infinity},{x,-Infinity,Infinity}] - 1
g1[x_, y_] := Integrate[x*f[x, y],{y,-Infinity,Infinity},{x,-Infinity,Infinity}]
g2[x_, y_] := Integrate[y*f[x, y],{y,-Infinity,Infinity},{x,-Infinity,Infinity}]
g3[x_, y_] := Integrate[x*x*f[x, y],{y,-Infinity,Infinity},{x,-Infinity,Infinity}] - 1
g4[x_, y_] := Integrate[y*y*f[x, y],{y,-Infinity,Infinity},{x,-Infinity,Infinity}] - 1
g5[x_, y_] := Integrate[x*y*f[x, y],{y,-Infinity,Infinity},{x,-Infinity,Infinity}]
I have, however, spent considerable time trying to get NSolve and FindRoot to yield a solution. Here is that code:
NSolve[{g0[x, y]==0, g1[x, y]==0, g2[x, y]==0, g3[x, y]==0, g4[x, y]==0,
g5[x, y]==0}, {a0, a1, a2, a3, a4, a5}, Reals]
FindRoot[{g0[x, y]==0, g1[x, y]==0, g2[x, y]==0, g3[x, y]==0, g4[x, y]==0,
g5[x, y]==0}, {{a0,1}, {a1,1}, {a2,1}, {a3,1}, {a4,1}, {a5,1}}]
One additional piece of information I can offer is that the resulting solution for f(x,y) should be equivalent to the bivariate standard normal density. Any help would be much appreciated. This is my first post on SO, so please let me know if any additional information is necessary.

I am astonished. I never expected it to finish. But if you subtract off all the time for it to do the integrals then Reduce finishes in the blink of an eye.
f[x_, y_] := Exp[a0 - 1 + a1*x + a2*y + a3*x*x + a4*y*y + a5*x*y];
g0[x_, y_] := Integrate[f[x, y], {y, -Infinity, Infinity}, {x, -Infinity, Infinity}]-1;
g1[x_, y_] := Integrate[x*f[x, y], {y, -Infinity, Infinity}, {x, -Infinity, Infinity}];
g2[x_, y_] := Integrate[y*f[x, y], {y, -Infinity, Infinity}, {x, -Infinity, Infinity}];
g3[x_, y_] := Integrate[x*x*f[x, y], {y, -Infinity, Infinity}, {x, -Infinity, Infinity}]-1;
g4[x_, y_] := Integrate[y*y*f[x, y], {y, -Infinity, Infinity}, {x, -Infinity, Infinity}]-1;
g5[x_, y_] := Integrate[x*y*f[x, y], {y, -Infinity, Infinity}, {x, -Infinity, Infinity}];
Reduce[Simplify[{g0[x,y]==0, g1[x,y]==0, g2[x,y]==0, g3[x,y]==0, g4[x,y]==0, g5[x,y]==0},
Re[4 a4-a5^2/a3]<0], {a0,a1,a2,a3,a4,a5}]
gives you
C[1] \[Element] Integers && a0==1+2I\[Pi] C[1]-Log[2]-Log[\[Pi]] &&
a1==0 && a2==0 && a3== -(1/2) && a4== -(1/2) && a5==0
Note: That gives Simplify one assumption which you should verify is justified. That assumption allows it to turn all your ConditionalExpression into presumably valid expressions for your problem. I got that assumption by looking at each of the results returned from Integrate and seeing that they all depended on that for the result to be valid.

Here is how to formulate this numerically:
f[x_, y_, a0_, a1_, a2_, a3_, a4_, a5_] :=
Exp[a0 - 1 + a1*x + a2*y + a3*x*x + a4*y*y + a5*x*y]
g0[a0_?NumericQ, a1_, a2_, a3_, a4_, a5_] :=
Integrate[
f[x, y, a0, a1, a2, a3, a4, a5], {y, -Infinity, Infinity},
{x, -Infinity, Infinity}] - 1
g1[a0_?NumericQ, a1_, a2_, a3_, a4_, a5_] :=
Integrate[
x*f[x, y, a0, a1, a2, a3, a4, a5], {y, -Infinity, Infinity},
{x, -Infinity, Infinity}]
g2[a0_?NumericQ, a1_, a2_, a3_, a4_, a5_] :=
Integrate[
y*f[x, y, a0, a1, a2, a3, a4, a5], {y, -Infinity, Infinity},
{x, -Infinity, Infinity}]
g3[a0_?NumericQ, a1_, a2_, a3_, a4_, a5_] :=
Integrate[
x*x*f[x, y, a0, a1, a2, a3, a4, a5], {y, -Infinity,
Infinity}, {x, -Infinity, Infinity}] - 1
g4[a0_?NumericQ, a1_, a2_, a3_, a4_, a5_] :=
Integrate[
y*y*f[x, y, a0, a1, a2, a3, a4, a5], {y, -Infinity,
Infinity}, {x, -Infinity, Infinity}] - 1
g5[a0_?NumericQ, a1_, a2_, a3_, a4_, a5_] :=
Integrate[
x*y*f[x, y, a0, a1, a2, a3, a4, a5], {y, -Infinity,
Infinity}, {x, -Infinity, Infinity}]
FindRoot[ {
g0[a0, a1, a2, a3, a4, a5] == 0,
g1[a0, a1, a2, a3, a4, a5] == 0,
g2[a0, a1, a2, a3, a4, a5] == 0,
g3[a0, a1, a2, a3, a4, a5] == 0,
g4[a0, a1, a2, a3, a4, a5] == 0,
g5[a0, a1, a2, a3, a4, a5] == 0} ,
{{a0, -.8379}, {a1, 0}, {a2, 0}, {a3, -.501},
{a4, -.499}, {a5, 0}}]
Note I've put in an initial guess very close to the known solution (thanks #Bill) and it still takes a very long time to find the answer.
{a0 -> -0.837388 - 1.4099*10^-29 I,
a1 -> -6.35273*10^-22 + 7.19577*10^-46 I,
a2 -> -1.27815*10^-20 + 6.00264*10^-38 I,
a3 -> -0.500489 + 1.41128*10^-29 I, a4 -> -0.5 - 7.13595*10^-44 I,
a5 -> -5.55356*10^-28 - 9.23563*10^-47 I}
Chop#%
{a0 -> -0.837388, a1 -> 0, a2 -> 0, a3 -> -0.500489, a4 -> -0.5,
a5 -> 0}

Related

Mathematica about NDsolve PDE set

I am trying to use NDsolve function to solve a PDE set.
I am pretty new to mathematica and here is the code I put in.
NDSolve[{D[Cm[t, x], t] == Dm*D[Cm[t, x], x, x] + Kg*Cs[t, x] - Ka*Cm[t, x],
D[Cs[t, x], t] == Ds*D[Cs[t, x], x, x] + Ka*Cm[t, x] - Kg*Cs[t, x],
Cm[0, x] == Cm0,
Cs[0, x] == Cs0,
Dm*ND[Cm[t, 0]] == 0.5*FT,
Ds*ND[Cs[t, 0]] == 0.5*FT,
Cm[t, Infinity] == Cm0,
Cs[t, Infinity] == Cs0}
{Cm[t, x], Cs[t, x]}, {t, 0, 1000}, {x, 0, Infinity}];
plot3D[Cs, {t, 0, 1000}, {x, 0, 10000}]
Dm = 9 e - 8;
Ds = 5 e - 9;
Cm0 = 1.276 e + 15;
Cs0 = 1.276 e + 20;
Ka = 1;
Kg = 1 e - 5;
FT = 1 e + 11;
So, basically, we have two PDEs, 2 initial conditions and 4 boundary conditions(two constant B.C. two flux B.C.). We know all the values of parameters. I am not sure if its a formatting problem or boundary choosing problem. The system gives
"Thread::tdlen: Objects of unequal length in "
"NDSolve::argmu: NDSolve called with 1 argument; 3 or more arguments are expected."
Could somebody give some valuable suggestions?
Thanks
Update
Dm = 9*10^-8;
Ds = 5*10^-9;
Cm0 = 1.276*10^+15;
Cs0 = 1.276*10^+20;
Ka = 1;
Kg = 1*10^-5;
FT = 1*10^+11;
NDSolve[{D[Cm[t, x], t] ==
Dm*D[Cm[t, x], x, x] + Kg*Cs[t, x] - Ka*Cm[t, x],
D[Cs[t, x], t] == Ds*D[Cs[t, x], x, x] + Ka*Cm[t, x] - Kg*Cs[t, x],
Cm[0, x] == Cm0,
Cs[0, x] == Cs0,
Dm*(D[Cm[t, x], x] /. x -> 0) == 0.7*FT,
Ds*(D[Cs[t, x], x] /. x -> 0) == 0.3*FT,
Cs[t, 10000] == Cs0,
Cm[t, 10000] == Cm0},
{Cm[t, x], Cs[t, x]}, {t, 0, 1000}, {x, 0, 10001},
PrecisionGoal -> 2];
Animate[Plot[Cs[t, x], {x, 0, 10000},
PlotRange -> {{0, 1000}, {0, 5*10^20}}], {t, 0, 1000}]
The "unequal" error was because you are missing a comma between } and { on your 8th and 9th line.
But that isn't your only problem. This fixes some other, but not all problems.
Dm = 9*10^-8;
Ds = 5 *10^-9;
Cm0 = 1.276*10^+15;
Cs0 = 1.276*10^+20;
Ka = 1;
Kg = 1*10^-5;
FT = 1*10^+11;
NDSolve[{D[Cm[t, x], t] == Dm*D[Cm[t, x], x, x] + Kg*Cs[t, x] - Ka*Cm[t, x],
D[Cs[t, x], t] == Ds*D[Cs[t, x], x, x] + Ka*Cm[t, x] - Kg*Cs[t, x],
Cm[0, x] == Cm0, Cs[0, x] == Cs0, Dm*ND[Cm[t, 0]] == 0.5*FT,
Ds*ND[Cs[t, 0]] == 0.5*FT, Cm[t, Infinity] == Cm0,
Cs[t, Infinity] == Cs0}, {Cm[t, x], Cs[t, x]}, {t, 0, 1000}, {x, 0, Infinity}];
plot3D[Cs, {t, 0, 1000}, {x, 0, 10000}]
Everything (except for the functions you are solving for and the independent variables) inside an NDSolve must be initialized to numeric values before starting the NDSolve, so I moved your assignments up. Mathematica has its' own way of writing exponents.
Now for bigger issues.
You have an ND function that you haven't defined. That is going to have to be defined before the NDSolve starts.
It is possible, maybe even likely that NDSolve is going to be less than cooperative with limits of Infinity for your x variable. It may work, but I wouldn't bet on that. You might try a smaller finite value, maybe 10^4 because that is bigger than your 10^3, and see if that will work if Infinity doesn't.
I don't spot any other big problems at the moment, but without knowing what your ND function is I can't begin to test this and perhaps flush out the next layer or two or three of problems to look for.
But this is actually pretty good if this is your first try at Mathematica.

Sum of sine data fitting with mathematica

Hy everyones,
I've a little problem with a mathematica script which I need for fitting data points with a sum of 3 sine functions :
fit = NonlinearModelFit[Data,a1*Sin[b1*x + c1] + a2*Sin[b2*x + c2] + a3*Sin[b3*x + c3], {a1, b1,c1, a2, b2, c2, a3, b3, c3}, x]
I get this error :
NonlinearModelFit::cvmit: Failed to converge to the requested accuracy or precision within 100 iterations
I've tried with different starting values and with MaxIteration set to 10.000...
Maybe it's not the right way to do this kind of fitting. Does anyone have an idea about this?
Thanks!
Perhaps your data is too bad, but it works nicely with a good sample:
data = Table[{x, Sin[ x + .3] + 2 Sin[1.2 x] + 3 Sin[1.5 x + .5]},
{x, .01, 8 Pi, .001}];
fit = NonlinearModelFit[data,
a1*Sin[b1*x + c1] + a2*Sin[b2*x + c2] + a3*Sin[b3*x + c3],
{a1, b1, c1, a2, b2, c2, a3, b3, c3}, x]
Show[ListPlot[data], Plot[fit[x], {x, 0, 8 Pi}, PlotStyle -> Red], Frame -> True]

Memory exhaustion while running NDSolve

I run into the "No more memory available" error message in Mathematica. I understand that "Parallelize[]" isn't (obviously) going to help me. Neither has "ClearSystemCache[]".
What gives? Do I just need more RAM?
My Code
Needs["VectorAnalysis`"]
Needs["DifferentialEquations`InterpolatingFunctionAnatomy`"];
Clear[Eq4, EvapThickFilm, h, S, G, E1, K1, D1, VR, M, R]
Eq4[h_, {S_, G_, E1_, K1_, D1_, VR_, M_, R_}] := \!\(
\*SubscriptBox[\(\[PartialD]\), \(t\)]h\) +
Div[-h^3 G Grad[h] +
h^3 S Grad[Laplacian[h]] + (VR E1^2 h^3)/(D1 (h + K1)^3)
Grad[h] + M (h/(1 + h))^2 Grad[h]] + E1/(
h + K1) + (R/6) D[D[(h^2/(1 + h)), x] h^3, x] == 0;
SetCoordinates[Cartesian[x, y, z]];
EvapThickFilm[S_, G_, E1_, K1_, D1_, VR_, M_, R_] :=
Eq4[h[x, y, t], {S, G, E1, K1, D1, VR, M, R}];
TraditionalForm[EvapThickFilm[S, G, E1, K1, D1, VR, M, R]];
L = 318; TMax = 10;
Off[NDSolve::mxsst];
Clear[Kvar];
Kvar[t_] := Piecewise[{{1, t <= 1}, {2, t > 1}}]
(*Ktemp = Array[0.001+0.001#^2&,13]*)
hSol = h /. NDSolve[{
(*S,G,E,K,D,VR,M*)
EvapThickFilm[1, 3, 0.1, 7, 0.01, 0.1, 0, 160],
h[0, y, t] == h[L, y, t],
h[x, 0, t] == h[x, L, t],
(*h[x,y,0] == 1.1+Cos[x] Sin[2y] *)
h[x, y, 0] ==
1 + (-0.25 Cos[2 \[Pi] x/L] - 0.25 Sin[2 \[Pi] x/L]) Cos[
2 \[Pi] y/L]
},
h,
{x, 0, L},
{y, 0, L},
{t, 0, TMax},
MaxStepSize -> 0.1
][[1]]
hGrid = InterpolatingFunctionGrid[hSol];
Error message
No more memory available.
Mathematica kernel has shut down.
Try quitting other applications and then retry.
My OS specs
Intel Core 2 Duo with 4.00 GB ram, 64 bit OS (Windows 7)
Here you may get a taste of what is happening:
Replace
MaxStepSize -> 0.1
by
MaxStepFraction -> 1/30
And run your code.
Then:
p = Join[#,Reverse##]&#
Table[Plot3D[hSol[x, y, i], {x, 0, L}, {y, 0, L},
PlotRange -> {All, All, {0, 4}}],
{i, 7, 8, .1}]
Export["c:\\plot.gif", p]
So, Mma is trying to refine the solution at those peaks, to no avail.

How to "embed" Piecewise in NDSolve in Mathematica

I am using NDSolve to solve a non-linear partial differential
equation.
I'd like one of the variables (Kvar) to be a function
of the time step currently being solved and hence and using
Piecewise.
Mathematica generates an error message saying:
SetDelayed::write: Tag Real in 0.05[t_] is Protected. >>
NDSolve::deqn: Equation or list of equations expected instead of
$Failed in the first argument ....
ReplaceAll::reps: ....
I haven't included the entire error message for ease of reading.
My code is as follows:
Needs["VectorAnalysis`"]
Needs["DifferentialEquations`InterpolatingFunctionAnatomy`"];
Clear[Eq4, EvapThickFilm, h, S, G, E1, K1, D1, VR, M, R]
Eq4[h_, {S_, G_, E1_, K1_, D1_, VR_, M_, R_}] := \!\(
\*SubscriptBox[\(\[PartialD]\), \(t\)]h\) +
Div[-h^3 G Grad[h] +
h^3 S Grad[Laplacian[h]] + (VR E1^2 h^3)/(D1 (h + K1)^3)
Grad[h] + M (h/(1 + h))^2 Grad[h]] + E1/(
h + K1) + (R/6) D[D[(h^2/(1 + h)), x] h^3, x] == 0;
SetCoordinates[Cartesian[x, y, z]];
EvapThickFilm[S_, G_, E1_, K1_, D1_, VR_, M_, R_] :=
Eq4[h[x, y, t], {S, G, E1, K1, D1, VR, M, R}];
TraditionalForm[EvapThickFilm[S, G, E1, K1, D1, VR, M, R]];
And the second cell where I am trying to implement Piecewise in NDSolve:
L = 318; TMax = 7.0;
Off[NDSolve::mxsst];
(*Ktemp = Array[0.001+0.001#^2&,13]*)
hSol = h /. NDSolve[{
(*S,G,E,K,D,VR,M*)
Kvar[t_] := Piecewise[{{0.01, t <= 4}, {0.05, t > 4}}],
EvapThickFilm[1, 3, 0.1, Kvar[t], 0.01, 0.1, 0, 160],
h[0, y, t] == h[L, y, t],
h[x, 0, t] == h[x, L, t],
(*h[x,y,0] == 1.1+Cos[x] Sin[2y] *)
h[x, y, 0] ==
1 + (-0.25 Cos[2 \[Pi] x/L] - 0.25 Sin[2 \[Pi] x/L]) Cos[
2 \[Pi] y/L]
},
h,
{x, 0, L},
{y, 0, L},
{t, 0, TMax}
][[1]]
hGrid = InterpolatingFunctionGrid[hSol];
PS: I am sorry but the first cell block doesn't display so well here. And thanks to not having enough "reputation", I can't post images.
The error message occurs when using the NDSolve cell block.
Define the function Kvar outside of a set of equations in NDSolve, like
Off[NDSolve::mxsst];
(*Ktemp=Array[0.001+0.001#^2&,13]*)
Kvar[t_] := Piecewise[{{0.01, t <= 4}, {0.05, t > 4}}];
hSol = ...
and remove it from the list in NDSolve, so that it starts as NDSolve[{(*S,G,E,K,D,VR,M*)EvapThickFilm[..., and it will work. It gives warnings, but those are related to possible singularities in your equation.
Also, your original error indicates that your Kvar was assigned a value of 0.05. So, add Clear[Kvar] before anything else in the second cell.

Finding bounds for 21-variable inequalities

I have the following inequalities on 21 variables:
http://pastebin.com/raw.php?i=FTU970Em
When I run "Reduce[ineq,Integers]" on this, Mathematica hangs for a
long time.
That makes sense: there are MANY sets of values for x[1]..x[21] that
satisfy the inequalities.
All I really want is bounds for each variable (eg, "2 <= x[i] <= 7"
for each i).
How can I get this efficiently w/ Mathematica? Is there a better
program for this?
Note: this is part of the larger project:
Partially re-create Risk-like game based on incomplete log files
The entire hideous list of inequalities: http://pastebin.com/CyX9f70J
Running "Reduce[ineq,Integers]" on the above yields "false", so I've
probably incorrectly translated:
http://conquerclub.barrycarter.info/ONEOFF/7460216.html
I second the CLP(FD) suggestion given in the other thread. Using SWI-Prolog 5.10:
:- use_module(library(clpfd)).
vars([X0,X1,X2,X3,X4,X5,X6,X7,X8,X9,X10,X11,X12,X13,X14,X15,X16,X17,X18,
X19,X20,X21]) :-
X0 #= 3, X1 #>= 1, X1 #=< X0, X2 #>= 1, X2 #=< X1,
X3 #>= 1, X3 #=< X2, X4 #>= 1, X4 #=< X3, X5 #=< X4 + 3,
X5 #>= 1, X6 #>= 1, X6 #=< X5, X7 #>= 1, X7 #=< X6,
X8 #>= 1, X8 #=< X7, X9 #>= 1, X9 #=< X8, X10 #>= 1,
X10 #=< X9, X11 #>= 1, X11 #=< X10, X12 #>= 1, X12 #=< X11,
X13 #>= 1, X13 #=< X12, X14 #=< X13 + 4, X14 #>= 1, X15 #>= 1,
X15 #=< X14, X16 #>= 1, X16 #=< X15, X17 #=< X16 + 6, X17 #>= 1,
X18 #>= 1, X18 #=< X17, X19 #>= 1, X19 #=< X18, X20 #>= 1,
X20 #=< X19, X21 #>= 1, X21 #=< X20, X21 #= 1.
Example queries:
?- vars(Vs), maplist(fd_dom, Vs, Ds).
Ds = [3..3, 1..3, 1..3, 1..3, 1..3, 1..6, 1..6, 1..6, ... .. ...|...]
?- vars(Vs), label(Vs).
Vs = [3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] ;
Vs = [3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1] ;
Vs = [3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1] ;
etc.
It's late enough that there are probably a number of slick reductions, but this works...
ineq={...};
pivotAt[set_, j_] := Select[set, And[
Not[FreeQ[#, x[u_] /; u <= j]],
FreeQ[#, x[u_] /; u > j]
] &]
triangularize[set_] := Module[{left, i, new},
left = set;
Reap[
For[i = 0, i <= 21, i++,
new = pivotAt[left, i];
Sow[new];
left = Complement[left, new];
]][[2, 1]]
]
Module[{
tri,
workingIntervals,
partials, increment, i
},
tri = triangularize[ineq];
workingIntervals[set_] := set /. {
t_ <= c_ :> {t, Interval[{-\[Infinity], Max[c]}]},
t_ == c_ :> {t, Interval[{Min[c], Max[c]}]},
t_ >= c_ :> {t, Interval[{Max[c], \[Infinity]}]}};
partials = {};
increment[slice_] :=
Rule[#[[1, 1]], IntervalIntersection ## #[[All, 2]]] &[
workingIntervals[slice /. partials ] ];
For[i = 1, i <= Length[tri], i++,
partials = Join[partials, {increment[tri[[i]]]}];
];
partials
]
It's permissive in that correlations between variables ("this high means that low") are not accounted.
-- EDIT --
The result of the above is, of course
{x[0] -> Interval[{3, 3}], x[1] -> Interval[{1, 3}],
x[2] -> Interval[{1, 3}], x[3] -> Interval[{1, 3}],
x[4] -> Interval[{1, 3}], x[5] -> Interval[{1, 6}],
x[6] -> Interval[{1, 6}], x[7] -> Interval[{1, 6}],
x[8] -> Interval[{1, 6}], x[9] -> Interval[{1, 6}],
x[10] -> Interval[{1, 6}], x[11] -> Interval[{1, 6}],
x[12] -> Interval[{1, 6}], x[13] -> Interval[{1, 6}],
x[14] -> Interval[{1, 10}], x[15] -> Interval[{1, 10}],
x[16] -> Interval[{1, 10}], x[17] -> Interval[{1, 16}],
x[18] -> Interval[{1, 16}], x[19] -> Interval[{1, 16}],
x[20] -> Interval[{1, 16}], x[21] -> Interval[{1, 1}]}
Are there many sets of values which satisfy the inequalities ?
I ran the following commands through Mathematica:
In[14]:= ineqs = {x0 == 3, x1 >= 1, x1 <= x0, x2 >= 1, x2 <= x1,
x3 >= 1, x3 <= x2, x4 >= 1, x4 <= x3, x5 <= x4 + 3, x5 >= 1,
x6 >= 1, x6 <= x5, x7 >= 1, x7 <= x6, x8 >= 1, x8 <= x7, x9 >= 1,
x9 <= x8, x10 >= 1, x10 <= x9, x11 >= 1, x11 <= x10, x12 >= 1,
x12 <= x11, x13 >= 1, x13 <= x12, x14 <= x13 + 4, x14 >= 1,
x15 >= 1, x15 <= x14, x16 >= 1, x16 <= x15, x17 <= x16 + 6,
x17 >= 1, x18 >= 1, x18 <= x17, x19 >= 1, x19 <= x18, x20 >= 1,
x20 <= x19, x21 >= 1, x21 <= x20, x21 == 1};
In[15]:= vars =
Union[{x0, x1, x1, x2, x2, x3, x3, x4, x4, x5, x5, x6, x6, x7, x7,
x8, x8, x9, x9, x10, x10, x11, x11, x12, x12, x13, x13, x14, x14,
x15, x15, x16, x16, x17, x17, x18, x18, x19, x19, x20, x20, x21,
x21, x21}];
In[16]:= FindInstance[ineqs, vars]
and got the result:
Out[16]= {{x0 -> 3, x1 -> 1, x10 -> 1, x11 -> 1, x12 -> 1, x13 -> 1,
x14 -> 1, x15 -> 1, x16 -> 1, x17 -> 1, x18 -> 1, x19 -> 1, x2 -> 1,
x20 -> 1, x21 -> 1, x3 -> 1, x4 -> 1, x5 -> 1, x6 -> 1, x7 -> 1,
x8 -> 1, x9 -> 1}}
I haven't been able to persuade Mathematica to provide another set of assignments and a little work with pencil and paper doesn't point me towards other sets of assignments. But it's late here, I may have missed something obvious.
OK, it turns out that solving this particular set of equations is
easy, once you rewrite some of them slightly:
x5 <= x4 + 3 becomes x5 - 3 <= x4
x6 <= x5 becomes x6 - 3 <= x5 - 3
and so on until:
x13 <= x12 becomes x13 - 3 <= x12 - 3
x14 <= x13 + 4 becomes x14 - 7 <= x13 -3
By doing this, {x0, x1, x2, x3, x4, x5-3, x6-3, ..., x13-3, x14-7, ..., x21}
becomes a strictly decreasing sequence of integers starting at 3
and ending at 1.
In fact, any sequence w/ that property works, since xi>=1 is trivally
satisfied.
However, while this works to solve this particular set of
inequalities, it doesn't work in general, so I don't consider it a
complete solution.

Resources