MapleAreaBetweenCurves2.mws

Area Between Two Curves

Computing

>    with(plots):

Warning, the name changecoords has been redefined

>    f1:=6+sin(Pi*x);

f1 := 6+sin(Pi*x)

>    f2:=x^2-4*x+6;

f2 := x^2-4*x+6

>    f1Graph:=plot(f1,x=-2..6,y=0..10,thickness=2,color=red):

>    f2Graph:=plot(f2,x=-2..6,y=0..10,thickness=2,color=blue):

>    display(f1Graph,f2Graph);

[Maple Plot]

>    fsolve({f1=f2},{x},x=-1..1);

{x = 0.}

>    fsolve({f1=f2},{x},x=3..5);

{x = 4.000000000}

>    eval(f1,x=0);

6

>    eval(f1,x=4);

6

The graphs of the two functions intersect at (0,6) and (4,6).

The area between the two curves is given by the integral below.

>    Int(f1-f2,x=0..4);

Int(sin(Pi*x)-x^2+4*x,x = 0 .. 4)

>    value(%);

32/3

Below we do some coloring just for fun.

>    f1Graph2:=plot(f1,x=0..4,thickness=2,color=red,filled=true):

>    f2Graph2:=plot(f2,x=0..4,thickness=2,color=blue,filled=true):

>    display(f1Graph2);

[Maple Plot]

>    display(f2Graph2);

[Maple Plot]

>    display(f2Graph2,f1Graph2);

[Maple Plot]

>    f2Graph3:=plot(f2,x=0..4,thickness=2,color=white,filled=true):

>    display(f2Graph3,f1Graph2);

[Maple Plot]

>