I am formalizing a stochastic and translating into the Stan probabilistic programming language.
Long story short: it's a measurement error model with a sub-model that uses the following function $y(t)$. But I need some additional information from that function and I'm asking your help with calculus -and maybe with Wolfram alpha for an approximate solution if there is'n a closed formulation- to find the inflection points (second order derivative in respect of $t$) of the following function (the panettone function): $$ y(t) = A \sin^n\left(\pi\,\frac{t-t_s}{t_r-t_s}\right) $$ that is defined in the domain $(t_r, t_s)$ there $0 < t_r< \frac{1}{2}$ and $\frac{1}{2} < t_s < 1$.
$A>0$, $n>0$, $t_s$, and $t_r$ are parameters. The function has a maximum for $t=\frac{1}{2}$.
I wrote on the paper the first derivative but I'm stuck writing the second derivative.
Thanks for any help!