1-Amaliy ish Bajardi: 650-21 guruh talabasi Xabibulloyev Ixtiyorxon Tekshirdi: Ravshanov Shohjaxon Toshkent 2023 68-variant
Download 279.6 Kb.
|
algoritm1topshiriq
- Bu sahifa navigatsiya:
- Xabibulloyev Ixtiyorxon Tekshirdi: Ravshanov Shohjaxon Toshkent 2023 68-variant 1-topshiriq
- Dastur natijasi : 2-Topshiriq Yuqoridagi tenglamani Nyuton
- Dastur natijasi: 3-topshiriq
O‘ZBEKISTON RESPUBLIKASI AXBOROT TEXNOLOGIYALARI VA KOMMUNIKATSIYALARINI RIVOJLANTIRISH VAZIRLIGI MUXAMMAD AL-XORAZMIY NOMIDAGI TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETI Algoritmlarni loyihalash 1-Amaliy ish Bajardi: 650-21 guruh talabasi Xabibulloyev Ixtiyorxon Tekshirdi: Ravshanov Shohjaxon Toshkent 2023 68-variant 1-topshiriq: n1={N/3}+1 => n1={68/3}+1=3; n2={N/5}+1 => n2={68/5}+1=4; n3={N/7}+1 => n3={68/7}+1=6; Umumiy tenglama: → x³+n1*x²-n2*x-n3=0 => x³+3x²-4x-6=0; x³+3x²-4x-6=0 Tenglamani Vatarlar usulida taqribiy yechamiz: //Vatarlar usuli #include #include using namespace std; float f(float x) { return pow(x,3)+3*x*x-4*x-6; } float f1(float x) { return 3*pow(x,2)+6*x-4; } int main() { float x0, x1; float a=0, b=2,eps=0.00001; int i=0; x0=a; x1=x0-(f(x0)*(b-x0))/(f(b)-f(x0)); while(abs(x0-x1)>eps) { x0=x1; x1=x0-(f(x0)*(b-x0))/(f(b)-f(x0)); i++; } cout<<"x1="< } Dastur natijasi: 2-Topshiriq Yuqoridagi tenglamani Nyuton usulida taqribiy yechamiz: // Online C++ compiler to run C++ program online //Nyuton usuli #include #include using namespace std; float f(float x) { return pow(x,3)+3*x*x-4*x-6; } float f1(float x) { return 3*pow(x,2)+6*x-4; } int main() { float x0, x1; float a=0, b=2,eps=0.00001; int i=0; x0=a; x1=x0-(f(x0)*(b-x0))/(f(b)-f(x0)); while(abs(x0-x1)>eps) { x0=x1; x1=x0-(f(x0)*(b-x0))/(f(b)-f(x0)); i++; } cout<<"x1="< } Dastur natijasi: 3-topshiriq Chiziqli dastur kodi: #include #include #include using namespace std; const double eps = 1e-5; double f(double x1, double x2, double x3) { return 1800*x1 + 2000*x2 + 1500*x3; } int main() { double n1 = ceil(68.0/3), n2 = ceil(68.0/5), n3 = ceil(68.0/7); double a[3][3] = {{15, 10, 5}, {10, 4, 12}, {4, 15, 10}}; double b[3] = {35*n1 + 35*n2 + 20*n3, 32*n1 + 18*n2 + 28*n3, 18*n1 + 34*n2 + 35*n3}; double x[3] = {0, 0, 0}; double l = f(x[0], x[1], x[2]); bool flag = true; while (flag) { flag = false; for (int i = 0; i < 3; i++) { double temp = b[i]; for (int j = 0; j < 3; j++) { if (i != j) { temp -= a[i][j]*x[j]; } } double t = temp/a[i][i]; if (t - x[i] > eps) { x[i] = t; flag = true; } } double temp = f(x[0], x[1], x[2]); if (temp - l > eps) { l = temp; flag = true; } } cout << fixed << setprecision(5) << "yechim : " << l << endl; cout << "x1 = " << x[0] << endl; cout << "x2 = " << x[1] << endl; cout << "x3 = " << x[2] << endl; return 0; } 4-topshiriq CHDM ni simpleks usulida hisoblang. Topilgan yechimlardan iqtisodiy tahlil o’tkazing. Tegishli matematik modelni ishlab chiqarishni takomillashtirish bo’yicha tavsiyalarni shakllantiring. Download 279.6 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling