Qodirov Abbos ning Algoritmlarni loyihalash


Download 1.23 Mb.
Sana05.05.2023
Hajmi1.23 Mb.
#1430468

Muhammad Al-Xorazmiy Nomidagi Toshkent Axborot Texnalogiyalar Universiteti Television Texnalogiyalar fakulteti 510-21- guruh talabasi Qodirov Abbos ning Algoritmlarni loyihalash


fanidan bajargan
1-amaliy ishi
Variant N-13


n1=2, n2=4, n3=7

  1. Tenglamaning yechim joylashgan oralig’ini toping. Vatarlar usuli yordamida ildizlarni e=10-5 aniqlik bilan hisoblash algoritmini tuzing. Bunday aniqllika erishish uchun zarur qadamlar sonini aniqlang.

#include
#include
using namespace std;
float f(float x){
return pow(x,3)+2*x*x-4*x-7; //vatarlar usuli
}
float f1(float x)
{
return 3*x*x+4*x-4;
}
float f2(float x){
return 6*x+4;
}
int main()
{
float a=0,b=1,eps=0.001;
float x[100];
//if(f1(a)*f2(a)>0){
// x[0]=a;
// }
// else
x[0]=a;
// b=a;
x[1]=x[0]-(f(x[0])*(b-x[0]))/(f(b)-f(x[0]));
int i=0;
while(fabs(x[i+1]-x[i])>eps){
i++;
x[i+1]=x[i]-(f(x[i])*(b-x[i]))/(f(b)-f(x[i]));;
}
cout<<" x = "<

  • Ushbu masalani Nyuton usuli orqali yechish algoritmini tuzing. Ikkala usulda ham yechimlarni oling. Ko’rib chiqilgan usullar samaradorligini taqqoslang.


    #include
    #include
    using namespace std;
    float f(float x){
    return pow(x,3)+2*x*x-4*x-7; //urinmalar usuli
    }

    float f1(float x){
    return 3*x*x+4*x-4;
    }

    float f2(float x){
    return 6*x+4;
    }

    int main()
    {

    float a,b,eps;
    cin>>a>>b>>eps;
    float x[100];
    if(f(a)*f2(a)>0)
    x[0]=a;
    else x[0]=b;
    x[1]=x[0]-f(x[0])/f1(x[0]);
    int i=0;
    while(fabs(x[i+1]-x[i])>eps){
    i++;
    x[i+1]=x[i]-f(x[i])/f1(x[i]);
    }
    cout<<" x = "<

  • Chiziqli dasturlash masalasini hosil qiling:

    .



    4.CHDM ni simpleks usulida hisoblang. Topilgan yechimlardan iqtisodiy tahlil o’tkazing. Tegishli matematik modelni ishlab chiqarishni takomillashtirish bo’yicha tavsiyalarni shakllantiring.


    Download 1.23 Mb.

    Do'stlaringiz bilan baham:




  • Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
    ma'muriyatiga murojaat qiling