⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gauss 3.c

📁 混凝土结构杆件的非线性计算
💻 C
字号:
#include<stdio.h>
#include<math.h>
#define e 0.004

double gauss(double (*f)(),double a,double b,int n)
{
	double c,d,s;
	double	y[5],h[5];
	int i;
	c=(b-a)/2;
	d=(b+a)/2;
	switch(n)
	{
	case(1):
		y[0]=0;  	h[0]=2;
		break;
	case(2): 
		y[0]=-1/sqrt(3);    h[0]=1;
		y[1]=1/sqrt(3); 	h[1]=1;
		break;
	case(3):
		y[0]=-sqrt(15)/5;   h[0]=5.0/9;
		y[1]=0;             h[1]=8.0/9;
		y[2]=sqrt(15)/5;	h[2]=5.0/9;
		break;
	case(4):
		y[0]=0.8611363;   h[0]=0.3478548;
		y[1]=0.3398810;	  h[1]=0.6521452;
		y[2]=-0.8611363;  h[2]=0.3478548;
		y[3]=-0.3398810;  h[3]=0.6521452;
		break;
	default:
		y[0]=0.9061793;	  h[0]=0.2369269;
		y[1]=0.5384693;   h[1]=0.4786287;
		y[2]=0;           h[2]=0.5688889;
		y[3]=-0.9061793;  h[3]=0.2369269;
		y[4]=-0.5384693;  h[4]=0.4786287;
    	break;
	}
	for(i=0,s=0;  i<n;  i++)
		s+=h[i]*f(c*y[i]+d,b);
	s*=c;
	return(s);
}

double f1(double y,double b)
{

    return((0.132*e*y/b-20*e*e*y*y/(b*b))*400*(560-b+y)/(0.00000484+0.002155*e*y/b));
}
double f2(double y,double b)
{
//	double b;

	return((0.132*e*y/b-20*e*e*y*y/(b*b))*400/(0.00000484+0.002155*e*y/b));
}

void main(void)
{
	double a,b,c,y,s,E,x,s1,s2;
	int n;
	a=0.0;
	n=5;
	s=942.48*455;
//	c=287.15;
	printf("Please input  b=");
	scanf("%lf",&b);
		s2=200000*e*(b-40)*942.48/b;
		s1=200000*e*(560-b)*942.48/b;
		if(s2>=s) s2=s;
		if(s1>=s) s1=s;
	y=gauss(f1,a,b,n)+s2;
    c=gauss(f2,a,b,n)+s2-s1;
    E=y/c-260;
	x=y-c*260;
	printf("y=%lf\ns=%lf\nE=%lf\nx=%lf\n",y,s,E,x/1000000);
}

		
		
		
	



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -