On Feb 10, 5:38 am, Thomas Scofield <[email protected]> wrote: > I borrowed/adapted the following code for carrying out a line integral > from a published notebook > > var('x,y,t') > F=vector([x^2,x*y]) > r=vector([cos(t), sin(t)]) > tstart=0 > tend=2*pi > integrand = F(x=r[0], y=r[1])*diff(r,t) > > As one may observe, integrand is identically 0. The idea is now to > carry out the command > > numerical_integral(integrand, tstart, tend)
integrand is an *expression* after you are done. numerical_integration needs a function in one variable. Apparently, the routine is permissive and also accepts expressions that it can easily interpret as a function in one variable. However, the constant 0 apparently doesn't fall in that category. You can be explicit and tell the system to regard integrand as a function in t:: numerical_integral(integrand.function(t), 0, 1) works. -- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
