Thread: how to call derivative ?

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

    how to call derivative ?

    Hello ,...

    in my last work i need to use Maclaurin serie to calculate stuff (in calculs hws).
    but to do that i need to some home find Derivative.

    how can i call a func to use derivatives?

    i read math.h and didn't find any mention for this (nor did apropos revealed some thing close to it).
    why Gaos didn't had a wife ?
    http://bsh83.blogspot.com

  2. #2
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Well, as far as I know you'd have to parse the equation and differentiate it via 2nd principles.
    math.h doesn't contain anything for parsing math equations, you'll need a parser for that.

    Write your own or use a 3rd party one?

  3. #3
    Fear the Reaper...
    Join Date
    Aug 2005
    Location
    Toronto, Ontario, Canada
    Posts
    625
    i read math.h and didn't find any mention for this (nor did apropos revealed some thing close to it).
    There isn't anything to do derivatives in there. You have to approximate it or use some 3rd party libraries.
    Teacher: "You connect with Internet Explorer, but what is your browser? You know, Yahoo, Webcrawler...?" It's great to see the educational system moving in the right direction

  4. #4
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    As Happy_Reaper said, you could consider Derivative Approximation (http://www.geometrictools.com/Docume...ifferences.pdf)

  5. #5
    Registered User
    Join Date
    Apr 2007
    Posts
    111
    and i thout that my life would be easy .. (i thouth that there is a way just to call some func to use dervetive):

    weal it time to code .. XD ..
    why Gaos didn't had a wife ?
    http://bsh83.blogspot.com

  6. #6
    Fear the Reaper...
    Join Date
    Aug 2005
    Location
    Toronto, Ontario, Canada
    Posts
    625
    and i thout that my life would be easy ..
    It isn't that difficult. First and second derivative approximations are just a formula that you can find here. I don't think that you need the higher-order ones (but that's depending on your precision threshold).
    Teacher: "You connect with Internet Explorer, but what is your browser? You know, Yahoo, Webcrawler...?" It's great to see the educational system moving in the right direction

  7. #7
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Why not just use the definition of derivative to approximate it?

    Code:
    double approx_deriv(double (*f)(double), x)
    {
        double h = 1e-12; /* Very small */
        return (f(x + h) - f(x)) / h;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. minix system call pls help for project
    By porvas in forum Linux Programming
    Replies: 2
    Last Post: 06-14-2009, 02:40 AM
  2. Error C2664 - Trying to call an external Dll
    By jamez05 in forum C++ Programming
    Replies: 3
    Last Post: 08-08-2006, 06:07 AM
  3. Class won't call
    By Aalmaron in forum C++ Programming
    Replies: 3
    Last Post: 04-13-2006, 04:57 PM
  4. Iterative Tree Traversal using a stack
    By BigDaddyDrew in forum C++ Programming
    Replies: 7
    Last Post: 03-10-2003, 05:44 PM
  5. call by reference and a call by value
    By IceCold in forum C Programming
    Replies: 4
    Last Post: 09-08-2001, 05:06 PM