Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
I need someone to explain to me how adapt works, seems like it should go into an endless loop if I-I2 never gets less than tolernce value.
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.
Thank you for the help Fred. How does the program exit the loop ? Is there a maximum number of passes it can make ?
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.
Fred, I don't see the small example you refer to
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.)