For the following function, I am testing the convexity in $\lambda$. All parameters are in $\mathbb{R}^+$.
$$\frac{\left(- \lambda \left(b + \frac{p}{\beta}\right) + 1\right) \left(\left(1 + \frac{p}{\beta}\right) \left(b^{2} \lambda^{2} + \frac{2 b \lambda^{2} p}{\beta} + \frac{2 \lambda^{2} p}{\beta^{2}}\right) + \left(2 b \lambda \left(1 + \frac{p}{\beta}\right) + 2 \lambda p \left(\frac{1}{\beta} + \frac{1}{\beta^{2}}\right)\right) \left(- b \lambda + 1 - \frac{\lambda p}{\beta}\right)\right)}{2 \left(1 + \frac{p}{\beta}\right) \left(- b \lambda + 1 - \frac{\lambda p}{\beta}\right)^{2}}$$
I used Sympy to see the second derivative with respect to $\lambda$ as follows.
$$- \frac{\beta \left(b^{2} \beta^{2} + 2 b \beta p + 2 p\right)}{b^{3} \beta^{3} \lambda^{3} - 3 b^{2} \beta^{3} \lambda^{2} + 3 b^{2} \beta^{2} \lambda^{3} p + 3 b \beta^{3} \lambda - 6 b \beta^{2} \lambda^{2} p + 3 b \beta \lambda^{3} p^{2} - \beta^{3} + 3 \beta^{2} \lambda p - 3 \beta \lambda^{2} p^{2} + \lambda^{3} p^{3}}$$
Since there are lots of terms, it is not easy to understand whether it is $\geq 0$ or not. I set some values for $b$, $\beta$, and $p$ to see how it goes. When $p$ is very small (e.g., $p=0.00001$), $\beta = 0.021$, and $b=0.0021$, it seems to be convex. But, is there any way to make sure convexity (if true) without setting values to other parameters?
Update:
I also have a condition for the domain of the parameters: $\frac{\lambda \left(b + \frac{p}{\beta}\right)}{1 + \frac{p}{\beta}}<1$.
Update2:
Based on the answer, I minimized the second derivative subject to non-negativity constraint and the condition with the following code.
from pyomo.environ import *
m= ConcreteModel('Convexity')
m.lmbda = Var(domain=NonNegativeReals)
m.beta = Var(domain=NonNegativeReals)
m.b = Var(domain=NonNegativeReals)
m.p = Var(domain=NonNegativeReals)
m.OBJ = Objective(expr = (-m.beta*(m.b**2*m.beta**2
+ 2*m.b*m.beta*m.p + 2*m.p)/
(m.b**3*m.beta**3*m.lmbda**3 -
3*m.b**2*m.beta**3*m.lmbda**2 +
3*m.b**2*m.beta**2*m.lmbda**3*m.p +
3*m.b*m.beta**3*m.lmbda
- 6*m.b*m.beta**2*m.lmbda**2*m.p
+ 3*m.b*m.beta*m.lmbda**3*m.p**2
- m.beta**3 + 3*m.beta**2*m.lmbda*m.p
- 3*m.beta*m.lmbda**2*m.p**2 + m.lmbda**3*m.p**3)),
sense=minimize)
def Traffic(m):
return ((m.lmbda*(m.b+m.p/m.beta))/(1+m.p/m.beta) <= 0.99999999999)
m.AxbConstraint = Constraint(rule=Traffic)
opt = SolverFactory('ipopt', tee=True)
print(opt.solve(m))
The output log and the objective value is as follows:
Problem:
- Lower bound: -inf
Upper bound: inf
Number of objectives: 1
Number of constraints: 1
Number of variables: 4
Sense: unknown
Solver:
- Status: ok
Message: Ipopt 3.11.1\x3a Optimal Solution Found
Termination condition: optimal
Id: 0
Error rc: 0
Time: 0.18944215774536133
Solution:
- number of solutions: 0
number of solutions displayed: 0
Objective Value: 3.302498039268864e-09