Skip to main content

5 replies

23-Emerald I
January 9, 2012

Each time the Adapt(f,a,b) function does not return an answer within tolerance it subdivides the interval and applies itself to each half.  This process continues (reoccurs) until the desired criteria are met.  So a process mght look like:

                                                                 fail    

                              fail                                                                 fail

          fail                              pass                              fail                              fail

pass               pass                                             fail               pass          pass     pass

                                                                      pass     pass

The answer would come back as the sum of the passes.

Joeboy1-VisitorAuthor
1-Visitor
January 9, 2012

Thank you for the help Fred.  How does the program exit the loop ? Is there a maximum number of passes it can make ?

23-Emerald I
January 9, 2012

The idea of recursion is that the program will call itself over and over, as many times as it needs to.  So each time the test of criteria are not met two more instances of the program are launched.

When the criteria are met, the answer (correct to the specified accuracy) is retruned. In the small example above, fifteen different cases of Adapt were launched.

Joeboy1-VisitorAuthor
1-Visitor
January 9, 2012

Fred, I don't see the small example you refer to

23-Emerald I
January 9, 2012

The first comment:

   

                                                                 fail    

                              fail                                                                 fail

          fail                              pass                              fail                              fail

pass               pass                                             fail               pass          pass     pass

                                                                      pass     pass

(Might make this a discussion rather than a document--it's easier to see revisions/ comments.)