0
$\begingroup$

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]
$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – Bill Oct 5 '14 at 20:28
  • 3
    $\begingroup$ Simplify[Sign[a (1 - b) (1 - a - b)], 0 < a < 1 && 0 < b < 1 && a + b > 1]? $\endgroup$ – kglr Oct 5 '14 at 20:32
  • $\begingroup$ 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. $\endgroup$ – Tom G Oct 5 '14 at 20:59
  • $\begingroup$ @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. $\endgroup$ – DumpsterDoofus Oct 5 '14 at 22:59
  • $\begingroup$ @DumpsterDoofus: I have updated the question with the example code. $\endgroup$ – Tom G Oct 6 '14 at 19:43
4
$\begingroup$
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}}}]

enter image description here

$\endgroup$
  • $\begingroup$ Thanks. Very helpful for the visualization! $\endgroup$ – Tom G Oct 6 '14 at 19:43
2
$\begingroup$
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]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.