25, )1254(6,2 t, )34 t2 (2,2/20/13 <strong>PREP</strong> <strong>Quickstart</strong>, <strong>Multivariable</strong> <strong>Calculus</strong> -- <strong>Sage</strong>Toggle Advanced ControlsHelp <strong>for</strong> Jmol 3-D viewerVector-Valued Functionsvar('t')r=vector((2*t-4, t^2, (1/4)*t^3))rr(t=5)(2 t − 4, , ) t 2 1 4 t 3The following makes the derivative also a vector-valued callable expression.velocity = r.diff(t) # velocity(t) = list(r.diff(t)) also wouldworkvelocityvelocity(t=1)test.sagenb.org/home/Carlos_Rodriguez/20/print 2/9(2, 2, )
(2, 2, )3 42/20/13 <strong>PREP</strong> <strong>Quickstart</strong>, <strong>Multivariable</strong> <strong>Calculus</strong> -- <strong>Sage</strong>If we know a little vector calculus, we can also do line integrals. Here we compute the arclength betweenand t = π.T=velocity/velocity.norm()t = 0T(t=1).n()(0.683486126173409, 0.683486126173409, 0.256307297315028)We can even then get the arc length by integrating the normalized derivative. As pointed out in the calculustutorial, the syntax <strong>for</strong> numerical_integral is slightly nonstandard - we just put in the endpoints, not the variable.arc_length = numerical_integral(rprime.norm(), 0,1)arc_lengthTraceback (click to the left of this block <strong>for</strong> traceback)...NameError: name 'rprime' is not definedIf we know a little vector calculus, we can also do line integrals. Here we compute a number of quantities.var('x,y,t')density(x,y)=x^2+ytstart=0tend=pit_range=(t,tstart,tend)r_prime = diff(r,t)ds=diff(r,t).norm()arclength=integral(ds,t, tstart, tend)To do line integrals, let's make a function that will calculatevarious differentials to to easily specify the dtintegrands.. We'll use our <strong>for</strong>mulas relating# Let's make a function right off to evaluate an integral overthis curve.# this function uses our values of r, tstart, and tenddef line_integral(integrand):return RR(numerical_integral((integrand).subs(x=r[0],y=r[1],z=r[2]), tstart, tend)[0])var('x,y,z,t')r_prime = diff(r,t)∫ (integrand)dttest.sagenb.org/home/Carlos_Rodriguez/20/print 3/9