How do you calculate recursive efficiency?

  • Context: Undergrad 
  • Thread starter Thread starter David Carroll
  • Start date Start date
  • Tags Tags
    Efficiency
Click For Summary

Discussion Overview

The discussion revolves around the concept of calculating the efficiency of recursive formulas, particularly in the context of numerical algorithms. Participants explore various aspects of recursive efficiency, including definitions, performance metrics, and comparisons with iterative approaches.

Discussion Character

  • Exploratory
  • Technical explanation
  • Conceptual clarification
  • Debate/contested

Main Points Raised

  • One participant seeks references for calculating the efficiency of recursive formulas and asks how efficiency is defined and proven.
  • Another participant suggests that the efficiency of a numerical algorithm can vary based on the input, prompting considerations of best, worst, and average case performance.
  • A different participant notes a lack of familiarity with the term "recursive efficiency" but mentions that recursive algorithms may require more RAM, complicating execution despite being easier for programmers.
  • One participant proposes converting recursive solutions to iterative forms to analyze efficiency using O(n) notation, suggesting that both forms share the same complexity.
  • A later reply introduces the concept of rate of convergence, distinguishing between linear and quadratic convergence in relation to the efficiency of algorithms like the square root finding method.

Areas of Agreement / Disagreement

Participants express varying perspectives on defining and calculating recursive efficiency, with no consensus reached on a singular definition or method. Multiple competing views on performance metrics and approaches to efficiency remain evident throughout the discussion.

Contextual Notes

Participants reference different aspects of efficiency, such as RAM usage and convergence rates, without resolving the implications of these factors on the overall understanding of recursive efficiency.

Who May Find This Useful

This discussion may be of interest to individuals exploring numerical algorithms, recursive programming, and performance analysis in computational contexts.

David Carroll
Messages
181
Reaction score
13
Greetings ladies and gentlemen.

I am right now working on a recursive formula whose nature I'll define later. Unfortunately, I have no formal education in math. What I want is some references to where I can find how to calculate the efficiency of a recursive formula and how to prove its efficiency.

For example (though this is not the formula I'm working with), consider the algorithm to find the square root of a number: Step 1: Divide x2 by any number. Step 2: Take the arithmetic mean of the output number and the original input number and divide x2 by this arithmetic mean. Repeat step 2 until the output differs by its corresponding input by zero at D decimal places, where D is the number of decimal places that fits on some calculating device.

How is the efficiency of the above recursive formula defined and calculated? How is the efficiency of any recursive formula defined and calculated?
 
Mathematics news on Phys.org
A numerical algorithm may quickly converge to the answer for some inputs (for example divide 4 by 2 to estimate its square root) and slowly converge to an answer for others. So you can begin by deciding what you care about - best case performance? worst case performance? You can attempt to deal with "average case performance", but this can get complicated because you must specify what you mean by "average". Do you have some way of defining a probability distribution for the inputs that are chosen?
 
David Carroll said:
How is the efficiency of the above recursive formula defined and calculated? How is the efficiency of any recursive formula defined and calculated?
Never heard of a term "recursive efficiency". But wait, I remembered something, maybe it will be of some help. I know recursive algorithms encoded in a some programming language require more RAM to be executed. It is easier (and shorter way) for a programmer but harder for a machine.
 
Last edited:
There's a certain fact that struck me as profound and enlightening when I first learned of it:

"Any recursive function has an iterative counterpart, and any iterative function has a recursive counterpart."

Convert your recursive solution to an iterative one. Then, use O(n) notation to analyze and formally mark the efficiency of your algorithm. Whatever complexity the iterative form is, the same complexity will embody the recursive form.

If you know exactly how many times something will loop, (and sometimes, even when you don't), you can put the computation in a 'closed-form'. The following code outputs your sqrt(x) example after four iterations, assuming an initial guess of 'x'.

input x
A = x+1
B = A^2
C = 4*x

output ( (C+B)^2+32*x*B ) / ( 8*A*(C+B) )

You can find that by finding the composition of the initial function of step 2 with itself a few times.
 
Last edited:
  • Like
Likes   Reactions: David Carroll
Thanks guys. Actually, this is all a moot point. I found a non-recursive way to deal with what I'm working on.

o:)
 
I guess you looked for rate of convergence.

As examples, a linear convergence will add the same number of significant digits per step, while a quadratic convergence (like the mentioned square root finding method) will double the number of significant digits each n steps.
 

Similar threads

  • · Replies 11 ·
Replies
11
Views
2K
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 7 ·
Replies
7
Views
3K
Replies
28
Views
4K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 19 ·
Replies
19
Views
3K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K