In[]:=
(*Interpolationutil*)​​interpol[s_,a_,b_]:=a+s*(b-a);​​​​g[s_,x_]=interpol[s,1/2,0]*x+interpol[s,1,0];​​f[s_,x_]=Sin[x-1]+g[s,x];​​​​fD[a_]:=D[f[s,x],x]/.x->a;​​meanPoint[s_]=Solve[fD[x]==avgSlope[s]&&x>1&&x<Pi+1,x]//Flatten//Last//Last;​​​​avgSlope[s_]=(f[s,Pi+1]-f[s,1])/Pi;​​​​tangentLine[s_,x_]=Module[{a,m},​​a=meanPoint[s];​​m=fD[a];​​m*(x-a)+f[s,a]​​];​​​​lengthSegment[s_]:=Line[{​​{meanPoint[s],f[s,meanPoint[s]]},​​{meanPoint[s],g[s,meanPoint[s]]}​​}]​​​​(*Plotsforallourfunctions*)​​fnPlot[s_,style_]:=Plot[f[s,x],{x,1,Pi+1},​​PlotStyle->style,AxesOrigin->{0,0},PlotRange->{{0,Pi+2},{0,4}}];​​​​endpointsEpilog[s_]={Point[{1,f[s,1]}],Point[{Pi+1,f[s,Pi+1]}]};​​​​endpointsLinePlot[s_,style_]:=Plot[g[s,x],{x,0,5},PlotStyle->{Thin,Black,style}];​​​​tangentLinePlot[s_,style_]:=​​Plot[tangentLine[s,x],{x,0,5},PlotStyle->{Thin,Black,style}];​​​​(*Combineeverythingintoanillustration*)​​viz=Manipulate[​​Show[​​(*Solidgraph*)​​fnPlot[0,Black],​​endpointsLinePlot[0,{}],​​tangentLinePlot[0,{}],​​​​(*Dashedgraph*)​​fnPlot[s,{Black,Dashed}],​​endpointsLinePlot[s,Dashed],​​tangentLinePlot[s,Dashed],​​​​Epilog->{​​PointSize->Medium,​​endpointsEpilog[0],​​lengthSegment[0],​​endpointsEpilog[s],​​{Dashed,lengthSegment[s]},​​}],​​{s,0,1,1/1000}]
Out[]=
​
s
ShowfnPlot0,
,endpointsLinePlot[0,{}],tangentLinePlot[0,{}],fnPlot0,
,Dashing[{Small,Small}],
endpointsLinePlot[0,Dashing[{Small,Small}]],tangentLinePlot[0,Dashing[{Small,Small}]],Epilog
{PointSizeMedium,endpointsEpilog[0],lengthSegment[0],endpointsEpilog[0],{Dashing[{Small,Small}],
lengthSegment[0]},Null}
In[]:=
deployedViz=CloudDeploy[viz,Permissions->"Public"]
Out[]=
CloudObject[
https://www.wolframcloud.com/obj/bec7f172-988f-46e1-8e7d-02bfb04f5daa
]