牛顿法解方程正根

牛顿法解方程正根
x*ln((x^2-1)^0.5+x)-(x^2-1)^0.5-0.5x=0
迭代求解,vc程序代码
急等各位高手帮忙!谢谢!
x*ln((x^2-1)^0.5+x)-(x^2-1)^0.5-0.5*x=0
数学人气:922 ℃时间:2020-03-29 23:47:07
优质解答
我是用C
得到结果:2.1155229
/*
牛顿迭代法解方程组的解
x0为迭代的初值,n为迭代次数,jingdu为精度
function为求根代数式,d2functoin为其导数
返回最终符合一定精度的根
*/
double newton_diedai(double x0,int *n,double jingdu)
{
double x,temp;
temp=d2function(x0);
if (fabs(temp)>1e-10) /*防止除数为0*/
{
x=x0-function(x0)/temp;
printf("n=%d\tx=%.5lf\n",*n,x);
}
else
{
printf("error:div 0:\nPress any key to exit:");
getch();
exit(1);
}
if (++(*n)>MAX_DIEDAI_TIME)
{
printf("diedai time:%d > MAX_DIEDAI_TIME:\nPress any key to exit:",*n);
getch();
exit(1);
}
temp=function(x);
if (fabs(temp)
我来回答
类似推荐
请使用1024x768 IE6.0或更高版本浏览器浏览本站点,以保证最佳阅读效果。本页提供作业小助手,一起搜作业以及作业好帮手最新版!
版权所有 CopyRight © 2012-2024 作业小助手 All Rights Reserved. 手机版