# Evaluating the sign of a derivative

I would like to know the sign of the derivative of a function (for instance whether it is always positive or not). Also, how can I specify that the parameter with respect to which I differentiate can only take positive values?

Here is the function:

D[expr[p, v0, σ], p]


and below the expressions for the other functions or variables used.

ER[p_, v0_, σ_] :=
v0 - σ ψ[(p - v0)/σ]/Φ[(p - v0)/σ];

del[p_, v0_, σ_] := - ψ[(p - v0)/σ]/Φ[(p - v0)/σ] *(- ψ[(p - v0)/σ]/Φ[(p -v0)/σ] - (p - v0)/σ);

VAR[p_, v0_, σ_] := σ^2 (1 - del[p, v0, σ]);

expr[p_, v0_, σ_] := (p -ER[p, v0, σ])^2 Φ[(p - v0)/σ] (1 - Φ[(p - v0)/σ]) +  VAR[p, v0, σ] Φ[(p - v0)/σ];

Φ[x_] := CDF[NormalDistribution[], x];
ψ[x_] := PDF[NormalDistribution[], x];


I have tried the following code but it returns an error (probably because it cannot take a function as input)

Assuming[
p > 0 && v0 > 0  && σ > 0,
Simplify[Sign[[D[expr[p, v0, σ], p]]]]
]


Would the compile function be useful in this case? Thank you so much for your help, highly appreciated.

• At a minimum you have too many square brackets in your Sign expression within Simplify. Have you tried Simplify[Sign[D[expr[p, v0, σ], p]]]? It is always more helpful if you include the text of any error you get, rather than just saying that you get an error. – MarcoB Jan 10 at 17:42