# How to set a variable between 1 and 0, and how to check the FOC is greater or small than 0 by assumption?

I have the following notebook:

$Assumptions = Flatten[{Thread[{c0, c1, p, w, e} > 0],Thread[0 <= {{r, i, x, alpha, beta, gamma, {1 - alpha - beta - gamma}, {1 + r - i}, {1 - x}} <= 1}], Element[{c0, c1, p, w, e, r, i, x, alpha, beta, gamma, {1 - alpha - beta - gamma}, {1 + r - i}, {1 - x}}, Reals]}] case11 = ((1 - x)*alpha*(c0 + e + w + w/(1 + r - i))); case12 = ((1 - x)*gamma*(c0 + w - p/(1 + r - i))); case13 = x*(c0 - p); case21 = ((1 - x)*(1 - alpha - beta - gamma)*(c0 + c1/(1 + r - i) + e+ w+ w/(1 + r - i))); case22 = ((1 - x)*beta*(c0 + c1/(1 + r - i) - p/(1 + r - i) + w)); case23 = (x*(c0 - p)); f = case11 + case12 + case13; h = case21 + case22 + case23; g = e + w + w/(1 + r - i); occc=g/h; ocdc=g/f;  I would like to check if D[occc,p] is positive, i tried to run the Positive, but seems it does not work, it did not give me True of False as a result. I believe I need to have more condition to make D[occc,p to be positive, I would like to know those conditions,the word "conditions" i would like to see is something like c0>p, can Mathematica tell me? Thanks • It is impossible to help until you clarify your assumptions. As written, they make no sense. – Bob Hanlon Aug 27 '14 at 14:16 • Hi, my assumption is c0, c1, w, e, p all greater than 0 and they are all real number. but r, i, x, alpha, beta, gamma are all between 0 and 1. Particularly, x, alpha, beta, gamma are probabilities; r, i are nominal interest rate and inflation respectively. Sorry, I am completely newbie to mathematica, and do not know what it the meaning of each syntax, the assumption syntax is from some question's answer. Sorry if I made any misunderstanding. – Chris_Lam Aug 27 '14 at 16:07 ## 1 Answer It can be zero but not negative. To show this we first rewrite the assumptions so they are actually usable, removing those that are redundant and getting the Thread to work by getting rid of inner lists (things in curly braces). $Assumptions =
Flatten[{Thread[{c0, c1, p, w, e} > 0],
Thread[0 <= {r, i, x, alpha, beta, gamma,
1 - alpha - beta - gamma, 1 + r - i, 1 - x} <= 1],
Element[{c0, c1, p, w, e, r, i, x, alpha, beta, gamma}, Reals]}];

case11 = ((1 - x) alpha (c0 + e + w + w/(1 + r - i)));
case12 = ((1 - x) gamma (c0 + w - p/(1 + r - i)));
case13 = x*(c0 - p);
case21 = ((1 - x) (1 - alpha - beta - gamma) (c0 + c1/(1 + r - i) +
e + w + w/(1 + r - i)));
case22 = ((1 - x) beta (c0 + c1/(1 + r - i) - p/(1 + r - i) + w));
case23 = (x*(c0 - p));

f = case11 + case12 + case13;
h = case21 + case22 + case23;
g = e + w + w/(1 + r - i);

occc = g/h;
ocdc = g/f;


Now compute the derivative and break it into numerator and denominator.

deriv = Together[D[occc, p]];
{numer, denom} = Through[{Numerator, Denominator}[deriv]]

(* Out[194]= {(-e + e i - e r - 2 w + i w - r w) (-beta - x + beta x +
i x - r x), (-c0 + alpha c0 - c1 + alpha c1 - e + alpha e +
beta e + c0 gamma + c1 gamma + e gamma + c0 i - alpha c0 i + e i -
alpha e i - beta e i - c0 gamma i - e gamma i + beta p - c0 r +
alpha c0 r - e r + alpha e r + beta e r + c0 gamma r + e gamma r -
2 w + 2 alpha w + beta w + 2 gamma w + i w - alpha i w -
gamma i w - r w + alpha r w + gamma r w - alpha c0 x + c1 x -
alpha c1 x + e x - alpha e x - beta e x - c0 gamma x - c1 gamma x -
e gamma x + alpha c0 i x - e i x + alpha e i x + beta e i x +
c0 gamma i x + e gamma i x + p x - beta p x - i p x -
alpha c0 r x + e r x - alpha e r x - beta e r x - c0 gamma r x -
e gamma r x + p r x + 2 w x - 2 alpha w x - beta w x -
2 gamma w x - i w x + alpha i w x + gamma i w x + r w x -
alpha r w x - gamma r w x)^2} *)


The denominator is a square, hence nonnegative. So all that needs to be tested for negativity is the numerator. We can use FindInstance to tell us if that can happen, as below.

FindInstance[Flatten[{numer < 0, $Assumptions}], Variables[D[occc, p]]] (* Out[197]= {} *)  Or use Refine-- it automatically absorbs the $Assumptions.

Refine[numer < 0]

(* Out[198]= False *)


So the expression is in fact nonnegative. It can be zero, as a simple FindInstance computation will indicate.

• Hi, if I tried Daniel's way to check the if FOC of occc wrt to e is positive, and FindInstance gives me the following {{alpha -> 0, beta -> 0, gamma -> 0, e -> 1, w -> 1, i -> 0, r -> 0, x -> 1, c0 -> 1/2, c1 -> 1, p -> 1}} how to interpret this result? Is it the condition that for D[occc,e] is <0? – Chris_Lam Aug 27 '14 at 16:41
• That is a solution for whatever you queried in FindInstance. If the query was FindInstance[D[occc,e]<0,...] then that gives values for alpha, beta,... for which the inequality holds. That is to say, it is a sufficient but not necessary condition. – Daniel Lichtblau Aug 27 '14 at 18:45
• so that means there is a case for D[occc,p] is less than 0. how should I do for make this case as a symbolic equation? that is, expressing if this case fulfilled D[occc,p]<0 by an equation – Chris_Lam Aug 27 '14 at 19:39