Skip to content

A Java Swing app to visualize different integral approximation methods and perform basic calculus operations.

License

Notifications You must be signed in to change notification settings

SoupyzInc/AreaSoup

Repository files navigation

AreaSoup

A Java Swing app to visualize different integral approximation methods and perform basic calculus operations.

AreaSoup Demo

With AreaSoup, you can change the function you are graphing, and the approximation method you are using. You can change the interval width of the rectangle/trapezoid by changing the ∆x value. Change how much of the graph you are seeing by changing the domain value. Note that all values should be positive integers in degrees. (You must hit enter after changing the ∆x or domain value).

To demonstrate how making ∆x approach 0 will increase accuracy of the approximation, press the "Take lim ∆x → 0" button and watch the rectangles/trapezoids move across the screen!

Entering an n value will tell you if the current approximation technique will either provide an over or underestimate of the current function for n rectangles in the specified domain. (You must hit enter in the text box after changing functions, approximation method, or n value to recalculate the area)

Installation with NetBeans

Clone this project as a ZIP file and open it in NetBeans. Make sure you are using at least JDK 14, otherwise Maven may not load correctly.

Adding new functions

To add new functions, create a new class that implements the Function interface. Function is defined under Function.java as

public interface Function {
    double f(double x);
}

An example implementation is provided below.

public class YourFunction implements Function {
    @Override
    public double f(double x) {
        return /*The y-value that your function should return for x.*/;
    }
}

More examples can be found in the functions folder.

To add new functions to the GUI, find the addFunctions method in GraphPanel.java and add a new JMenuItem to JMenu fm like so.

JMenuItem yourFunctionItem = new JMenuItem("Your Function");
yourFunctionItem.addActionListener(ev -> {
    function = new YourFunction();
    functionName = "Your Function";
    updateInfoLabel();
    updateEstimateLabel();
    setValues();
});
fm.add(yourFunctionItem);

The rest of the code should handle everything else for you.

Attribution

This project was made by Matthew Okashita and Joseph Benigno for Mr. Adam's 2021 Calculus Closet Project. AreaSoup is licensed under the MIT License. See LICENSE for more information.

The graphing engine in GraphPanel.java was based off of roooodcastro/GraphPanel.java on Gist.

About

A Java Swing app to visualize different integral approximation methods and perform basic calculus operations.

Topics

Resources

License

Stars

Watchers

Forks

Languages