# Numerical Methods Calculators- Android App [Documentation]

### Numerical Methods Calculators – is an Android App to serve as a companion to the text-books on Numerical Analysis.

It is extremely useful for the students taking a course on Numerical Analysis, as it will help them to compare and analyse the data given in their text-books.

It will also serve as an helping hand for classroom lectures, as students and instructors can verify their results right away, without needing to write their own algorithms, or buying expensive softwares like MATLAB.

I have taken utmost care to make sure that the algorithms used are stable, and consistent. A lot of equations and data was used to test the app and the results were compared with all the leading softwares available. The results were in very satisfactory.

However, I still encourage users to report any bug or strange crash.

Numerical Methods Calculators- contains the following tools and calculators:

• ### Matrix Operations:

-> Multiplication of Matrices
-> (P)LU Decomposition
-> Rank
-> Row Echelon Form
-> Trace
-> Determinant
-> Transpose

• ### Numerical Integration:

-> Trapezoidal Method
-> Simpson’s 1/3 Rule
-> Simpson’s 3/8 Rule

• ### Curve Fitting(using least squares)

-> Linear Fitting
-> Exponential Fitting
-> Polynomial Fitting

• ### Root Finding:

-> Bisection Method
-> Secant Method
-> Newton-Raphson Method

The following section explains the working of the above calculators and tool:

## Matrix Operations:

As the name suggests, this tool let’s the user add and subtract matrices. User needs to give the size(dimension/order) of the matrices first, then enter the elements of the matrices in the fields provided.
User can choose to click on ‘Add’ or ‘Subtract’ to perform the respective operation.

### Multiplication:

As the name suggests, this tool let’s the user multiply matrices. User needs to give the size(dimension/order) of the matrices first, then enter the elements of the matrices in the fields provided.
User can choose to click on ‘Multiply’ to perform the respective operation.

### Rank:

This tool let’s the user find out the rank of any given matrix. Rank of a matrix is equal to the number of linearly independent rows in a matrix. This feature has been implemented using the Gaussian Elimination technique with Partial Pivoting. I have tried to write the algorithm in a way that guarantees numerical stability.

This tool can also be used to find out if a given set of vectors is Linearly Independent or not.
Rank is equal to the number of vectors, if all the vectors are linearly independent.

### Roe Echelon Form:

This tool gives the Row Echelon form of any given matrix. This has been implemented using Gaussian Elimination with Partial Pivoting.

### Transpose:

This tools evaluates the transpose of a given matrix.

### Trace:

This tools evaluates the trace of a given matrix. Trace is the sum of the diagonal elements of a matrix. Therefore, the matrix needs to be square.

### Determinant:

This tool calculates the determinant of a square matrix. This has been implemented using Gaussian Elimination with Partial Pivoting.

### LU Decomposition:

This tool gives the PLU factorization of a given matrix.
Although, generally, LU decomposition(factorization) is discussed for square matrices, I noticed that many popular applications like MATLAB, SCILAB, MAPLE, etc. have extended the definition to rectangular matrices.

Therefore, I have also provided the support for rectangular matrices. Although the result may be different than MATLAB or other applications. But the factorization is correct as multiplying PLU gives back the original matrix.

Here is some brief info:

LU decomposition tool takes an $m\times n$ matrix $A$ and gives back three matrices, $P, L$ and $U$, such that $A=PLU$

where, $P$ is an $m\times m$ permutation matrix, $L$ is an $m \times m$ lower triangular matrix, $U$is an $m\times n$ upper triangular matrix.

The permutation matrix just keeps track of the row swaps during the Partial Pivoting.

Without $P$, the product $LU$ returns a permutation of the original matrix.

## Root Finding:

### Bisection Method(Interval Halving)

This calculator finds the root of a given equation. The tool requires the user to enter the equation and the variable that is to be determined. Users should note that, only single variable equations are supported for now.

Rules for writing the equation and the syntax supported can be seen here.

User needs to provide two initial guesses such that the root is between them. Of course one can’t be expected to already know the root but users need to make an intelligent guess for this method to work. The convergence is slower than other methods, but guaranteed.
Users can also enter the degree of accuracy desired.

After the calculation the results are shown in a table giving the values of various parameters at ever iteration.
Here is what they stand for:

a: Initial Guess (a)
b: Initial Guess (b)
c: Eventually stores the root. Calculated at each step using $c=\frac{a+b}{2}$
f(c): Value of the equation at ‘c’

For ‘c’ to be the root of the equation, f(c) needs to be really small(approximately zero).

### Secant Method:

This calculator finds the root of a given equation. The tool requires the user to enter the equation and the variable that is to be determined. Users should note that, only single variable equations are supported for now.

Rules for writing the equation and the syntax supported can be seen here.

User needs to provide two initial guesses close to the real root(Guesses don’t need to bracket the root). Of course one can’t be expected to already know the root but users need to make an intelligent guess for this method to work. The convergence is  faster than bisection method, but not guaranteed.
Users can also enter the degree of accuracy desired.

After the calculation the results are shown in a table giving the values of various parameters at ever iteration.
Here is what they stand for:

a: Initial Guess (a)
b: Initial Guess (b)
c: Eventually stores the root.
f(c): Value of the equation at ‘c’

For ‘c’ to be the root of the equation, f(c) needs to be really small(approximately zero).

### Newton-Raphson Method:

This calculator finds the root of a given equation. The tool requires the user to enter the equation, it’s derivative and the variable that is to be determined. Users should note that, only single variable equations are supported for now.

Rules for writing the equation and the syntax supported can be seen here.

User needs to provide an initial guess close to the real root. Of course one can’t be expected to already know the root but users need to make an intelligent guess for this method to work. The convergence(quadratic) is  faster than bisection and secant method, but not guaranteed.
Users can also enter the degree of accuracy desired.

After the calculation the results are shown in a table giving the values of various parameters at ever iteration.
Here is what they stand for:

x: Initial Guess (x)
x1: Eventually stores the root. New value calculated at each step.
f(x1): Value of the equation at ‘c’

For ‘c’ to be the root of the equation, f(c) needs to be really small(approximately zero).

## Numerical Integration:

### Trapezoidal Rule:

This tool evaluates the definite integral for a given function with respect to the given variable. Note: Only single variable functions are supported for now.

Users need to enter the initial(lower) and final(upper) limit, and the number of sub-intervals.
Higher the number of sub-intervals, the better is the approximation of the integral.

A graph and solution is also shown with the answer.

### Simpson’s 1/3 Rule:

This tool evaluates the definite integral for a given function with respect to the given variable. Note: Only single variable functions are supported for now.

Users need to enter the initial(lower) and final(upper) limit, and the number of sub-intervals(EVEN).
Higher the number of sub-intervals, the better is the approximation of the integral.

A graph and solution is also shown with the answer.

### Simpson’s 3/8 Rule:

This tool evaluates the definite integral for a given function with respect to the given variable. Note: Only single variable functions are supported for now.

Users need to enter the initial(lower) and final(upper) limit, and the number of sub-intervals(should be multiple of 3).
Higher the number of sub-intervals, the better is the approximation of the integral.

A graph and solution is also shown with the answer.

## Curve Fitting(Least Squares):

This tool fits a given set of data points to a function. Users can either enter the data manually or load it up from a CSV

### Linear Fitting:

This fits the given set of data points to a line.

### Exponential Fitting:

This fits the given set of data points to an exponential.

### Polynomial Fitting:

This fits the given set of data points to a polynomial of any order.

## Upcoming features:

I will keep on adding new tools and calculators regularly. So users can expect it to be a vary powerful tool in some time.

Here is the list of features that I am working on:

• Linear System Solver
• Polynomial Root Finder(All the roots)
• QR Factorization
• Cholesky Decomposition
• Eigenvalue and Eigenvector
• Gauss Seidel Method
• Forward and Backward Difference Tables [wpedon id="7041" align="center"]

## One thought on “Numerical Methods Calculators- Android App [Documentation]”

1. I’m a 2nd year computer science engineer
Can you give me the code source for the matrix layout input method please ?