0

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!

Sebastiano
  • 7,649
Fabio
  • 313

1 Answers1

1

Note that $y(t)$ has a maximum at $t = (t_r+t_s)/2$. The second derivative of $y(t)$ is $$ y''(t) = \frac{A n^2 \pi^2}{2(t_s-t_r)^2} \sin^{n-2}\left(\pi\frac{t_s-t}{t_s-t_r}\right)\left(\cos\left(2\pi \frac{t_s-t}{t_s-t_r}\right) + 1 - \frac{2}{n}\right). $$ The goal is to find any inflection points in the open interval $(t_r,t_s)$. There are none for $n \le 1$. For $n>1$ the inflection points are at $$ t = \frac{t_r+t_s}{2} \pm \frac{t_s-t_r}{2\pi} \cos^{-1} \left(\frac{n-2}{n}\right). $$

Jim Ferry
  • 2,323
  • Did you use a program of symbolic math to solve the problem? Because I have more model to develop and I would like to find inflections points accordingly. – Fabio Sep 19 '23 at 13:36
  • Yes, I took the second derivative with Mathematica and then used it to find the zeroes. This could have been done by hand as well, but Mathematica was easier. Fortunately my job pays for my license, but if you don't have access to Mathematica or Maple, SageMath is apparently a good free option. – Jim Ferry Sep 20 '23 at 14:38