|
发表于 2023-9-24 17:21:42
|
显示全部楼层
- Clear["Global`*"];(*删除所有变量*)(*定义两个函数*)f=a/x+1/(2*Sqrt[x+1])-1/(4*a*Sqrt[x])g=a*Log[x]+Sqrt[x+1]-Sqrt[x]/(2*a)(*绘制等值线图,看等值线的交点,交点作为牛顿迭代法的初始值*)ContourPlot[{f==0,g==0},{x,-1,20},{a,-5,5},PlotPoints->100](*牛顿迭代法求解三个根,初始值从函数图像的交点上附近找*)FindRoot[{f==0,g==0},{{x,0.1},{a,0.1}},WorkingPrecision->20]FindRoot[{f==0,g==0},{{x,1},{a,1}},WorkingPrecision->20]FindRoot[{f==0,g==0},{{x,8},{a,-2}},WorkingPrecision->20]
复制代码
图片我就不给你传了,给郭先强节省一点点空间
求解结果- {x -> 0.0071216611120466503644, a -> 0.14348645390183962374}{x -> 1.0000000000000000000, a -> 0.35355339059327376220}{x -> 8.8100183080568324651, a -> -1.8152027137781061088}
复制代码 |
|