Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Plot and find the area of a region determined by a list of points, the x axis and the type of boundary
ResourceFunction["DiscreteIntegralPlot"][data,method] plots the region determined by data, the x-axis and the type of boundary and prints the area of that the region. |
Plot data and determine the area of the region determined by data and the x-axis, using the left–hand endpoints as the height of the rectangles:
In[1]:= | ![]() |
Out[2]= | ![]() |
Use data given by a formula:
In[3]:= | ![]() |
Out[4]= | ![]() |
Note the bad spots in this graph around x=0.6 and x=2.5. Plotting more points fixes the problem:
In[5]:= | ![]() |
Out[6]= | ![]() |
Apply a style to the region:
In[7]:= | ![]() |
Out[8]= | ![]() |
Apply a style to the points:
In[9]:= | ![]() |
Out[10]= | ![]() |
Use Manipulate to illustrate all possible methods to be used:
In[11]:= | ![]() |
Out[12]= | ![]() |
Setting the option "DrawGraph" to False suppresses the plot of the region and returns the area:
In[13]:= | ![]() |
Out[14]= | ![]() |
Data must be ordered:
In[15]:= | ![]() |
Simpson's method requires an even number of subintervals and the range should be chosen accordingly:
In[16]:= | ![]() |
In[17]:= | ![]() |
Out[17]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License