In mathematics:
Generally speaking, for the function f(x), if there is a real number c, f(c)=0 when x=c, then x=c is called the zero point of the function f(x).
Solving the equation requires all zeros of f(x).
Find a and b first, so that the signs of f(a) and f(b) are different, that is to say, there must be zero in the interval (a, b), and then find f[(a+b)/2].
Now suppose f (a)
(1) If f[(a+b)/2]=0, the point is zero.
If f [(a+b)/2]
Judgment of midpoint function value.
if f[(a+b)/2]>; 0, interval (a, (a+b)/2), (a+b)/2 = >; B, continue to use from ①.
Judgment of midpoint function value.
In this way, it can always approach zero.
By reducing the cell where the zero point of f(x) is located by half at a time, the two endpoints of the interval gradually approach the zero point of the function, thus obtaining the approximate value of the zero point. This method is called dichotomy.
Given the precision ξ, the steps of finding the approximate value of the zero point of the function f(x) by dichotomy are as follows:
1 determine the interval [a, b] and verify f (a) f (b)
Find the midpoint c of the interval (a, b).
3 calculate f (c).
(1) If f(c)=0, then c is the zero point of the function;
(2) If f (a) f (c)
(3) If f (c) f (b)
4. Determine whether the accuracy ξ is reached: that is, if┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃┃.
Because the specific operation of the calculation process is complicated, but each step is the same, it can be calculated by writing a program.
Example: (C language)
The equation is: f(x) = 0, in the example, f (x) =1+x-x 3.
Use example:
Enter a b e: 1 2 1e-5.
Solution: 1.32472
The source code is as follows:
# include & ltstdio.h & gt
# include & ltstdlib.h & gt
# include & ltmath.h & gt
# include & ltassert.h & gt
Double f (double x)
{
Returns1+x-x * x * x;
}
int main()
{
Double a = 0, b = 0, e =1e-5;
printf(" input a b e:");
Scanf("%lf%lf%lf ",& one, & e);
e = fabs(e);
if(fabs(f(a))& lt; = e)
{
Printf ("solution: %lg\n", a);
}
else if(fabs(f(b))& lt; = e)
{
Printf ("solution: %lg\n", b);
}
else if(f(a)* f(b)& gt; 0)
{
printf(" f(% LG)* f(% LG)& gt; 0 ! Need & lt= 0! \n”,a,b);
}
other
{
while (fabs(b-a)>e)
{
Double c = (a+b)/2.0;
if(f(a)* f(c)& lt; 0)
b = c;
other
a = c;
}
Printf ("solution: %lg\n", (a+b)/2.0);
}
Returns 0;
}
Example: C++ language [written in C class].
| f(x)| & lt; 10^-5 f(x)=2x^3-4x^2+3x-6
# including "iostream"
# contains "stdio.h"
# contains "math.h"
# Define null 0
double f(x)(double); //f(x) function
void main()
{
Double xa (null), xb (null), xc (null);
do
{
Printf ("Please enter a range x0x1:");
STD::CIN & gt; & gtxa & gt& gtXB; //Enter the value of xa xb.
printf("%f %f ",xa,XB);
}
while(fx(xa)*fx(xb)>=0); //Determine whether the input range contains a function value of 0.
do
{
if(FX((xc =(xa+XB)/2))* FX(XB)& lt; 0) // Dichotomy is used to determine the x-value interval whose function value contains 0.
{
xa = xc
}
other
{
xb = xc
}
}
while(fx(xc)>pow( 10.0,-5)| | FX(xc)& lt; - 1*pow( 10.0,-5)); //Judge whether the x root is in the accurate range close to the function value of 0.
Printf("\n is: %f ",xc);
}
Double fx (double x)
{
return(2.0*pow(x,3)-4.0*pow(x,2)+3 * x-6.0);
}
In economics:
Traditional economists divide economy into two parts: real economy and monetary economy. Among them, economic theory analyzes the decision of actual variables, and monetary theory analyzes the decision of price. There is not much relationship between them. This is called dichotomy.
How about the curriculum of Ruisi Kindergarten?
Children aged 3 -5 are suitable for American kindergarten courses, and children aged 3-5 learn Englis