Insights Blog
-- Browse All Articles --
Physics Articles
Physics Tutorials
Physics Guides
Physics FAQ
Math Articles
Math Tutorials
Math Guides
Math FAQ
Education Articles
Education Guides
Bio/Chem Articles
Technology Guides
Computer Science Tutorials
Forums
Chemistry
Biology and Medical
Earth Sciences
Computer Science
Computing and Technology
DIY Projects
Trending
Featured Threads
Log in
Register
What's new
Search
Search
Search titles only
By:
Chemistry
Biology and Medical
Earth Sciences
Computer Science
Computing and Technology
DIY Projects
Menu
Log in
Register
Navigation
More options
Contact us
Close Menu
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Forums
Other Sciences
Programming and Computer Science
Recursion in Programming and When to Use or Not to Use It
Reply to thread
Message
[QUOTE="neilparker62, post: 6232712, member: 515522"] One can easily experiment with recursive routines on Excel. Example 1: the Fibonacci sequence: Cell A1 = 1 Cell A2 = 1 Cell A3 = A1 + A2 Then copy/paste the formula in Cell A3 to (n-3) cells below for n terms in the Fibonacci sequence. Example 2: generate sine and cosine (actually we'll use versin(x) which is 1 - cos(x)). Let x = pi/6 Cell A1 = pi()/6*2^(-10), Cell B1 = (pi()/6*2^(-10))^2/2 - these are small angle approximations for sine and versin the smaller the angle the better the approximation. Cell A2 = 2*A1*(1-B1), Cell B2 = 2*(A1)^2, - doubling algorithm. Copy/paste the doubling formulae in cells A2 and B2 to the next 9 rows to determine sin(pi/6) and versin(pi/6). Obviously cos(pi/6) is easily obtained from 1 - versin(pi/6). Example 3. Home loan balance given fixed interest rate and monthly payment. Cell A1 = 1e6 Cell A2 = A1*(1 + 0.01) - 11010.86 Copy / paste the formula in A2 to next 239 rows where n=240 is total no of months (period of loan). Graph your output to see the characteristic curve for loan balance. [/QUOTE]
Insert quotes…
Post reply
Forums
Other Sciences
Programming and Computer Science
Recursion in Programming and When to Use or Not to Use It
Back
Top