var('y, theta, x')
@interact
def _(f = input_box(default = 9-x^2, type = SR, label="f(x)"),
interval=range_slider(-5, 5, 1, default=(-3, 3), label="Interval"),
angle=slider(0,2*pi, default=0)):
(x, theta) = var('x,theta')
a, b = interval
if angle == 0:
theta = 0
P = parametric_plot3d((x, f(x=x)*cos(theta), f(x=x)*sin(theta)), (x,a,b))
for c in [a,b]:
P += parametric_plot3d((c, y*f(x=c)*cos(theta), f(x=c)*sin(theta)), (y,0,1))
else:
P = parametric_plot3d((x, f(x)*cos(theta), f(x)*sin(theta)), (x,a,b), (theta,-angle,0))
for c in [a,b]:
P += parametric_plot3d((c, y*f(x=c)*cos(theta), f(x=c)*sin(theta)), (theta,-angle,0), (y,0,1))
P += line3d([(a-1, 0, 0), (b+1,0,0)], color='gray', linestyle=":")
show(P, aspect_ratio=1, mesh=True, frame=False)