# Comparative Statics on Mathematica

Let me first explain what I am doing then I will mention my little problem that I could not figure out. I am using Mathematica version 7. I have an equation named "fd" and I took the derivative of "fd" with respect to t which I will note the outcome as Dfdt. Basically, I am trying to understand if Dfdt is negative or positive (Comparative Statics) and in order to do this I put some assumptions on the parameters in the simplify function which will be seen in my code below. However, as a outcome I get a general restriction outcome which satisfies Dfdt being positive or negative. Are there any possible methods/codes to take out the parameters values which satisfies Dfdt being positive or negative ?

      In[54]:=
Remove["Global*"]
q = 1 - p;
fd = (b d (p - q) Y1 Y2 (p Y1 - q Y2) +
a p q t (Y1 + Y2)^2 (p (-1 + Y1^2) Y2 +
q Y1 (-1 + Y2^2)))/(a p q t (Y1 + Y2)^2 (p (-1 + Y1^2) Y2 +
q Y1 (-1 + Y2^2)));
Dfdt = D[fd, t]
Simplify[Dfdt > 0,  Y2 > Y1 > 0 && t > 0 && 1 > a > 0 && 1 > b > 0 && 1 > d > 0
&& 1 > p > 0 ]
Simplify[Dfdt < 0,  Y2 > Y1 > 0 && t > 0 && 1 > a > 0 && 1 > b > 0 && 1 > d > 0
&& 1 > p > 0 ]

Out[55]:= 1/t - (b d (-1 + 2 p) Y1 Y2 (p Y1 - (1 - p) Y2) +
a (1 - p) p t (Y1 + Y2)^2 (p (-1 + Y1^2) Y2 + (1 - p) Y1 (-1 + Y2^2)))/(a (1 - p) p t^2 (Y1
+ Y2)^2 (p (-1 + Y1^2) Y2 + (1 - p) Y1 (-1 + Y2^2)))

Out[56]:= (-1 + 2 p) (-Y2 + p (Y1 + Y2)) (p Y2 - p Y1^2 Y2 + (-1 + p) Y1 (-1 + Y2^2)) > 0
Out[57]:= (-1 + 2 p) (-Y2 + p (Y1 + Y2)) (p Y2 - p Y1^2 Y2 + (-1 + p) Y1 (-1 + Y2^2)) < 0

-
You could try Reduce: Reduce[{Dfdt > 0, Y2 > Y1 > 0 && t > 0 && 1 > a > 0 && 1 > b > 0 && 1 > d > 0 && 1 > p > 0}] and Reduce[{Dfdt < 0, Y2 > Y1 > 0 && t > 0 && 1 > a > 0 && 1 > b > 0 && 1 > d > 0 && 1 > p > 0}] – Sjoerd C. de Vries Jun 4 '13 at 22:23

You can make a simplification noting that your fd is a fraction and therefore its derivative is a fraction with a squared denominator, which is always positive and need not be considered. My proposal is to calculate the derivative "by hand".

expr = FullSimplify[fd];
Dexprdt = Simplify[D[Numerator[expr], t] Denominator[expr] -
Numerator[expr] D[Denominator[expr], t]];


The solution for positive values is then :

solPos = LogicalExpand[Reduce[Dexprdt > 0, Reals]];
solPos // Dimensions
(* {2576} *)


Check solution 1 and 2001 say :

N[Dexprdt] /. First@FindInstance[solPos[[1]], {Y1, Y2, a, b, d, p}]
(* 5.59992*10^11 *)

N[Dexprdt] /. First@FindInstance[solPos[[2001]], {Y1, Y2, a, b, d, p}]
(* 0.255154 *)


Compare the above two lines to using your original function though :

FullSimplify[N[Dfdt] /. First@FindInstance[solPos[[1]], {Y1, Y2, a, b, d, p}]]
(* (0.301644 + 2.22045*10^-16 t)/t^2 *)


This can be negative for extremely large (and negative) t; if it makes sense, you can apply Chop to get rid of the small number.

The other seems ok :

FullSimplify[N[Dfdt] /. First@FindInstance[solPos[[2001]], {Y1, Y2, a, b, d, p}]]
(* 3.58048/t^2 *)

-
Thank you very much for a really helpful answer. I have one question, when you obtain a numeric solution "N[Dexprdt]" for solPos[1] = (Y1 == -1 && Y2 == -(1/Sqrt[2]) && a > 0 && b > 0 && d > 0 && p > 1) the system only substitutes a value of a,b,d and p which makes the system positive, right? Or does it also satisfy that for all values of a,b,d > 0 && p > 1 given Y1==-1 && Y2 == -(1/Sqrt[2]) it is positive ? – HarveyMudd Jun 5 '13 at 8:59
And since it has 2576 solutions are there any possible ways that I can only choose the solutions where p is greater than 0 in the logical expand without checking all 2576 solutions by hand ? – HarveyMudd Jun 5 '13 at 9:07
@HarveyMudd The solution is generic, so you get inequalities; I wanted to make a quick check so I used FindInstance to pick one particular choice of solPos[[1]]` say. – b.gatessucks Jun 5 '13 at 10:39
Thank you very much. I have a different question related with this problem about extracting the positive set of solutions and I asked in a different title since people who have problems regarding the issue will get an idea under that title. Thanks again for a very useful answer. – HarveyMudd Jun 5 '13 at 10:54