Manipulate for average value of a function

j[t_]=(9 t)/(81 + t^2)^(3/2)
s[b_,t_] = 1/b * NIntegrate[j[t],{t,0,b}]
Plot[s[b,t], {b, -15, 15}, PlotRange -> {-0.04, 0.04}]

1/b * NIntegrate[j[t],{t,0,b}] represents the formula for the average value of a function from 0 to b, and I am seeking to maximize the average value of the function s[b,t] over this interval. How would I go about creating a Manipulate function where the position of a graphic (e.g. a dot) can be adjusted to move it along the curve and display the value of the function at the point set in the manipulate to visually determine the maximum value on such a plot?

Clear["Global*"]

j[t_] = (9 t)/(81 + t^2)^(3/2);

Note that s has only one argument, that is b; t is the variable of integration.

s[b_?NumericQ] := 1/b*NIntegrate[j[t], {t, 0, b}]

The maximum is given by

{max, arg} = NMaximize[{s[b], -15 < b < 15}, b]

(* {0.0333648, {b -> 11.4482}} *)

Manipulate[
Module[{pt = {bp, s[bp]}},
Plot[Evaluate@s[b], {b, -15, 15},
PlotRange -> {-0.04, 0.04},
Frame -> True,
Epilog -> {
Text[pt[], pt, Sign[bp] {1.5, -2}],
Red, AbsolutePointSize,
Point[pt]}]],
{{bp, 1, "Point"}, -15, 15, 0.05, Appearance -> "Labeled"}] For exact values

s2[b_] = 1/b*Integrate[j[t], {t, 0, b}]

(* (1 - 9/Sqrt[81 + b^2])/b *)

{max2, arg2} = Maximize[{s2[b], -15 < b < 15}, b] // Simplify

(* {(-2 + Sqrt[2 (3 + Sqrt)])/(
18 Sqrt[2 + Sqrt]), {b -> 9 Sqrt[1/2 (1 + Sqrt)]}} *)

The approximate values are as before.

{max2, arg2} // N

(* {0.0333648, {b -> 11.4482}} *)
• What does bp represent here? How could this be modified to also display the output of s[b] in the manipulate? Sep 4 '20 at 16:38
• The coordinates of the moving point are {bp, s[bp]}, i.e., bp is the argument of the function for the moving point. The control changes the value of bp with the control label displaying the value of bp. The added Text displays the corresponding value of s[bp]. Sep 4 '20 at 16:58
• When I replace it with  {s[bp],1,"point"} ` the plot won't display, giving the error "does not have the correct form for a variable specification". Any idea why it is happening? Sep 4 '20 at 19:49
• The control variable must be a variable. When you replaced bp with s[bp], bp is no longer defined and the control definition has the wrong syntax. Sep 4 '20 at 19:54