# Compute the half width and full width at half maximum (HWHM / FWHM) of a mathematical expression

I have managed to compute the half width at half maximum (HWHM) and full width at half maximum (FWHM) of a sinc function through the code below.

ClearAll["Global*"]
Plot[Sin[\[Pi]*x]/(\[Pi]*x), {x, -2, 2}, PlotRange -> Full, Exclusions -> None, GridLines -> Automatic, ImageSize -> Full]
Normal[Series[Sin[\[Pi]*x]/(\[Pi]*x), {x, 0, 12}]]
Plot[Evaluate[Normal[Series[Sin[\[Pi]*x]/(\[Pi]*x), {x, 0, 12}]]], {x,-2, 2}, PlotRange -> Full, Exclusions -> None, GridLines -> Automatic, ImageSize -> Full]
N[Solve[Normal[Series[Sin[\[Pi]*x]/(\[Pi]*x), {x, 0, 12}]] == 1/2, x]]


where the HWHM is equal to the absolute value of the lowest Real root, and the FWHM is two times this value.

I have tryed to apply the same procedure to compute the HWHM and FWHM of $\int_{0}^{t} \cos\left( 2\pi f_{c}\tau \right) \cos\left[ 2\pi\left( kt + f_{0}\right)\tau \right]\; d\tau$, where $f_{c} = 2\times 10^9$, $k=30\times 10^{15}$ and $f_{0}=0.5\times 10^9$, with the following code.

ClearAll["Global*"]
Subscript[f, c] = 2*10^9;
k = 30*10^15;
Subscript[f, 0] = 0.5*10^9;
Subscript[s, out] = \!$$\*SubsuperscriptBox[\(\[Integral]$$, $$0$$, $$t$$]$$Cos[2*\[Pi]*\*SubscriptBox[\(f$$, $$c$$]*\[Tau]]*Cos[2*\[Pi]*$$(k*t + \*SubscriptBox[\(f$$, $$0$$])\)*\[Tau]] \[DifferentialD]\[Tau]\)\)
Plot[Subscript[s, out], {t, 49*10^-9, 51*10^-9}, PlotRange -> Full,  Exclusions -> None, GridLines -> Automatic, ImageSize -> Full]
soutexpansion = Expand[Normal[Series[Subscript[s, out], {t, 50*10^-9, 2}]]]
Plot[Evaluate[soutexpansion], {t, 49.6*10^-9, 50.4*10^-9}, PlotRange -> Full, Exclusions -> None, GridLines -> Automatic, ImageSize -> Full]
Solve[soutexpansion == (2.5*10^-8)/2, t]


I know the maximum is at $t=50\times 10^{-9}$, and that it attains a value of $2.5\times10^{-8}$. However, after the Taylor expansion around $t=50\times 10^{-9}$, I cannot reconstruct the curve around this point. QUESTION 1: Ploting the expanded second order polynomial, as in the snippet, the parabola shows a positive concavity. Shouldn't it have a negative concavity?

I have applied a trigonometric identity to rearange the termes of the integrand and thus were able to reconstruct the expression around $t=50\times 10^{-9}$ with the code below.

Subscript[s, out2] = \!$$\*SubsuperscriptBox[\(\[Integral]$$, $$0$$, $$t$$]$$\*FractionBox[\(1$$, $$2$$]*$$(Cos[2*\[Pi]*\((k*t + \*SubscriptBox[\(f$$, $$0$$] - \*SubscriptBox[$$f$$, $$c$$])\)*\[Tau]] + Cos[2*\[Pi]*$$(k*t + \*SubscriptBox[\(f$$, $$0$$] + \*SubscriptBox[$$f$$, $$c$$])\)*\[Tau]])\) \[DifferentialD]\[Tau]\)\)
Plot[Subscript[s, out2], {t, 49.6*10^-9, 50.4*10^-9}, PlotRange -> Full, Exclusions -> None, GridLines -> Automatic, ImageSize -> Full]
Subscript[s, out2series] = Normal[Series[Subscript[s, out2], {t, 50*10^-9, 30}]]
Plot[Evaluate[Subscript[s, out2series]], {t, 49.6*10^-9, 50.4*10^-9}, PlotRange -> Full, Exclusions -> None, GridLines -> Automatic, ImageSize -> Full]
Solve[Subscript[s, out2series] == (2.5*10^-8)/2, t]


However, this time, when I try to find the roots of the expression that would lead me to the value of the HWHM and FWHM, all roots returned have the same value, what does not make sense.

QUESTION 2: Am I missing something? Is it correct what I am doing?

QUESTION 3: Is there a better way to find the HWHM and FWHM of the above function?

• Generally you should avoid Subscript while defining variables. Subscript[x, 1] is not a symbol, but a composite expression where Subscript is an operator without built-in meaning. You expect to do $x_1=2$ but you are actually doing Set[Subscript[x, 1], 2] which is to assign a Downvalue to the oprator Subscript and not an Ownvalue to an indexed x as you may intend. Read how to properly define indexed variables here – rhermans Sep 26 '17 at 16:53

There is no need to use series expansions. Use NSolve

ClearAll["Global*"]

hwhm = x /. NSolve[{Sinc[π x] == 1/2, 0 < x < 2}, x, Reals][[1]]

(*  0.603355  *)

fwhm = 2 hwhm

(*  1.20671  *)

ClearAll["Global*"]
f[c] = 2*^9;
k = 30*^15;
f[0] = 5*^8;

s[out][t_] = Integrate[
Cos[2*Pi*f[c]*τ]*Cos[2*Pi*(k*t + f[0])*τ],
{τ, 0, t}];


EDIT: Corrected error in not considering offset

hwhm = (t /.
NSolve[{s[out][t] == 25*^-9/2, 5*^-8 < t < 51*^-9}, t, Reals][[1]]) -
5*^-8

(*  2.00922*10^-10  *)

fwhm = 2 hwhm

(*  4.01845*10^-10  *)

• Thank you for your answer! I just changed it a little. The peak accours at 50*^-9 and not at the origin, like in the sinc. This changes the computation of HWHM. Also, the peak is almost simetrical, but not perfectly, so I changed the last two lines by: rootplus = t1 /. NSolve[{s[out][t1] == 25*^-9/2, 5*^-8 < t1 < 51*^-9}, t1, Reals][[1]]; rootminus = t0 /. NSolve[{s[out][t0] == 25*^-9/2, 4.96*^-8 < t0 < 5*^-8}, t0, Reals][[1]]; hwhmplus = rootplus - 50*^-9; hwhmminus = 50*^-9 - rootminus; fwhm = rootplus - rootminus; fwhm = hwhmplus + hwhmminus. – Joao Alberto Sep 26 '17 at 14:54