miércoles, 4 de agosto de 2021

Online Calculator: Numerical Methods, Linear Algebra

 

https://www.codesansar.com/online-calculator/

Online Calculator: Numerical Methods, Linear Algebra & More

Online calculator is simple and reliable tool to calculate various mathematical problem online.

We have simulated different online calculator for solving different problem from mathematics, numerical methods and number theory.

Available Online Calculation Tools

Common Tools

Numerical Methods Online Calculator

Linear Algebra Online Calculator

Statistics Online Calculator

Number Related Online Calculator

Programas de Metodos Numericos en Varios Lenguajes mostrando las ejecuciones

Programas de Metodos Numericos en Varios Lenguajes mostrando las ejecuciones

Learn Numerical Methods: Algorithms, Pseudocodes & Programs

https://www.codesansar.com/numerical-methods/

 https://www.codesansar.com/numerical-methods/gauss-elimination-method-using-c-programming.htm


Master Linux Command Line

 https://www.codesansar.com/linux


Master Linux Command Line

Linux is family of one of the most loved open source unix-like operating system based on Linux Kernel. Linux Kernel was first created by Linus Torvalds in 1991.

The main benefits of using Linux is programmers can use Linux Kernel in order to design their own custom operating system. This has made Linux one of the most popular and widely used kernel powering popular operating system like Ubuntu, Debian, Fedora etc.

Gauss Elimination Method Using C

 https://www.codesansar.com/numerical-methods/gauss-elimination-method-using-c-programming.htm

Gauss Elimination Method Using C

Earlier in Gauss Elimination Method Algorithm and Gauss Elimination Method Pseudocode , we discussed about an algorithm and pseudocode for solving systems of linear equation using Gauss Elimination Method. In this tutorial we are going to implement this method using C programming language.

TRansformada Discreta del Coseno

 

Discrete Cosine Transform (Algorithm and Program)

https://www.geeksforgeeks.org/discrete-cosine-transform-algorithm-program/

Image Compression : Image is stored or transmitted with having pixel value. It can be compressed by reducing the value its every pixel contains. Image compression is basically of two types : 
1. Lossless compression : In this type of compression, after recovering image is exactly become same as that was before applying compression techniques and so, its quality didn’t gets reduced. 
2. Lossy compression : In this type of compression, after recovering we can’t get exactly as older data and that’s why the quality of image gets significantly reduced. But this type of compression results in very high compression of image data and is very useful in transmitting image over network.
Discrete Cosine Transform is used in lossy image compression because it has very strong energy compaction, i.e., its large amount of information is stored in very low frequency component of a signal and rest other frequency having very small data which can be stored by using very less number of bits (usually, at most 2 or 3 bit). 
To perform DCT Transformation on an image, first we have to fetch image file information (pixel value in term of integer having range 0 – 255) which we divides in block of 8 X 8 matrix and then we apply discrete cosine transform on that block of data.
After applying discrete cosine transform, we will see that its more than 90% data will be in lower frequency component. For simplicity, we took a matrix of size 8 X 8 having all value as 255 (considering image to be completely white) and we are going to perform 2-D discrete cosine transform on that to observe the output.
 

Algorithm : Let we are having a 2-D variable named matrix of dimension 8 X 8 which contains image information and a 2-D variable named dct of same dimension which contain the information after applying discrete cosine transform. So, we have the formula 
dct[i][j] = ci * cj (sum(k=0 to m-1) sum(l=0 to n-1) matrix[k][l] * cos((2*k+1) *i*pi/2*m) * cos((2*l+1) *j*pi/2*n) 
where ci= 1/sqrt(m) if i=0 else ci= sqrt(2)/sqrt(m) and 
similarly, cj= 1/sqrt(n) if j=0 else cj= sqrt(2)/sqrt(n) 
and we have to apply this formula to all the value, i.e., from i=0 to m-1 and j=0 to n-1
Here, sum(k=0 to m-1) denotes summation of values from k=0 to k=m-1. 
In this code, both m and n is equal to 8 and pi is defined as 3.142857.
 

// CPP program to perform discrete cosine transform
#include <bits/stdc++.h>
using namespace std;
#define pi 3.142857
const int m = 8, n = 8;
 
// Function to find discrete cosine transform and print it
int dctTransform(int matrix[][n])
{
    int i, j, k, l;
 
    // dct will store the discrete cosine transform
    float dct[m][n];
 
    float ci, cj, dct1, sum;
 
    for (i = 0; i < m; i++) {
        for (j = 0; j < n; j++) {
 
            // ci and cj depends on frequency as well as
            // number of row and columns of specified matrix
            if (i == 0)
                ci = 1 / sqrt(m);
            else
                ci = sqrt(2) / sqrt(m);
            if (j == 0)
                cj = 1 / sqrt(n);
            else
                cj = sqrt(2) / sqrt(n);
 
            // sum will temporarily store the sum of
            // cosine signals
            sum = 0;
            for (k = 0; k < m; k++) {
                for (l = 0; l < n; l++) {
                    dct1 = matrix[k][l] *
                           cos((2 * k + 1) * i * pi / (2 * m)) *
                           cos((2 * l + 1) * j * pi / (2 * n));
                    sum = sum + dct1;
                }
            }
            dct[i][j] = ci * cj * sum;
        }
    }
 
    for (i = 0; i < m; i++) {
        for (j = 0; j < n; j++) {
            printf("%f\t", dct[i][j]);
        }
        printf("\n");
    }
}
 
// Driver code
int main()
{
    int matrix[m][n] = { { 255, 255, 255, 255, 255, 255, 255, 255 },
                         { 255, 255, 255, 255, 255, 255, 255, 255 },
                         { 255, 255, 255, 255, 255, 255, 255, 255 },
                         { 255, 255, 255, 255, 255, 255, 255, 255 },
                         { 255, 255, 255, 255, 255, 255, 255, 255 },
                         { 255, 255, 255, 255, 255, 255, 255, 255 },
                         { 255, 255, 255, 255, 255, 255, 255, 255 },
                         { 255, 255, 255, 255, 255, 255, 255, 255 } };
    dctTransform(matrix);
    return 0;
}
 
//This code is contributed by SoumikMondal

Output: 
 

2039.999878    -1.168211    1.190998    -1.230618    1.289227    -1.370580    1.480267    -1.626942    
-1.167731       0.000664    -0.000694    0.000698    -0.000748    0.000774    -0.000837    0.000920    
1.191004       -0.000694    0.000710    -0.000710    0.000751    -0.000801    0.000864    -0.000950    
-1.230645       0.000687    -0.000721    0.000744    -0.000771    0.000837    -0.000891    0.000975    
1.289146       -0.000751    0.000740    -0.000767    0.000824    -0.000864    0.000946    -0.001026    
-1.370624       0.000744    -0.000820    0.000834    -0.000858    0.000898    -0.000998    0.001093    
1.480278       -0.000856    0.000870    -0.000895    0.000944    -0.001000    0.001080    -0.001177    
-1.626932       0.000933    -0.000940    0.000975    -0.001024    0.001089    -0.001175    0.001298

This article is contributed by Aditya Kumar. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
 

Attention reader! Don’t stop learning now. Get hold of all the important mathematical concepts for competitive programming with the Essential Maths for CP Course at a student-friendly price. To complete your preparation from learning a language to DS Algo and many more,  please refer Complete Interview Preparation Course.