• Iteratsion usullar: Nyuton(Urinmalar) va vatarlar usuli. 4-Variant Vatarlar usuli uchun dastur kodi
  • Natija: [a,b]=[4,6] oldim. Urinmalar usuli uchun dastur kodi
  • Natija: Ikkinchi funksiya. Vatarlar usuli uchun dastur kodi
  • Natija: Urinmalar usuli uchun dastur kodi
  • Natija: Xulosa.
  • Iteratsion usullar: Nyuton(Urinmalar) va vatarlar usuli




    Download 457,13 Kb.
    Sana14.05.2024
    Hajmi457,13 Kb.
    #233495
    Bog'liq
    Algoritm2


    O‘ZBEKISTON RESPUBLIKASI
    RAQAMLI TEXNOLOGIYALAR
    VAZIRLIGI
    MUHAMMAD AL-XOZAZMIY NOMIDAGI TOSHKENT
    AXBOROT TEXNOLOGIYALARI UNIVERSITETI

    Amaliy ish


    Mavzu: Iteratsion usullar: Nyuton(Urinmalar) va vatarlar usuli.

    Bajardi: CAL003-1- guruh talabasi:


    AMIROV JAHONGIR
    Tekshirdi: Axmedov Oybek

    TOSHKENT 2024


    Iteratsion usullar: Nyuton(Urinmalar) va vatarlar usuli.

    4-Variant


    Vatarlar usuli uchun dastur kodi:
    #include
    #include
    using namespace std;
    double F(double x) {
    return x-cos(x);
    }
    double F1(double x) {
    return 1+sin(x);
    }
    double F2(double x) {
    return cos(x);
    }
    int main() {
    double a, b, x1, x2, eps;
    cout << "a=";
    cin >> a ;
    cout << "b=";
    cin>> b;
    cout << "aniqlikni kiriting eps=";
    cin >> eps;
    if (F1(a) * F2(b) > 0) {
    x1 = a;
    } else {
    goto label2;
    }
    label1:
    x2 = x1 - F(x1) * (b - x1) / (F(b) - F(x1));
    if (abs(x2 - x1) > eps) {
    x1 = x2;
    goto label1;
    } else {
    goto label3;
    }
    label2:
    if (F1(a) * F2(b) < 0) {
    x1 = b;
    }
    label4:
    x2 = x1 - F(x1) * (x1 - a) / (F(x1) - F(a));
    if (abs(x2 - x1) > eps) {
    x1 = x2;
    goto label4;
    }
    label3:
    cout << "tenglama yechimi= " << x1 <<
    endl;
    return 0;}
    Natija:_[a,b]=[4,6]_oldim.____Urinmalar_usuli_uchun_dastur_kodi'>Natija:
    [a,b]=[4,6] oldim.



    Urinmalar usuli uchun dastur kodi:
    #include
    #include
    using namespace std;
    double F(double x) {
    return x-cos(x);
    }
    double F1(double x) {
    return 1+sin(x);
    }
    double F2(double x) {
    return cos(x);
    }
    int main() {
    double a, b, x1, x2, eps;
    cout << "a=";
    cin >> a;
    cout << "b=";
    cin >> b;
    cout << "aniqlikni kiriting eps=";
    cin >> eps;
    if (F1(a) * F2(a) > 0) {
    x1 = b;
    } else {
    goto label2;
    }
    label1:
    x2 = x1 - F(x1) / F1(x1);
    if (abs(x2 - x1) > eps) {
    x1 = x2;
    goto label1;
    } else {
    goto label3;
    }
    label2:
    if (F1(a) * F2(a) < 0) {
    x1 = a;
    }
    label4:
    x2 = x1 - F(x1) / F1(x1);
    if (abs(x2 - x1) > eps) {
    x1 = x2;
    goto label4;
    }
    label3:
    cout << "tenglama yechimi= " << x1 <<
    endl;
    return 0;
    }
    [a,b]=[4.6] oldim.
    Natija:___Urinmalar_usuli_uchun_dastur_kodi'>Natija:



    Ikkinchi funksiya.


    Vatarlar usuli uchun dastur kodi:
    #include
    #include
    using namespace std;
    double F(double x) {
    return x*x*x+3*x-1;
    }
    double F1(double x) {
    return 3*x*x+3;
    }
    double F2(double x) {
    return 6*x;
    }
    int main() {
    double a, b, x1, x2, eps;
    cout << "a=";
    cin >> a ;
    cout << "b=";
    cin>> b;
    cout << "aniqlikni kiriting eps=";
    cin >> eps;
    if (F1(a) * F2(b) > 0) {
    x1 = a;
    } else {
    goto label2;
    }
    label1:
    x2 = x1 - F(x1) * (b - x1) / (F(b) - F(x1));
    if (abs(x2 - x1) > eps) {
    x1 = x2;
    goto label1;
    } else {
    goto label3;
    }
    label2:
    if (F1(a) * F2(b) < 0) {
    x1 = b;
    }
    label4:
    x2 = x1 - F(x1) * (x1 - a) / (F(x1) - F(a));
    if (abs(x2 - x1) > eps) {
    x1 = x2;
    goto label4;
    }
    label3:
    cout << "tenglama yechimi= " << x1 <<
    endl;
    return 0;}
    [a,b]=[3,4] oldim.
    Natija:


    Urinmalar usuli uchun dastur kodi:
    #include
    #include
    using namespace std;
    double F(double x) {
    return x*x*x+3*x-1;
    }
    double F1(double x) {
    return 3*x*x+3;
    }
    double F2(double x) {
    return 6*x;
    }
    int main() {
    double a, b, x1, x2, eps;
    cout << "a=";
    cin >> a;
    cout << "b=";
    cin >> b;
    cout << "aniqlikni kiriting eps=";
    cin >> eps;
    if (F1(a) * F2(a) > 0) {
    x1 = b;
    } else {
    goto label2;
    }
    label1:
    x2 = x1 - F(x1) / F1(x1);
    if (abs(x2 - x1) > eps) {
    x1 = x2;
    goto label1;
    } else {
    goto label3;
    }
    label2:
    if (F1(a) * F2(a) < 0) {
    x1 = a;
    }
    label4:
    x2 = x1 - F(x1) / F1(x1);
    if (abs(x2 - x1) > eps) {
    x1 = x2;
    goto label4;
    }
    label3:
    cout << "tenglama yechimi= " << x1 <<
    endl;
    return 0;
    }
    [a,b]=[3,4] oldim.
    Natija:



    Xulosa.
    Urinmalar va vatarlar usulida yechimlarni olishda bir qancha vaqtlar yuzaga keldi. Bulardan urinmalar usuli tez va aniq qiymatda ishlashini kurdim. Urinmalar usuli vatarlarga qaraganda nisbatan tez ishlar ekan.
    Shu jumladan bu usullarni dastur natijasida kurishimiz mumkin.

    Vatarlar usuli 1-funksiya


    Urinmalar usuli 1-funksiya

    Vatarlar usuli 2-funksiya


    Urinmalar usuli 2-funksiya



    Download 457,13 Kb.




    Download 457,13 Kb.

    Bosh sahifa
    Aloqalar

        Bosh sahifa



    Iteratsion usullar: Nyuton(Urinmalar) va vatarlar usuli

    Download 457,13 Kb.