• include include using namespace std; double func(double x) { return x * x * x + 3 * x * x - x - 1; }
  • } while (true); cout cout int main() {
  • Cb ustun elementlari
  • Maqsad funksiyasi qiymati
  • Baholangan nazorat ozgaruvchilari
  • #include #include using namespace std; double func(double x) { return x x x + x x x 1; } double derivative(double x) { return x x + x 1; } void newton(double x0, double epsilon) { double x1; int iteration = 0; do {




    Download 6,35 Mb.
    bet1/4
    Sana18.05.2024
    Hajmi6,35 Mb.
    #242306
      1   2   3   4
    Bog'liq
    SADULLAYEVA ASAL



    MUHAMMAD AL-XOZMIY NOMIDAGI TOSHKENT AXBOROT
    TEXNOLOGIALAR UNIVERSITETI



    ALGORITMLARNI LOYIHALASH
    32 variant
    Bajardi:SADULLAYEVA ASAL

    Berilgan tenglamani vatarlar va nyuton usulida ishlovchi dastur.


    #include
    #include
    using namespace std;
    double func(double x) {
    return x * x * x + 3 * x * x - x - 1; }
    double derivative(double x) {
    return 3 * x * x + 6 * x - 1; }
    void newton(double x0, double epsilon) {
    double x1;
    int iteration = 0;
    do {
    x1 = x0 - func(x0) / derivative(x0);
    iteration++;
    if (fabs(x1 - x0) < epsilon)
    break;
    x0 = x1;
    } while (true);
    cout << "Nyuton usulida: " << x1 << endl;
    cout << "Takrorlanishlar soni: " << iteration << endl; }
    void secant(double a, double b, double epsilon) {
    double x0 = a, x1 = b, x2;
    int iteration = 0;
    do {
    x2 = x1 - func(x1) * (x0 - x1) / (func(x0) - func(x1));
    iteration++;
    if (fabs(x2 - x1) < epsilon)
    break;
    x0 = x1;
    x1 = x2;
    } while (true);
    cout << "Vatarlar usulida: " << x2 << endl;
    cout << "Takrorlanishlar soni: " << iteration << endl; }
    int main() {
    double x0 = 0.5;
    double a = 0.5, b = 1.0;
    double epsilon = 0.0001;
    cout << "a)" << endl;
    newton(x0, epsilon);
    cout << "\nb)" << endl;
    secant(a, b, epsilon);
    return 0; }
    Dastur natijasi:






    Ustun asosining elementlari (B)
    Dastlabki bosqichda biz aniqlagan asosiy elementlarni jadvalga o'tkazing:
    1 = x 4 ;
    2 = x 5 ;
    3 = x 6 ;

    Cb ustun elementlari


    Ushbu ustunning har bir katakchasi mos keladigan qatordagi asosiy o'zgaruvchiga mos keladigan koeffitsientga teng.
    Cb 1 = 0;
    Cb 2 = 0;
    Cb 3 = 0;

    O'zgaruvchan o'zgaruvchilarning qiymatlari va P ustuni


    Ushbu bosqichda hech qanday hisob-kitoblar talab qilinmaydi, shunchaki qiymatlarni dastlabki bosqichdan jadvalning tegishli kataklariga o'tkazing:
    1 = 160;
    2 = 142;
    3 = 123;

    1,1 = 15;


    1,2 = 10;
    1,3 = 5;
    1,4 = 1;
    1,5 = 0;
    1,6 = 0;
    2,1 = 10;
    2,2 = 4;
    2,3 = 12;
    2,4 = 0;
    2,5 = 1;
    2,6 = 0;
    3,1 = 4;
    3,2 = 15;
    3,3 = 10;
    3,4 = 0;
    3,5 = 0;
    3,6 = 1;

    Maqsad funksiyasi qiymati


    Maqsad funktsiyasining qiymatini Cb ustunini elementlar bo'yicha P ustuniga ko'paytirib, mahsulotlarning natijalarini qo'shib hisoblaymiz.
    Maks P = (Cb 1 * P 01 ) + (Cb 11 * P 2 + (Cb 21 * P 3 = (0 * 160) + (0 * 142) + (0 * 123) = 0;

    Baholangan nazorat o'zgaruvchilari


    Biz har bir boshqariladigan o'zgaruvchi uchun hisob-kitoblarni o'zgaruvchi ustunidagi qiymatni elementlar bo'yicha, Cb ustunidagi qiymatga ko'paytirish, mahsulotlarning natijalarini umumlashtirish va ularning yig'indisidan maqsad funktsiyasi koeffitsientini ayirish orqali hisoblaymiz. bu o'zgaruvchi.
    Maks x 1 = ((Cb 1 * x 1,1 ) + (Cb 2 * x 2,1 ) + (Cb 3 * x 3,1 ) ) - k x 1 = ((0 * 15) + (0 * 10) + (0 * 4) ) - 1800 = -1800;
    Maks x 2 = ((Cb 1 * x 1,2 ) + (Cb 2 * x 2,2 ) + (Cb 3 * x 3,2 ) ) - k x 2 = ((0 * 10) + (0 * 4) + (0 * 15) ) - 2000 = -2000;
    Maks x 3 = ((Cb 1 * x 1,3 ) + (Cb 2 * x 2,3 ) + (Cb 3 * x 3,3 ) ) - k x 3 = ((0 * 5) + (0 * 12) + (0 * 10) ) - 1500 = -1500;
    Maks x 4 = ((Cb 1 * x 1,4 ) + (Cb 2 * x 2,4 ) + (Cb 3 * x 3,4 ) ) - k x 4 = ((0 * 1) + (0 * 0) + (0 * 0) ) - 0 = 0;
    Maks x 5 = ((Cb 1 * x 1,5 ) + (Cb 2 * x 2,5 ) + (Cb 3 * x 3,5 ) ) - k x 5 = ((0 * 0) + (0 * 1) + (0 * 0) ) - 0 = 0;
    Maks x 6 = ((Cb 1 * x 1,6 ) + (Cb 2 * x 2,6 ) + (Cb 3 * x 3,6 ) ) - k x 6 = ((0 * 0) + (0 * 0) + (0 * 1) ) - 0 = 0;

    Download 6,35 Mb.
      1   2   3   4




    Download 6,35 Mb.

    Bosh sahifa
    Aloqalar

        Bosh sahifa



    #include #include using namespace std; double func(double x) { return x x x + x x x 1; } double derivative(double x) { return x x + x 1; } void newton(double x0, double epsilon) { double x1; int iteration = 0; do {

    Download 6,35 Mb.