• 3-AMALIY ISHI O’qituvchi: Babajanov Mo‘min Rajabovich Toshkent – 2024 3-Amaliy ish
  • Oddiy iteratsiya usulida bajarilgan variant
  • Zeydel usulida yechilishi
  • Televizion tenologiyalar




    Download 4,09 Mb.
    Sana14.05.2024
    Hajmi4,09 Mb.
    #231913


    MUHAMMAD AL-XORAZMIY NOMIDAGI
    TOSHKEMT AXBOROT TEXNOLOGIYALARI
    UNIVERSITETI

    “TELEVIZION TENOLOGIYALAR” yo’nalishi


    510-22 guruh talabasi
    Madaminov Abdulazizning
    “Algoritimlarni loyihalash” fanidan tayyorlagan
    3-AMALIY ISHI

    O’qituvchi: Babajanov Mo‘min Rajabovich

    Toshkent – 2024

    3-Amaliy ish
    Berilgan tenglamalar sistemasi Oddiy iteratsiya, Zeydel iteratsiya, Relaqsatsiya iteratsiya usuli bilan yeching. Bunda har bir iteratsiya qadamini hisoblang. Natijalarni jadval ko’rinishida keltiring. Yaqinlashish xatoliklarini har qadamda ko’rsating. Shu uchta usul uchun dastur tuzing va natijalarni solishtiring.




    Oddiy iteratsiya usulida bajarilgan variant



    Bu usulni yechish uchun c++ dagi kodi

    #include


    #include
    # include

    using namespace std;

    // Function for solving SLAU using the Jacobi method
    vector Iteration(vector> A, vector b, double epsilon, int maxIterations) {
    int n = A.size();
    vector x(n, 0.0);
    vector previousX(n, 0.0);

    for (int i = 0; i < maxIterations; i++) {


    for (int j = 0; j < n; j++) {
    double sum = 0.0;
    for (int k = 0; k < n; k++) {
    if (k != j) {
    sum += A[j][k] * previousX[k];
    }
    }
    x[j] = (b[j] - sum) / A[j][j];
    }

    bool isConverged = true;


    for (int j = 0; j < n; j++) {
    if (abs(x[j] - previousX[j]) > epsilon) {
    isConverged = false;
    break;
    }
    }

    if (isConverged) {


    return x;
    }

    previousX = x;


    }

    return x;


    }

    int main() {


    vector> A = {{9.9, 0.1, 1.2}, {1.6, 5.3, 1.3}, {2.5, 4.7, -7.8}};
    vector b = {8.3, -2.4, 3.5};
    double epsilon = 1e-6;
    int maxIterations = 1000;

    vector result = Iteration(A, b, epsilon, maxIterations);

    cout << "Results: " << endl;
    for (int i = 0; i < 3; i++) {
    cout << "x" << i + 1 << " = " << setprecision(10) << result[i] << endl;
    }

    return 0;


    }

    Zeydel usulida yechilishi








    Download 4,09 Mb.




    Download 4,09 Mb.