var('x,y,t')
@interact
def _(M=input_box(default=x+2*y,label='$M(x,y) = $'),
N=input_box(default=2*x-y,label='$M(x,y) = $'),
a=input_box(default=0,label='$t_{start} = $'),
b=input_box(default=pi/2,label='$t_{end} = $'),
xx=input_box(default=sin(t),label='$x(t) = $'),
yy=input_box(default=1-cos(t),label='$y(t) = $'),
xa=input_box(default=0,label='min x'),
xb=input_box(default=1,label='maxx'),
ya=input_box(default=0,label='min y'),
yb=input_box(default=1,label='min y')):
A = M(x=xx,y=yy)*diff(xx,t)+N(x=xx,y=yy)*diff(yy,t)
B=integrate(A,t,a,b)
delt = b-a
G = parametric_plot((xx,yy),(t,a,b))
npts = 10
G += points((xx(t=a+delt*k/npts),yy(t=a+delt*k/npts)) for k in range(npts+1))
G += plot_vector_field((M,N),(x,xa,xb),(y,ya,yb))
pretty_print('Line Integral over the given curve is '+str(B))
show(G)
|
Click to the left again to hide and once more to show the dynamic interactive window
|