文件名称:3
- 所属分类:
- 数据结构常用算法
- 资源属性:
- [Windows] [Visual C] [源码]
- 上传时间:
- 2012-11-26
- 文件大小:
- 1.11mb
- 下载次数:
- 0次
- 提 供 者:
- 闻*
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
实现二分法求解方程。编写并使用以下函数:
double SolveRoot(double(*pf)(double x),double a,double b,int n)
这里,pf指向一个函数f,f用来定义要求解的方程f(x)=0,a和b是未知解x的上下界(即a<=x<=b),
n是循环次数。例如,如果f(x)=x*x-2,则SolveRoot (f,1,2,100)将返回1.414213562373095,
即方程为x*x=2的解。二分法的原理是反复地把区间分为两个相等区间,然后用其中含有解的一半代替该区间,
依次类推,得到满足精度的解。它通过检查f(a)和f(b)的符号来判断解是否在区间中。-Achieve the dichotomy solve the equations. To prepare and use the following function: double SolveRoot (double (* pf) (double x), double a, double b, int n) here, pf points to a function f, f used to define the required solution of the equation f (x) = 0 , a and b are unknown solution x of the upper and lower bounds (ie, a < = x < = b), n is the cycle number. For example, if f (x) = x* x-2, then the SolveRoot (f, 1,2,100) will return 1.414213562373095, that is, the equation x* x = 2 solution. Dichotomy of the principle is repeatedly the range is divided into two equal intervals, then half of them containing solution instead of the interval, and so on, accuracy of the solution are met. It does this by checking f (a) and f (b) solutions of the symbol to determine whether the interval.
double SolveRoot(double(*pf)(double x),double a,double b,int n)
这里,pf指向一个函数f,f用来定义要求解的方程f(x)=0,a和b是未知解x的上下界(即a<=x<=b),
n是循环次数。例如,如果f(x)=x*x-2,则SolveRoot (f,1,2,100)将返回1.414213562373095,
即方程为x*x=2的解。二分法的原理是反复地把区间分为两个相等区间,然后用其中含有解的一半代替该区间,
依次类推,得到满足精度的解。它通过检查f(a)和f(b)的符号来判断解是否在区间中。-Achieve the dichotomy solve the equations. To prepare and use the following function: double SolveRoot (double (* pf) (double x), double a, double b, int n) here, pf points to a function f, f used to define the required solution of the equation f (x) = 0 , a and b are unknown solution x of the upper and lower bounds (ie, a < = x < = b), n is the cycle number. For example, if f (x) = x* x-2, then the SolveRoot (f, 1,2,100) will return 1.414213562373095, that is, the equation x* x = 2 solution. Dichotomy of the principle is repeatedly the range is divided into two equal intervals, then half of them containing solution instead of the interval, and so on, accuracy of the solution are met. It does this by checking f (a) and f (b) solutions of the symbol to determine whether the interval.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
3\3.dsp
.\3.dsw
.\3.ncb
.\3.opt
.\3.suo
.\Debug\solveroot.exe
.\.....\solveroot.ilk
.\.....\solveroot.obj
.\.....\solveroot.pch
.\.....\solveroot.pdb
.\.....\vc60.idb
.\.....\vc60.pdb
.\solveroot.cpp
.\solveroot.dsp
.\solveroot.dsw
.\solveroot.ncb
.\solveroot.opt
.\solveroot.plg
.\t.txt
.\Debug
3
.\3.dsw
.\3.ncb
.\3.opt
.\3.suo
.\Debug\solveroot.exe
.\.....\solveroot.ilk
.\.....\solveroot.obj
.\.....\solveroot.pch
.\.....\solveroot.pdb
.\.....\vc60.idb
.\.....\vc60.pdb
.\solveroot.cpp
.\solveroot.dsp
.\solveroot.dsw
.\solveroot.ncb
.\solveroot.opt
.\solveroot.plg
.\t.txt
.\Debug
3