Well, I should be studying Calculus, but instead I wrote another sage application for visualizing another project problem. This one is the classic cow tied to a silo problem; if the rope just reaches the far side of the silo, how much area can the cow cover?

My python is still pretty rusty, but I think I did a little better on this one than the last:

################################################################### # # an application for plotting "the cow tied to a silo" problem. # author: bnr # date: 2012-10-16 # ################################################################### from sage.plot.line import Line from sage.plot.arc import Arc r,t, a1, labl1,label2 = var('r,t, a1,labl1,labl2') # the radius of the silo r = 1 @interact def _( r = slider( [1..25],1, label = "Silo Radius") ): #the area labels labl1 = text(('$ \\frac{A_1}{2} $'), (2.5*r,1.5*r),fontsize=20,color='black') labl2 = text(('$A_2$'),(.5*r,1.5*r),fontsize=20,color='brown') # x and y on the silo perimeter def x1(t): return r*cos((t)) def y1(t): return r*sin((t)) #the area of the half-circle; A_1 f = sqrt( (pi*r)^2 - (x -r)^2 ) L1 = plot(f, r, r*(pi+1), fill=True) + labl1 # the curve of the silo wall L2 = parametric_plot( (x1(t), y1(t) ), (t, 0, float(pi)), color='red') # wrapping the rope around the silo def silo_rad(a): # finding the curve as the rope is stretched taught def new_x(a) : new_x = x1(a) - abs( r*(pi-a)*sin(a) ) return new_x def new_y(a) : new_y = y1(a) + ( r*(pi-a)*cos(a) ) return new_y # the tangent line of the taught rope s_tan = line( ( ( new_x(a), new_y(a) ) , ( ( x1(a),y1(a) ) ) ) ) # the arc walked by the cow with the rope taught cow = parametric_plot( (new_x(t), new_y(t) ), (t, 0, float(pi)), color='brown') return s_tan + cow + labl2 # calculating the area in the half-circle def A1(a) : return round( (pi^3)*(a^2)/2, 4) # calculating twice the area of the integral part; A_2 def A2(a) : return round( (pi^3)*(a^2)/3, 4) # point of tangent to silo def f(a): p1 = point( ( x1(a), y1(a) ) ) return L1 + L2 + p1 + silo_rad(a) # printing the calculated areas print( html('$A_1= \\frac{\pi^3 r^2}{2} {\\approx} $' + str(A1(r) ) + '$\hspace{12 mm}2 \\times A_2 = \\frac{\pi^3 r^2}{3} {\\approx} $' + str(A2(r)) + '$\hspace{12 mm}Total\ Area = \\frac{5\pi^3 r^2}{6} {\\approx} $' + str(A2(r) + A1(r)) ) ) # animating the tangent line/integral part; A_2 a1 = animate([f(i) for i in srange(0,float(pi),.1)] , xmin = float(-2*r), xmax = float((1.1+pi)*r), ymin = float(-.2), ymax = float(1.1*pi*r)) a1.gif(savefile='my_animation.gif', show_path=False )