|
O’zbekiston respublikasi axborot
|
Sana | 20.01.2024 | Hajmi | 121.1 Kb. | | #142163 |
Bog'liq Algoritmlash loyihalash lab-1 11-15 amaliyot ttb, Hayot faoliyati xavfsizligining huquqiy
O’ZBEKISTON RESPUBLIKASI AXBOROT
TEXNOLOGIYALARI VA KOMMUNIKATSIYALARINI
RIVOJLANTIRISH VAZIRLIGI
MUHAMMAD AL-XORAZMIY NOMIDAGI
TOSHKЕNT AXBOROT TЕXNOLOGIYALARI
UNIVЕRSITЕTI
AKT SOHASIDA IQTISODIYOT VA MENEJMENT FAKULTETI ELEKTRON TIJORAT YO’NALISH
121-20 GURUH TALABASI JAKSILIKOVA GULZODANING
Algoritmlash loyihalash
fanidan
1-Laboratoriya ishi
TOSHKENT 2022
//Trapetsiya usuli f(x)=pow(x,2)+x+1)/sqrt(pow(x,3)+5)
#include
#include
using namespace std;
float funksiya (float x){
float f;
f=(pow(x,2)+x+1)/sqrt(pow(x,3)+5);
return f;
}
int main()
{
float a=0, b=2,n=10,s,h,F;
s=(funksiya(a)+funksiya(b))/2;
h=(b-a)/n;
for( int i=1;i<=n;i++){
s=s+funksiya(a+(i-1)*h);
}
F=s*h;
c out<<" "<//To`rtburchak usuli f(x)=pow(x,2)+x+1)/sqrt(pow(x,3)+5)
#include
#include
using namespace std;
int main()
{
float a=0, b=2,n=10,h,f=0, x;
for (int i=1;i<=n;i++) {
h=(pow(x,2)+x+1)/sqrt(pow(x,3)+5);
//delx=(b-a)*i/n;
f=f+(pow(x,2)+x+1)/sqrt(pow(x,3)+5);
}
cout<
}
// (pow(x,2)+x+1)/sqrt(pow(x,3)+5) integralni Simpson usulida hisoblash
//[a;b] => [0,2];
#include
#include
#include
using namespace std;
double f(double x)
{
return (pow(x,2)+x+1)/sqrt(pow(x,3)+5);
}
int i, m; float n,a,b,h,s;
int main(int argc, char *argv[]) {
cout<cout<cout<<" a= "; cin>>a;
cout<<" b= "; cin>>b;
cout<<" n= "; cin>>n;
h=(b-a)/n; cout<
m= int(n/2); cout<for (i=1; i<=m; i++){
s+=f(a+(2*i-2)*h) + 4*f(a+(2*i-1)*h) + f(a+2*i*h);
}
s=s*h/3;
cout<
return 0;
}
|
| |