1-savol Integrallarning qiymatini 3 xona aniqlikda trapesiya va Simpson formulalari yordamida hisoblang


Download 167.1 Kb.
bet1/2
Sana24.06.2020
Hajmi167.1 Kb.
#121302
  1   2
Bog'liq
Qo‘boshevMuhiddin 1-joriy


1-joriy nazorat ishi.

Variant-10.



1-savol Integrallarning qiymatini 3 xona aniqlikda trapesiya va Simpson formulalari yordamida hisoblang.






2-savol Quyidagi birinchi tartibli differentsial tenglamalar sistemasi uchun Koshi masalasini: Eyler usuli bilan taqribiy yechimini toping.
y(0)=0 z(0)=0

1misol cod c++ da

#include

#include

using namespace std;

int main()

{

float a,b,h;



int n ;

cout<<" n = ";

cin>>n;

cout<<" a = ";



cin >> a ;

cout << " b = ";

cin >> b;

float x[n];

double y[n];

double sum=0;

x[0]=a;

h = (b-a)/n;



cout<

for(int i=0; i<=n; i++)

{

x[i]=x[0]+i*h;



cout<

y[i]=(1/sqrt(1+2*pow(x[i],2)));

cout <<"y"<

}

for(int i=1; i

{

sum += y[i];

}

sum = h*(sum + (y[0]+y[10])/2);



cout<<" Integral SimpSon natija = " << sum << endl;

return 0;

}

#include



#include

using namespace std;

int main()

{

float a,b,h;



int n ;

cout<<" n = ";

cin>>n;

cout<<" a = ";



cin >>a ;

cout << " b = ";

cin >>b;

float x[n];

double y[n];

double sum1=0;

double sum2=0;

x[0]=a;


h = (b-a)/n;

cout<

for(int i=0; i<=n; i++)

{

x[i]=x[0]+i*h;



cout<

y[i]=(1/sqrt(1+2*pow(x[i],2)));

cout <<"y"<

}

for(int i=1; i<=n; i+=2)



{

sum1 =sum1 + y[i];

}

sum1 = 4*sum1;



for(int i=2; i<=n; i+=2)

{

sum2 = sum2 +y[i];



}

sum2 = 2*sum2;

sum1 = (h*(sum1+ sum2 + (y[0]+y[10])/2))/3;

cout<<" Integral trapedsiya natija = " << sum1<< endl;



return 0;}
Download 167.1 Kb.

Do'stlaringiz bilan baham:
  1   2




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