# Khan/khan-exercises

Fetching contributors…
Cannot retrieve contributors at this time
231 lines (185 sloc) 8.43 KB
 Even and odd functions
[ function( x ) { return 1; }, cos, abs, function( x ) { return x * x; }, function( x ) { return x * x * x * x; } ] [ sin, function( x ) { return x; }, function( x ) { return x * x * x; }, function( x ) { return x * x * x * x * x; } ] randFromArray([ "Even", "Odd", "Neither" ]) makeFunc( SOL, EVENS, ODDS ) substitute( FUNC, (function() { var w = widener( FUNC ); return function( x ) { return x * w; }; })() ) \$.grep( [1,2,3,4,5,6,7,8,9,10], function( i ) { return ( abs( valAt( WIDES, i ) ) > 1 || abs( valAt( WIDES, -i ) ) > 1 ) && abs( valAt( WIDES, i ) ) < 10 && abs( valAt( WIDES, -i ) ) < 10; } ) randFromArray( \$.grep( PTS, function( i ) { return abs( abs( valAt( WIDES, i ) ) - abs( valAt( WIDES, -i ) ) ) > 0.5 && abs( i ) < 10; } ) )

f(x) is graphed below.

graphInit({ range: 10, scale: 20, tickStep: 1, axisArrows: "<->" }); style({ stroke: "#6495ED", }); plot( function( x ) { return WIDES( x ); }, [-10, 10]); style({ stroke: "#05ca00" });

Is f(x) even, odd, or neither?

SOL

• Even
• Odd
• Neither
style({ strokeWidth: 2 }, function() { path([ [ PT, 0 ], [ PT, valAt( WIDES, PT ) ] ]); path([ [ -PT, 0 ], [ -PT, valAt( WIDES, -PT ) ] ]); }); label( [ PT, 0 ], "a", "below right"); label( [ -PT, 0 ], "-a", "below left");
style({ strokeDasharray: "." }, function() { path([ [ 0, valAt( WIDES, PT ) ], [ PT, valAt( WIDES, PT ) ] ]); path([ [ 0, valAt( WIDES, -PT ) ], [ -PT, valAt( WIDES, -PT ) ] ]); }); label( [ 0, valAt( WIDES, PT ) ], "f(a)", "left"); label( [ 0, valAt( WIDES, -PT ) ], "f(-a)", "right");

f(-a)\neq f(a), so f(x) is not even.

f(-a)\neq -f(a), so f(x) is not odd.

style({ stroke: "#7edb00" }, function() { path([ [ x, 0 ], [ x, valAt( WIDES, x ) ] ]); path([ [ -x, 0 ], [ -x, valAt( WIDES, -x ) ] ]); });
style({ strokeDasharray: "." }, function() { path([ [ 0, valAt( WIDES, x ) ], [ x, valAt( WIDES, x ) ] ]); path([ [ 0, valAt( WIDES, -x ) ], [ -x, valAt( WIDES, -x ) ] ]); });

f(-a)=-f(a) for all of these points, so f(x) is... ?

f(-a)=-f(a) for all of these points, so f(x) is odd.

f(-a)=f(a) for all of these points, so f(x) is... ?

f(-a)=f(a) for all of these points, so f(x) is even.

Something went wrong with that request. Please try again.