Skip to content

๐Ÿ”ข C-based algorithms and exercises focused on numerical methods, such as interpolation, differentiation, and aimed for equation solving.

License

Notifications You must be signed in to change notification settings

Md-Emon-Hasan/Numerical-Analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

9 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

# ๐Ÿ“Š Numerical Analysis using C and MATLAB

Welcome to the **Numerical Analysis** repository! This project contains implementations of various **numerical analysis algorithms** in **C** and **MATLAB**. These methods are fundamental for solving numerical problems like root-finding, interpolation, differentiation, integration, and solving linear systems.

---

## ๐Ÿš€ **Features**

- โš™๏ธ Numerical methods implemented in **C** and **MATLAB**.
- ๐Ÿงฎ Algorithms for:
   - Root finding (e.g., Bisection, Newton-Raphson).
   - Interpolation and polynomial approximations.
   - Numerical integration and differentiation.
   - Solving linear and non-linear systems.
- ๐Ÿ“ˆ MATLAB scripts for data visualization.
- ๐Ÿ’ป Optimized C programs for efficient computation.

---

## ๐Ÿ› ๏ธ **Technologies Used**

- **C Programming Language** (for performance and precision)
- **MATLAB** (for visualization and high-level numerical computing)

---

## ๐Ÿ’ป **Setup and Installation**

### **C Programs**
1. **Compile the programs** using a C compiler like `gcc`:
   ```bash
   gcc bisection_method.c -o bisection
   ./bisection
  1. Input the required parameters (equation, intervals, tolerance).

MATLAB Scripts

  1. Open the .m files in MATLAB or MATLAB Online.
  2. Run the scripts by pressing Run or typing in the Command Window:
    bisection_method

๐Ÿ“š Algorithms Included

Root Finding

  • Bisection Method
  • Newton-Raphson Method
  • Secant Method

Interpolation

  • Lagrange Interpolation
  • Newton's Divided Difference

Numerical Integration

  • Trapezoidal Rule
  • Simpson's 1/3 Rule

Linear Systems

  • Gaussian Elimination
  • LU Decomposition

๐Ÿ“Š Usage Examples

C Example: Bisection Method

#include <stdio.h>
#include <math.h>

double func(double x) {
    return x*x - 4; // Example function: x^2 - 4 = 0
}

int main() {
    double a = 0, b = 3, tol = 0.001, c;

    while ((b - a) >= tol) {
        c = (a + b) / 2;
        if (func(c) == 0.0)
            break;
        else if (func(c) * func(a) < 0)
            b = c;
        else
            a = c;
    }
    printf("Root: %.5f\n", c);
    return 0;
}

MATLAB Example: Newton-Raphson Method

f = @(x) x^2 - 4;           % Function definition
df = @(x) 2*x;              % Derivative of the function
x0 = 2;                     % Initial guess
tol = 1e-6;                 % Tolerance
max_iter = 100;

for i = 1:max_iter
    x1 = x0 - f(x0)/df(x0); % Newton-Raphson formula
    if abs(x1 - x0) < tol
        fprintf('Root: %.5f\n', x1);
        break;
    end
    x0 = x1;
end

๐Ÿค Contributing

Contributions are welcome! Follow these steps:

  1. Fork the repository.
  2. Clone your fork:
    git clone https://github.com/your-username/Numerical-Analysis.git
  3. Create a new branch:
    git checkout -b feature-branch
  4. Add your code and commit:
    git add .
    git commit -m "Add feature: feature description"
  5. Push the changes and create a pull request:
    git push origin feature-branch

๐ŸŒŸ License

This project is licensed under the MIT License. See the LICENSE file for more details.


๐Ÿ“ž Contact

For any queries or suggestions, feel free to reach out:


โญ Support

If you find this repository helpful, give it a โญ and share it with your peers!


Happy Coding! ๐ŸŽ‰


---

### **Key Additions:**
1. Updated **features** and structure for C and MATLAB.
2. Added **C program** and **MATLAB script** examples for better understanding.
3. Included **usage instructions** and **visualization placeholders**.
4. A clear **folder structure** is outlined for easy navigation.

Let me know if you'd like further customization! ๐Ÿš€

About

๐Ÿ”ข C-based algorithms and exercises focused on numerical methods, such as interpolation, differentiation, and aimed for equation solving.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published