# Variable Value as Range

Thank you for the help so far!

I would like to assign +/i signs for the function and solution such as (+)(+)(-) and therefore (-).

It is working for the first evaluation, λlower, but not for the second evaluation, λupper. I cannot see the difference - has it to do with "λi /. Solve" in both definitions?

    (* Endogenous *)
Clear[μ, ξ, β, γ, ri, si, rj, sj, λCri, λCsi , λlower, λupper, λlowereip, λip];
(* Exogenous *)
Clear[ ci, yp, λi, αi, ϵip, ηip, eip];
ri = ϵip*λi + (1 - ηip)*(1 - λi);
si = ηip*(1 - λi) + (1 - ϵip)*λi;
λCri = (ϵip*λi)/(ϵip*λi + (1 - ηip)*(1 - λi));
λCsi = (ηip*(1 - λi))/(ηip*(1 - λi) + (1 - ϵip)*λi);
λlower = λi /.
Solve[ri*(yp - eip - ci + αi*λCri) + si*(yp - eip + αi*(1 - λCsi)) == yp + αi*(1 - λi), {λi}];
λupper = λi /.Solve[ri*(yp - eip - ci + αi*λCri) +
si*(yp - eip + αi*(1 - λCsi)) == yp + αi*λi - ci, {λi} ];
Simplify[D[λlower, eip]]
Simplify[Sign[D[λlower, eip]], αi > 0 && eip > 0 && ci > 0 && 0 < ϵip < 1 && 0 < ci < 1 && 0 < ηip < 1 && αi > ci && αi > ci + eip && ϵip + ηi < 1]
Simplify[D[λupper, eip]]
Simplify[Sign[D[λupper, eip]], αi > 0 && eip > 0 && ci > 0 && 0 < ϵip < 1 && 0 < ci < 1 && 0 < ηip < 1 && αi > ci && αi > ci + eip && ϵip + ηi < 1]

• Mathematica supports intervals, a = Interval[{0, 1}] and Assuming[0<a<1,Simplify[...]] Perhaps you can use one or both of those and see if you can get where you want to go, BUT in my experience it sometimes doesn't propagate through a chain of statements to give what you can sometimes see the answer should be. – Bill Oct 5 '14 at 20:28
• Simplify[Sign[a (1 - b) (1 - a - b)], 0 < a < 1 && 0 < b < 1 && a + b > 1]? – kglr Oct 5 '14 at 20:32
• If I use \[Lambda]lowereip = Simplify[D[\[Lambda]lower, eip]] Simplify[Sign[\[Lambda]lowereip], 0 < \[Epsilon]ip < 1 && 0 < ci < 1 && 0 < \[Eta]ip < 1 && \[Alpha]i > ci && \[Alpha]i > ci + eip && \[Epsilon]ip + \[Eta]i < 1] , then I get only {{0 -> ...}} However, if I use the value of [Lambda]lowereip and copy it and define it as "x" x = 1/(2 \[Alpha]i - ci (-1 + \[Epsilon]ip + \[Eta]ip)) Simplify[Sign[x], 0 < \[Epsilon]ip < 1 && 0 < ci < 1 && 0 < \[Eta]ip < 1 && \[Alpha]i > ci && \[Alpha]i > ci + eip && \[Epsilon]ip + \[Eta]i < 1] it is working. – Tom G Oct 5 '14 at 20:59
• @TomG: I tried evaluating \[Lambda]lowereip = Simplify[D[\[Lambda]lower, eip]] Simplify[Sign[\[Lambda]lowereip], 0 < \[Epsilon]ip < 1 && 0 < ci < 1 && 0 < \[Eta]ip < 1 && \[Alpha]i > ci && \[Alpha]i > ci + eip && \[Epsilon]ip + \[Eta]i < 1] which produces 0. That's because you forgot to post the relevant parts of your code, and we can't help you if you forget to post the code that your question is about. :) Also, note that kguler's suggestion solves the question as you asked it, so unless we're missing something, your question appears to be answered. – DumpsterDoofus Oct 5 '14 at 22:59
• @DumpsterDoofus: I have updated the question with the example code. – Tom G Oct 6 '14 at 19:43

exp = {Sign[a], Sign[1 - b], Sign[1 - a - b],
Sign[a (1 - a) (1 - a - b)]};
ref = Assuming[{0 < a < 1 && Element[a, Reals] 0 < b < 1 &&
Element[b, Reals] && a + b > 1}, Refine[exp]];
Grid[{exp, ref /. {1 -> "+", -1 -> "-"}},
Dividers -> {{True, {None}, True, True}, {{True}}}] • Thanks. Very helpful for the visualization! – Tom G Oct 6 '14 at 19:43
expressions = {a, 1 - a, 1 - b, a + b, a (1 - b) (1 - a - b)};
assumptions = 0 < a < 1 && 0 < b < 1 && a + b > 1;

signF = Simplify[Sign@#, #2]  /. {1 -> "+", -1 -> "-"} &;

signF[expressions, assumptions]
(* {"+","+","+","+","-"} *)

Grid[{expressions, signF[expressions, assumptions]}, Dividers -> All] 