Algoritmni loyihalash
Download 0.54 Mb.
|
RAIMOV.O 4 AMALIY ISH
MUHAMMAD AL-XORAZMIY NOMIDAGI TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETI QARSHI FILIALI “ TT VA KT ” FAKULTETI 2-BOSQICH AKT 11-21 GURUH TALABASINING “ ALGORITMNI LOYIHALASH” FANIDAN 4 AMALIY ISHI Bajardi : RAIMOV.O Qabul qildi : SAMANDAROV.SH VARIANT 10 Amaliy ishini bajarish tartibi. Laboratoriya ishini bajarishda quyidagi tartibga amal qiling:
2) x3 -3x2+12x-9=0 x3 -3x2+12x-9=0 12x=- Dastur kodi #include #include using namespace std; double f(double x) { return (1.0/tan(x)) - (x/4.0); // ctg(x) ni tan(x) ga o'zlashtirish } double bisection(double a, double b, double eps) { double c = (a + b) / 2.0; while (fabs(f(c)) > eps) { if (f(a) * f(c) < 0) { b = c; } else { a = c; } c = (a + b) / 2.0; } return c; } int main() { double a = 1.0; // Ishorani bo'lgan oraliqning boshi double b = 2.0; // Ishorani bo'lgan oraliqning oxiri double eps = 0.00001; // Xatolar miqdori double x = bisection(a, b, eps); // Bisection usuli bilan yechimni topish cout << "Tenglama yechimi: x = " << x << endl; return 0; } Download 0.54 Mb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling