Intervals where a function is convex and/or concave I find myself in need of the solution of the following problem for my work. An help is appreciated.
Let $a$ be a real such that $0 \le a \le 1$. For what real values of $y$ is the function 
$$
f(x) = a^{x^y}
$$
1) always concave for all $x \ge 0$.
2) always convex for all $x \ge 0$.
3) Is there a finite interval $\alpha \le y \le \beta $ where $f(x)$ is sometimes concave and sometimes convex?
I am looking for answers in a parametric form in terms of $a$.
 A: The case $x = 0$ is a bit annoying, since it is not unambiguously clear how to define $0^z$. So let us suppose that (for $z \in [0,\,\infty]$)
$$0^z = \begin{cases}0 &, z > 0\\ 1 &, z = 0\\
\infty &, z < 0\end{cases}$$
and $1^z = 1$ for all $z \in [0,\, \infty]$ to solve the potentially ambiguous cases.
Let's first do away with the edge cases.
For $a = 1$, we have $f(x) = 1$, so $f$ is both convex and concave on all of $[0,\,\infty)$.
For $a = 0$, we have $f(x) = 0$ for $x > 0$, and
$$f(0) = \begin{cases}1 &, y > 0\\0 &, y \leqslant 0,\end{cases}$$
so $f$ is convex on all of $[0,\,\infty)$, and concave on $(0,\,\infty)$, and for $z \leqslant 0$ it is concave even on $[0,\,\infty)$.
Next, for $y = 0$, we have $x^y \equiv 1$, hence $f(x) = a$ for all $x \in [0,\,\infty)$, hence $f$ is convex and concave on all of $[0,\,\infty)$ in this case too.
For $y = 1$, we have $f(x) = a^x$, which is known to be convex on $\mathbb{R}$, and nowhere concave (since $a \notin \{0,\,1\}$).
For the generic case, consider the second derivative. $f$ is convex on intervals where $f'' \geqslant 0$ and concave on intervals with $f'' \leqslant 0$. So
$$\begin{align}
f'(x) &= \frac{d}{dx} \exp \left(x^y\log a\right) = f(x) \cdot y\cdot x^{y-1}\cdot\log a\\
f''(x) &= f'(x) y\cdot x^{y-1}\log a + f(x) y(y-1)x^{y-2}\log a\\
&= f(x) y\cdot x^{y-2}\log a\left(y\cdot x^y\log a + (y-1)\right).
\end{align}$$
We know $\log a < 0$.
If $0 < y < 1$, then both factors $f(x) y\cdot x^{y-2}\log a$ and $y\cdot x^y\log a + (y-1)$ are always negative, so $f'' > 0$ and $f$ is (strictly) convex on $[0,\,\infty)$.
If $y < 0$, the factor $f(x) y\cdot x^{y-2}\log a$ is always positive, and the factor $y\cdot x^y\log a + (y-1)$ is negative for large $x$, and positive for small $x$, since $\lim\limits_{x \to 0^+} x^y = \infty$ and $\lim\limits_{x\to\infty} x^y = 0$. $x^y$ is strictly monotonic, so then $f$ is convex on an interval $[0,\, c_y]$ and concave on $[c_y,\, \infty)$. It remains to find $c_y$, that is, the zero of $f''$.
$$\begin{align}
0 &= y\cdot x^y\log a + (y-1)\\
\iff x^y &= \frac{1-y}{y\log a}\\
\iff x &= \left(\frac{1-y}{y\log a}\right)^{\frac1y}.
\end{align}$$
The same computation locates the zero of $f''$ in the case $y > 1$, but then the factor $f(x) y\cdot x^{y-2}\log a$ is always negative (or $0$), and the factor $y\cdot x^y\log a + (y-1)$ is again positive for small $x$ and negative for large $x$, so then $f$ is concave on $[0,\, c_y]$ and convex on $[c_y,\, \infty)$.
So $f$ is always concave if and only if $f$ is constant, that is the case for $y = 0$, or $a = 1$, or $a = 0$ and $y\leqslant 0$.
$f$ is always convex, if $a = 1$, $a = 0$, or $0 \leqslant y \leqslant 1$.
If $0 < a < 1$ and ($y < 0$ or $y > 1$), then $[0,\,\infty)$ decomposes into two intervals, $f$ is convex on one, and concave on the other.
