Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

什么意思,下面的方程怎么解呢?

Posted by nuanran at 2006-09-12 20:45:09
In Reply To:证明收敛性 Posted by:wywcgs at 2006-09-12 20:35:12
5*x1+3*x2+x3+x4=15
x1*x2+x2*x3+x3*x4=17;
x1*x1+x2*x2+x3*x3-x4*x4=9;
x1*x3+x2*x4+x1*x1*x1=8;
解出x1,x2,x3,x4
老师说用牛顿迭代去解,为什么我的程序就跑不出来,好象每次只要未知数达大三个,我用牛顿迭代还从来没有解出过呢.
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int main()
{
	double x1,x2,x3,x4;
	double xt1=1.01,xt2=1.01,xt3=4.01,xt4=2.99,tmp1,tmp2;
	do{
		x1=xt1;
		x2=xt2;
		x3=xt3;
		x4=xt4;
		tmp1=5.0*x1+3.0*x2+x3+x4-15.0;
		xt1=x1-tmp1/5.0;
		tmp1=x1*x2+x2*x3+x3*x4-17.0;
		tmp2=x1+x3;
		xt2=x2-tmp1/tmp2;
		tmp1=x1*x1+x2*x2+x3*x3-x4*x4-9.0;
		tmp2=2.0*x3;
		xt3=x3-tmp1/tmp2;
		tmp1=x1*x3+x2*x4+x1*x1*x1-8.0;
		tmp2=x2;
		xt4=x4-tmp1/tmp2;
	}while(fabs(x1-xt1)>0.1||fabs(x2-xt2)>0.1||fabs(x3-xt3)>0.1||fabs(x4-xt4)>0.01);
	printf("%.1lf %.1lf %.1lf %.1lf\n",xt1,xt2,xt3,xt4);
	return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator