Home > other >  Novice phyton multistage dichotomy for help
Novice phyton multistage dichotomy for help

Time:10-09

I novice, is currently learning dichotomy, there is a topic don't know how to write the previous conditions, hope everybody a great god help see ~
In order to realize the algorithm for:

Def igs (f, a, b, n, eps=1-8, e maxiter=100) :

O function f (x) in the root of the [a, b] range, a1 - the interval [a, b] is divided into n: {x_i=a + I (b - a)/n, I=0,... N)
2 - find f (x_i) * f (x_i + 1) & lt; The intervals=0
If a 3 - (x_i)=0 f or f (x_i + 1)=0, so direct return the value
4 - calculation of c=(x_i x_i + + 1)/2
5 - if c6 - set a=x_i; B=x_i + 1 and return to step 1 cycle

The principle of the algorithm is the same as dichotomy, but dichotomy is directly take intermediate value calculation, the above steps will be expected to range can be divided into n segments in each segment to calculate whether the subinterval cycle has a root, I would like to write for a long time or not to come out, please advise, thank you very much!
  • Related