Skip to content

This repo contains code for Applied numerical methods that are taught in engineering undergrad degrees.

License

Notifications You must be signed in to change notification settings

Kaos599/Applied-Numerical-Methods

Repository files navigation

Applied-Numerical-Methods

Are you frustrated by applying numerical methods to endless iterations and still getting the wrong answer? Don’t worry, we have a solution!. We have created programs that will apply these methods for you and give you instant results We have made every effort to ensure that our programs are easy to use and effective in solving various kinds of problems. Numerical methods are techniques for solving mathematical problems that cannot be solved analytically. They are widely used in engineering and science applications, such as optimization, interpolation, integration, differential equations, linear algebra, and more. However, implementing numerical methods can be challenging and time-consuming, especially for beginners. That’s why we have developed these programs using Python, a powerful and versatile programming language that is suitable for numerical computing.

The main purpose of this repository is to provide a learning resource for students and instructors of numerical methods courses. It can also serve as a reference for anyone who is interested in numerical computing and scientific programming.

Programs for the methods that we have made:

Iterative Methods -

These are methods that use an initial guess and then repeatedly apply a formula to obtain a better approximation of the solution. Some examples of iterative methods are:

• Newton-Raphson Method - This is a method for finding the roots of a nonlinear equation by using the derivative of the function.

• Secant Method - This is a method for finding the roots of a nonlinear equation by using a secant line that passes through two points on the function.

• Fixed-Point Iteration Method - This is a method for finding the roots of a nonlinear equation by rewriting it as x = g(x) and then iterating x = g(x) until convergence.

• Gauss-Elimination - This is a method for solving a system of linear equations by reducing the matrix to an upper triangular form using elementary row operations.

• Gauss-Seidel - This is a method for solving a system of linear equations by using an iterative scheme that updates each variable in turn.

• Bisection Method - This is a method for finding the root of a function within a given interval by repeatedly dividing the interval in half and identifying the subinterval in which the root lies, converging towards the root through iterative refinement.

Interpolation Methods -

These are methods that estimate the value of a function at a given point by using known values of the function at other points. Some examples of interpolation methods are:

• Newton Forward Interpolation - This is a method for interpolating a function by using a forward difference table and a polynomial of degree n-1 that passes through n given points.

• Newton Backward Interpolation - This is a method for interpolating a function by using a backward difference table and a polynomial of degree n-1 that passes through n given points.

• Lagrange Interpolation - This is a method for interpolating a function by using a polynomial of degree n-1 that passes through n given points.

• Lagrange Inverse Interpolation - This is a method for finding the value of a variable x that corresponds to a given value of a function y by using a polynomial of degree n-1 that passes through n given points (x_i, y_i).

Numerical Differential-Integral Methods -

These are the methods used to approximate the values of derivatives and integrals of mathematical functions, used when it is difficult or impossible to obtain exact analytical solutions for differentiation or integration problems:

• Quadrature Rule - This is a method for approximating the area under a curve by evaluating the function at specific points and using corresponding weights.

• Trapezoidal rule - This is a method for approximating definite integrals by dividing the integration interval into smaller trapezoids and estimating the area under the curve as the sum of the areas of these trapezoids.

• Simpson's Rule - Simpson's rule is a method for approximating definite integrals by dividing the integration interval into smaller intervals and approximating the area under the curve using quadratic polynomials, providing a more accurate estimation compared to the trapezoidal rule.

• Romberg rule - This is a method for improving the accuracy of numerical integration by iteratively refining and extrapolating the estimates obtained from the trapezoidal rule.

Features:

• Root Calculation - Our programs can calculate the roots of nonlinear equations using various iterative methods. You can choose the method that suits your problem best and adjust the parameters such as tolerance, maximum iterations, initial guess, etc.

• Positive or Negative Roots - Our programs can find both positive and negative roots of nonlinear equations. You can specify the sign of the root you want or let the program find any root available.

• Custom X_Nought Value option - Our programs allow you to enter your own initial guess for the iterative methods. You can use this option to speed up the convergence or to avoid local minima or maxima.

• Solves equations containing Logs, exponentials, Euler’s numbers, trigonometric functions and of course division and multiplication - Our programs can handle various types of nonlinear equations that involve different mathematical functions and operations. You can enter your equation using Python syntax and our programs will evaluate it correctly.

• Gives you value of all iterations in tabular form - Our programs can show you the value of each iteration for the iterative methods. You can use this feature to monitor the progress and accuracy of the solution. This is shown in a tabular form which is easy to follow.

• Gives you value of both roots - Our programs can find both the positive and negative roots of a quadratic equation using the quadratic formula. You can enter the coefficients of the equation and our programs will calculate and display both roots.

• Visualises Matrix calculations - Our programs can visualise the matrix operations involved in solving a system of linear equations using Gauss-Elimination or Gauss-Seidel methods. You can see how the matrix is transformed into an upper triangular form or how the variables are updated in each iteration. This can help you understand the methods better and check for errors.

• Outputs Iterations in tabular form - we have implemented tabular function wherever possible to give the output of the programs a nice readability and fancy look.

Requirements

• Pre-requisite = Sympy Module, Math Module, Numpy Module - You need to install these modules before running our programs. You can use pip or conda to install them from the command line. For example, to install sympy using pip, you can type:

pip install sympy

• Copy the code

• Just copy paste the programs from the repository to your IDE and run them! -

• You can find our programs in the GitHub repository at https://github.com/Kaos599/Applied-Numerical-Methods.

• You can download or clone the repository to your local machine and then open the programs in your preferred IDE (Integrated Development Environment), such as PyCharm, Spyder, Visual Studio Code, etc. You can also run the programs in a Jupyter Notebook or Google Colab.

• To run a program, you just need to copy and paste the code into your IDE and then execute it. You will see some instructions and prompts on how to use the program and enter your inputs

Future Plans:

• Making it more user friendly - We plan to improve the user interface and experience of our programs by optimizing it for better UX. We also plan to add more validations and error handling to prevent invalid inputs and outputs.

• Developing a website based on this - We plan to create a website that will host our programs and allow users to access them online without installing anything. The website will also have more information and resources about numerical methods and Python programming.

• Adding more methods - We plan to expand our collection of numerical methods by adding more programs for different topics such as optimization, integration, differential equations, etc. We also plan to update our existing programs with more options and variations of the methods.

• Improving Efficiency - We plan to optimize our code and algorithms to make them run faster and more accurately.

• Adding more features - We plan to add more features to our programs.

License

This repository is licensed under the GNU License. See the LICENSE file for more details.