Raqamli texnologiyalar fakulteti


Download 216.26 Kb.
bet2/2
Sana25.01.2023
Hajmi216.26 Kb.
#1119308
1   2
Bog'liq
Hisoblash usullari

double l,h,tao, atao;

double Ux0(double x){
if (x>=0 and x<=0.25) return 92*x+22;
if(0.25<=x and x<=0.5) return -117.14*x-74.28;
}

int main(){
cout<<" Shahzod Nurmatov Issiqlik tarqalish tenglamasi Oshkor sxema"<
cout<<"l=";cin>>l;
cout<<"h=";cin>>h;
cout<<"tao=";cin>>tao;
cout<<"atao=";cin>>atao;

double y[100][100]; // qiymatlar massivi

int I=10, J=10; // to'r o'lchamlari

// boshlang'ich shartlarni ta'minlaymiz
for(int i=0;i<=I;i++){
y[i][0]=Ux0(i*h);
}

double gamma,fi;
gamma = tao/h/h;


for(int j=0;j

for(int i=1;i
y[i][j+1]=(1-2*gamma)*y[i][j]+gamma*(y[i-1][j]+y[i+1][j]);
}
y[0][j]=0;
y[I][j]=0;

}

// hosil bo'lgan y[][] matritsamiz yechimlar matritsasi hisoblanadi
for(int i=0; i<=I; i++)
for(int j=0; j<=J; j++)
{
cout<<"\n # "<
cout<<"| i | x (m) | y(i) |\n";
cout<<"|----|----|----|----|----|";
for(int i=0;i<=I;i++){
cout<<"\n";
cout<<" | i="<
cout<<" | x="<
cout<<" | y["<
cout<<" | ";
}

cout<
}
}


//"Issiqlik tarqalish tenglamasi" Oshkormas sxema
#include
using namespace std;
double a, b,c,d, l, tao, h, at;
double y[1000][1000];
double yx0(double x){
if(x>=0 && x<=c) return a+(d-a)*x/c;
else return ((b-d)*x+d*l-c*b)/(l-c);
}
int main(){
cout<<"Issiqlik tarqalish tenglamasi Oshkormas sxema"<
// Qiymatlarni kiritamiz:
cout<<"a=";cin>>a;
cout<<"b=";cin>>b;
cout<<"c=";cin>>c;
cout<<"d=";cin>>d;
cout<<"l=";cin>>l;
cout<<"h=";cin>>h;
cout<<"tao=";cin>>tao;
cout<<"at=";cin>>at;

long int I=l/h, T=10; // to'rning o'lchamlari

// chegaraviy shartlarni ta'minlaymiz
for(int t=0;t<=T;t++){
y[0][t]=a;
y[I][t]=b;
}
// boshlang'ich shartlar ta'minlanadi:
for(int i=1;i
y[i][0]=yx0(i*h);
}
// Progonka usulidan foydalanib masalani ishlaymiz:

double A,B,C,F,alfa[I],betta[I],gamma;
gamma = at*tao/h/h;
A=gamma;
B=1+2*gamma;
C=gamma;

for(int j=0;j

alfa[1]=0;
betta[1]=a;

for(int i=1;i
F=y[i][j];
// F=Ux0(i*h); // bu chiziqli funksiyadan qiymatlarini olinadi
alfa[i+1]=-C/(A*alfa[i]-B);
betta[i+1]=-(F+A*betta[i])/(A*alfa[i]-B);
}

// progonkanimg teskari qadamini topamiz y[i][j+1]=alfa[i+1]*y[i+1][j+1]+betta[i+1]
for(int i=I-1;i>0;i--){
y[i][j+1]=alfa[i+1]*y[i+1][j+1]+betta[i+1];
}


// Natijalarni ekranga chop etamiz

cout<<"\n # "<
cout<<"| i | x (m) | alfa(i) | betta(i) | y(i) |\n";
cout<<"|----|----|----|----|----|";
for(int i=0;i<=I;i++){
cout<<"\n";
cout<<" | i="<
cout<<" | x="<
cout<<" | alfa["<
cout<<" | betta["<
cout<<" | y["<
cout<<" | ";
}

cout<
}
}

LABORATORIYA ISHI № 4
TO`LQIN TENGLAMASI UCHUN ARALASH MASALANI CHEKLI AYIRMALAR USULI BILAN YECHISH
To'lqin tarqalish tenglamasi Oshkor sxema;
#include
using namespace std;
double a, b, c, d, e, l, tao, h, at, gamma_2;
double y[1000][1000];
double yx0(double x){
if(x>=0 && x<=b) return 0;
if(x>=b && x<=(b+c)/2) return 2*a/(c-b)*x-2*a*b/(c-b);
if(x>=(b+c)/2 && x<=c) return -2*a/(c-b)*x+2*a*c/(c-b);
if(x>=c && x<=l) return 0;
}
double y_x0(double x){
if(x>=0 && x<=b) return a*x/b;
if(x>=b && x<=e) return a;
if(x>=e && x<=l) return (a-1)/(e-1)*x;
}
int main(){
cout<<" Shahzod Nurmatov To'lqin tarqalish tenglamasi Oshkor sxema"<
// Qiymatlarni kiritamiz:
cout<<"a=";cin>>a;
cout<<"b=";cin>>b;
cout<<"c=";cin>>c;
cout<<"d=";cin>>d;
cout<<"e=";cin>>e;
cout<<"l=";cin>>l;
cout<<"h=";cin>>h;
cout<<"at=";cin>>at;

long int I=10, J=10; // to'rning o'lchamlari
tao=h/at;
gamma_2=(at*at*tao*tao)/(h*h);
// boshlang'ich shartlar ta'minlanadi:
for(int i=0;i<=I;i++){
y[i][0]=yx0(i*h);
}
for(int i=1;i<=I;i++){
y[i][1]=yx0(i*h)+tao*y_x0(i*h);
}
for(int j=1;j<=J;j++){

for(int i=1;i<=I;i++){
y[i][j+1]=-y[i][j-1]+gamma_2*(y[i-1][j]+y[i+1][j])+2*(1-gamma_2)*y[i][j];
}
y[0][j]=0;
y[I][j]=0;

}
for(int j=0; j<=J; j++)
{
cout<<"\n # "<
cout<<"| i | x (m) | alfa(i) | betta(i) | y(i) |\n";
cout<<"|----|----|----|----|----|";
for(int i=0;i<=I;i++){
cout<<"\n";
cout<<" | i="<
cout<<" | x="<
cout<<" | y["<
cout<<" | ";
}

cout<
}
// {for (int i=0; i<=I; i++)
// {
// cout<<"y["<
// }
// cout<
// }

}

To'lqin tarqalish tenglamasi Oshkormas sxema;
#include
using namespace std;
double a, b,c,d, e, l, tao, h, at;
double y[1000][1000], f[1000];
double yx0(double x){
if(x>=0 && x<=b) return 0;
if(x>=b && x<=(b+c)/2) return 2*a/(c-b)*x-2*a*b/(c-b);
if(x>=(b+c)/2 && x<=c) return -2*a/(c-b)*x+2*a*c/(c-b);
if(x>=c && x<=l) return 0;
}
double y_x0(double x){
if(x>=0 && x<=b) return a*x/b;
if(x>=b && x<=e) return a;
if(x>=e && x<=l) return (a-1)/(e-1)*x;
}
int main(){
cout<<" To'lqin tarqalish tenglamasi Oshkormas sxema"<
// Qiymatlarni kiritamiz:
cout<<"a=";cin>>a;
cout<<"b=";cin>>b;
cout<<"c=";cin>>c;
cout<<"d=";cin>>d;
cout<<"e=";cin>>e;
cout<<"l=";cin>>l;
cout<<"h=";cin>>h;
cout<<"tao=";cin>>tao;
cout<<"at=";cin>>at;

long int I=l/h, T=10; // to'rning o'lchamlari

// chegaraviy shartlarni ta'minlaymiz
for(int t=0;t<=T;t++){
y[0][t]=0;
y[I][t]=0;
}
// boshlang'ich shartlar ta'minlanadi:
for(int i=1;i
y[i][0]=yx0(i*h);

}
for(int i=1;i
f[i]=2*tao*y[i][0]-y[i+1][0];

}
// Progonka= usulidan foydalanib masalani ishlaymiz:

double A,B,C,F,alfa[I],betta[I],gamma;
gamma = at*tao/h/h;
A=gamma;
B=1+2*gamma;
C=gamma;

for(int j=0;j

alfa[1]=0;
betta[1]=a;

for(int i=1;i

alfa[i+1]=-C/(A*alfa[i]-B);
betta[i+1]=-(f[i]+A*betta[i])/(A*alfa[i]-B);
}

// progonkanimg teskari qadamini topamiz y[i][j+1]=alfa[i+1]*y[i+1][j+1]+betta[i+1]
for(int i=I-1;i>0;i--){
y[i][j+1]=alfa[i]*y[i+1][j+1]+betta[i];
}


// Natijalarni ekranga chop etamiz

cout<<"\n # "<
cout<<"| i | x (m) | alfa(i) | betta(i) | y(i) |\n";
cout<<"|----|----|----|----|----|";
for(int i=0;i<=I;i++){
cout<<"\n";
cout<<" | i="<
cout<<" | x="<
cout<<" | alfa["<
cout<<" | betta["<
cout<<" | y["<
cout<<" | ";
}

cout<
}
}

Download 216.26 Kb.

Do'stlaringiz bilan baham:
1   2




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