Thread: tangent recursion

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    2

    tangent recursion

    im just curuios but the book im using only shows you how to do a recursive sine function... how the heck would you do a tangent function, with its mathematical approximation ? like, here:

    http://en.wikipedia.org/wiki/Taylor_...mmon_functions

    anyone have code online regarding this?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,656
    I guess at some point, you need to start trying stuff for yourself rather than assuming you can find an example either in a book or online.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Lean Mean Coding Machine KONI's Avatar
    Join Date
    Mar 2007
    Location
    Luxembourg, Europe
    Posts
    444
    I thought that if you already the mathematical formula with the Epsilon addition operator, that the rest would be trivial. I mean, getting from the epsilon notation to a for() or even recursion is nearly automatic:
    Code:
    Epsilon(1, infinity) f(x)
    
    equals
    
    sum = 0;
    for(x = 1; x < infinity; x++)
        sum += f(x)
    
    equals
    
    sum = 0;
    while (x < infinity)
        sum += f(x++)
    
    equals
    
    function sum(x)
        return f(x) + sum(x+1)
    Change the above code slightly to add stop conditions and you're done.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Template Recursion Pickle
    By SevenThunders in forum C++ Programming
    Replies: 20
    Last Post: 02-05-2009, 09:45 PM
  2. convert Recursion to linear can it be done
    By umen242 in forum C++ Programming
    Replies: 2
    Last Post: 10-15-2008, 02:58 AM
  3. a simple recursion question
    By tetra in forum C++ Programming
    Replies: 6
    Last Post: 10-27-2002, 10:56 AM
  4. stack and recursion help needed!
    By LouB in forum C++ Programming
    Replies: 3
    Last Post: 07-01-2002, 02:19 PM
  5. selection sorting using going-down and going-up recursion
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 11-02-2001, 02:29 PM