%auto
var('x')
html('Where do $\sin(bx)$ and $\sin(bx+a)$ have the same y-value?')
html('<BR><BR>Adjust the x value on the slider below to see when the points have the same y values.')
@interact(layout=dict(top=[['b','a'],['x0']]))
def _(b=input_box(.5,width=5),a=[1/4,1/2,3/4,1,5/4,3/2,7/4,2],x0=slider(1.57-1.5,1.58+1.5,0.025,label='$x_0$')):
G = plot(sin(b*x),(x,0,pi/b))
s0 = sin(b*x0)
s1 = sin(b*x0+a)
s2 = min(s0,s1)*0.9
d = b/a
G += point2d((x0,s0),size=20,color='red')
G += point2d((x0+a/b,s1),size=20,color='red')
G += line([(0,s0),(pi/b,s0)],alpha=0.1)
G += line([(0,s1),(pi/b,s1)],alpha=0.1)
G += arrow2d((x0,s2),(x0+a/b,s2),color='green',head=2)
G += text('$\\frac{\pi}{%s}$'%str(b.n(digits=3)),(pi/(b),-0.1),fontsize=20)
G += text('$%s$'%str(d.n(digits=3)),(x0+a/(2*b),s2+0.02),fontsize=10)
G += text('sin(bx)',(x0,s0))+text('sin(bx+a)',(x0+a/b,s1))
show(G)
|
Click to the left again to hide and once more to show the dynamic interactive window
|