• Qabul qildi: Boboqulov SH QARSHI-2024 Mavzu
  • Amaliy ishini bajarish uchun zarur jihozlar.
  • Algoritmlarni loyihalash ” fanidan tayyorlagan 2-amaliy ishi bajardi: Ravshanov j qabul qildi: Boboqulov sh qarshi-2024 Mavzu




    Download 414.33 Kb.
    Sana19.04.2024
    Hajmi414.33 Kb.
    #201137
    Bog'liq
    amaliy ish 2 J
    2.7.1, 5-Mavzu, PQ-72-sonli, 5G31jGSM0zvSWRIaL68WhTdV40kHSYwRViM8TQMW, 1, MUSTAQILLIK BAYRAMI SSENARIYSI, 2-6, ped innovatsiya, amaliy ish 1 J, amaliy ish 1 O

    O’ZBEKISTON RESPUBLIKASI AXBOROT TEXNOLOGIYALARI VA KOMMUNIKATSIYALARINI RIVOJLANTIRISH VAZIRLIGI MUHAMMAD AL-XORAZMIY NOMIDAGI TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETI QARSHI FILIALI KOMPYUTER INJINIRINGI FAKULTETI



    KI 12-22-GURUH TALABASINING
    Algoritmlarni loyihalash FANIDAN TAYYORLAGAN
    2-AMALIY ISHI


    Bajardi: Ravshanov J


    Qabul qildi: Boboqulov SH

    QARSHI-2024

    Mavzu: Algebraik va transtsendent tenglamalarni yechishda oraliqni teng ikkiga bo‘lish, iteratsiya usullari. Tenglamalarni yechishda vatarlar va Nyuton usullari. Yaqinlashish tezligi
    Maqsad: Talabalar transendent tenglamalarni yechishda qiymatlarini taqribiy hisoblashni o‘rganishi, tenglamalar taqribiy qiymatlarini topishda ketma-ket yaqinlashish va kesmani ikkiga bo’lish usullarini o‘rganishi, bu usullar haqida bilim va ko‘nikmalarga ega bo‘lishi hamda mustaqil masalalar yechishi va shu masalaga mos algoritmlar qura olishi kerak.
    Amaliy ishini bajarish uchun zarur jihozlar. Zarur dasturiy ta’minot (C++ dasturlash tili kompilyatori, matn muharriri) o‘rnatilgan personal kompyuter, laboratoriya ishini bajarish bo‘yicha (ushbu) uslubiy ko‘rsatma

    Zarur nazariy ma’lumotlar.


    Ushbu laboratoriya ishi massivlarni qayta ishlash uchun mo‘ljallangan algoritmlarni ishlab chiqish, psevdokod va blok-sxema ko‘rinishida ifodalash, dasturlashtirish va testlash malakalarini egallashga bag‘ishlangan. Ushbu laboratoriya ishlari transendent tenglamalarni taqribiy yechish usullaridan foydalanish talab etiladi.
    9)
    tg(0.5x+0.1)=x2
    2) x3+0.2x2=0.5x-2=0

    tg(0.5x+0.1)=x2

    #include
    #include

    using namespace std;

    // Function to calculate tan(0.5x + 0.1) - x^2
    double equation(double x) {
    return tan(0.5 * x + 0.1) - x * x;
    }

    // Derivative of tan(0.5x + 0.1) - x^2


    double derivative(double x) {
    return 0.5 / (cos(0.5 * x + 0.1) * cos(0.5 * x + 0.1)) - 2 * x;
    }

    // Newton-Raphson method to find root


    double newtonRaphson(double x0, double epsilon, int maxIterations) {
    double x = x0;
    int iteration = 0;
    double fx, fprime_x;

    do {
    fx = equation(x);


    fprime_x = derivative(x);
    x = x - fx / fprime_x;
    iteration++;
    } while (abs(fx) > epsilon && iteration < maxIterations);

    return x;


    }

    int main() {


    double initialGuess = 1.0; // Initial guess for the root
    double epsilon = 1e-6; // Tolerance for stopping criteria
    int maxIterations = 1000; // Maximum number of iterations
    double root = newtonRaphson(initialGuess, epsilon, maxIterations);

    cout << "Root of the equation: " << root << endl;

    return 0;
    }

    2) x3+0.2x2=0.5x-2=0


    #include
    #include

    using namespace std;

    // Function to calculate f(x) = x^3 + 0.2x^2 - 0.5x + 2
    double equation1(double x) {
    return pow(x, 3) + 0.2 * pow(x, 2) - 0.5 * x + 2;
    }

    // Function to calculate g(x) = 0.5x - 2


    double equation2(double x) {
    return 0.5 * x - 2;
    }

    // Derivative of f(x) = x^3 + 0.2x^2 - 0.5x + 2


    double derivative1(double x) {
    return 3 * pow(x, 2) + 0.4 * x - 0.5;
    }

    // Derivative of g(x) = 0.5x - 2


    double derivative2(double x) {
    return 0.5;
    }

    // Newton-Raphson method to find root of equation1


    double newtonRaphson1(double x0, double epsilon, int maxIterations) {
    double x = x0;
    int iteration = 0;
    double fx, fprime_x;

    do {
    fx = equation1(x);


    fprime_x = derivative1(x);
    x = x - fx / fprime_x;
    iteration++;
    } while (abs(fx) > epsilon && iteration < maxIterations);

    return x;


    }

    // Newton-Raphson method to find root of equation2


    double newtonRaphson2(double x0, double epsilon, int maxIterations) {
    double x = x0;
    int iteration = 0;
    double fx, fprime_x;

    do {
    fx = equation2(x);


    fprime_x = derivative2(x);
    x = x - fx / fprime_x;
    iteration++;
    } while (abs(fx) > epsilon && iteration < maxIterations);

    return x;


    }

    int main() {


    double initialGuess = 1.0; // Initial guess for the root
    double epsilon = 1e-6; // Tolerance for stopping criteria
    int maxIterations = 1000; // Maximum number of iterations
    // Finding roots of equation 1
    double root1 = newtonRaphson1(initialGuess, epsilon, maxIterations);
    cout << "Root of equation 1: " << root1 << endl;
    // Finding roots of equation 2
    double root2 = newtonRaphson2(initialGuess, epsilon, maxIterations);
    cout << "Root of equation 2: " << root2 << endl;

    return 0;


    }

    Download 414.33 Kb.




    Download 414.33 Kb.

    Bosh sahifa
    Aloqalar

        Bosh sahifa



    Algoritmlarni loyihalash ” fanidan tayyorlagan 2-amaliy ishi bajardi: Ravshanov j qabul qildi: Boboqulov sh qarshi-2024 Mavzu

    Download 414.33 Kb.