#phyllis Viola
#Nov. 4th
# Integral (syntax) int( f(x), x);
restart:
int ( f(x), x );
f := unapply( 0.9*x**4 - 2.4*x**2 - 1.5*x + 0.2, x );
int ( f(x), x );
#integral is the opposite of a dervative
# indefinate integral (syntax) int( f(x), x=a..b);
restart:
int ( f(x), x=a..b );
f := unapply( 0.9*x**4 - 2.4*x**2 - 1.5*x + 0.2, x );
int ( f(x), x=a..b );
#
restart:
area := unapply(int ( f(x), x=a..b ) , a,b );
f := unapply( 0.9*x**4 - 2.4*x**2 - 1.5*x + 0.2, x );
area( 0, 1.5 );
#area beneath the curve from 0 to 1.5
area( k, m );
restart:
area := unapply(int ( f(x), x=a..b ) , a,b );
f := unapply( 0.9*x**4 - 2.4*x**2 - 1.5*x + 0.2, x );
plot ( f(x), x=-2..2.5, title="f(x)" );
plot ( area(-2, x) , x=-2..2.5, title="Area");
#connection between indefinate and definate integrals and dervatives
restart:
area := unapply(int ( f(x), x=a..b ) , a,b );
F := unapply( int ( f(x), x) ,x );
f := unapply( 0.9*x**4 - 2.4*x**2 - 1.5*x + 0.2, x );
` `;
`area = indefinate integral at (b - indefinated integral at a)`;
area (a,b);
F(b) - F(a);
` ` ;
`recoup f(x) differentiating F(x)`;
unapply (diff(F(x), x ) ,x );
#total charge on a wire
restart:
charge := unapply( int(rho(x), x=a..b) ,a, b);
rho := unapply( x*exp(-(x-0.5)**2) , x) ;
plot ( rho(x), x=-2..3, title= "charge density" );
charge(-2.0, 3.0);
charge(1.0, 1.5);
charge(-1.5, -1.0);
charge(-infinity, infinity);
#charge distribution on the plane
restart:
charge := unapply( int(int(rho(x,y), y=c..d), x=a..b) , a, b, c, d);
rho := unapply( bump(r(x, y)), x, y);
bump := unapply( x*exp(-(x-0.5)**2) , x) ;
r := unapply( sqrt(x**2 + y**2), x, y);
with(plots):
plot3d( rho (x,y), x= -3..3, y=-3..3);
plot3d( 0.0, x= -3..3, y=-3..3, color= rho (x,y));
#plot3d( 0.0, x= -3..3, y=-3..3, color= rho (x,y), orientation = (90.0, 0.0) );
charge(-3, 3, -3, 3);
charge(-3.0, 3.0, -3.0, 3.0);