shade the area or volume between two functions
Using Plotting Options
shadebetween(f, g, x=a..b)
shadebetween(f1, g1, x=a..b, y=c..d)
shadebetween(p, q, a..b)
shadebetween(p1, q1, a..b, c..d)
expressions in the variable x
expressions in the variables x and y
a, b, c, d
procedures or operators taking one argument
procedures or operators taking two arguments
changefill : a list of plotting options to be applied to the filled region
negativeonly : show only regions where the difference of the first two arguments is negative; default is false
positiveonly : show only regions where the difference of the first two arguments is positive; default is false
showboundary : boolean indicating if the boundaries should be shown; default is true
The shadebetween command colors the area between two curves or two surfaces. The calling sequences are very similar to those of the plot and plot3d commands, except that you are providing two curves or surfaces instead of one. These can be given as expressions or procedures. Plotting options can be provided, including ones specifically for the filled region. The following example colors the area between x and x2 in blue.
shadebetween(x, x^2, x=0..2, color="Blue");
The shadebetween command colors the area between two curves in a 2-D plot or the volume between two surfaces in a 3-D plot. Specifically, given functions f⁡x and g⁡x, it colors the area where a point u,v has a value v between f⁡u and g⁡u. In the 3-D case, given functions f⁡x,y and g⁡x,y, it colors the area where a point u,v,w has a value w between f⁡u,v and g⁡u,v.
In the first calling sequence, f and g are two expressions in the variable x, and the third argument has the type name=range. This calling sequence is similar to the one required for the plot command and produces a 2-D plot. The second calling sequence requires two expressions in variables x and y, along with two additional arguments of type name=range, and is similar to that for the plot3d command.
The third and fourth calling sequences are similar to the operator-form calling sequences for the plot and plot3d commands and produce 2-D and 3-D plots respectively. The parameters p and q must take one argument and return a numeric value, while the parameters p1 and q1 take two arguments and return a numeric value.
The positiveonly and negativeonly options allow you to plot only those regions where the difference of the first two arguments is either positive or negative respectively. These are set to false by default.
The showboundary option is set to true by default and causes the curves or surfaces as specified in the first two arguments to shadebetween to be displayed. If this option is set to false, then only the filled region is displayed.
Additional plotting options, if applicable, may be given with any of the calling sequences. These are described in the plot/option and plot3d/option help pages. The coords option does not work with this command.
Options that you wish to have applied to the filled region only may be given in a list using the changefill option. For example, the following command displays the curves in blue but the filled region in orange.
shadebetween(x, x^2, x=0..2, color="Blue", thickness=3, changefill=[color="Orange"]);
The filled areas corresponding to the positive or negative parts can have different characteristics. This is done by providing a suboption of the form optname=[value1, value2] within the changefill option. For example, the following command colors the positive part orange and the negative part yellow.
shadebetween(x, x^2, x=0..2, color="Blue", thickness=3, changefill=[color=["Orange", "Yellow"]]);
The region between sin⁡x and cos⁡x is filled.
The region between sin⁡x and cos⁡x where cos⁡x<sin⁡x is filled.
Options can be provided to customize the look of the plot.
The calling sequence below uses the operator form. Also, the changefill option affects the look of the filled region.
shadebetween⁡sin,cos,0..Pi,color=Niagara Blue,thickness=3,changefill=color=Niagara LeafGreen,transparency=0.8
The fill for the positive and negative parts can have different properties.
shadebetween⁡sin,cos,0..Pi,color=Niagara Blue,thickness=3,changefill=color=Niagara LeafGreen,Niagara DarkOrchid,transparency=0.4,0.8
The region between two surfaces in 3-D is shown below.
shadebetween⁡sin⁡x⁢cos⁡y,sin⁡x⁢cos⁡y−2,x=0..Pi,y=0..Pi,color=Niagara Azure,changefill=color=Niagara Violet
The operator form is used here to create the 3-D plot, and the surfaces are omitted with the showboundary option set to false.
In the following example, there is no filled area in the first plot which uses the positiveonly option, since the first argument's values are always less than or equal to those of the second.
The plots:-shadebetween command was introduced in Maple 2015.
For more information on Maple 2015 changes, see Updates in Maple 2015.
Download Help Document