Java Tutorial – Programming a limit calculator

///Java Tutorial – Programming a limit calculator

Java Tutorial – Programming a limit calculator

FavoriteLoadingAdd to favorites

In this tutorial I am showing how to create a Java class to calculate the limit of a function at a certain point (symbolic). This first tutoral is for limits for x approaching to a finite value. In the next tutorials I’ll be showing infinite calculus and some common issues and problems.

Java468x60

You can download the source code here:

How the class works:
– The user inputs a function, which will be parsed using exp4j library;
– The constructor of the class takes as arguments the value in which evaluating the limit and the expression obtained parsing the expression with exp4j. The constructor fails if the expression given is invalid (null);
– Users can obtain left-hand and right-hand limit calling methods leftLimit() and rightLimit();
– Users can check if the limit exists calling exists() method; this one checks if the left/right hand limit are equal, except for a certain amount of waste (scrap);

Numerical approach to left/right hand limit:
– The algorithm starts taking the tending value and subtracting/adding it 0.1, then evaluate the expression;
– Loop point 1 for a given number of iterations (precision) for a value in constantly decreasing. If the program gets an exception it returns the last valid result.

In the next videos I’ll show how to fix common problems and how to evaluate limits tending to infinity.

source

By |2020-06-05T07:38:43+00:00June 5th, 2020|Java Video Tutorials|0 Comments

Leave A Comment

*