Results 1 to 3 of 3

Thread: HELP I need to make a VB code (Euler derivative)

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2006
    Posts
    1

    HELP I need to make a VB code (Euler derivative)

    Hi all

    I need to find the derivate from a specific function....
    How do u do it?

    I need also the Runge kutta method to reach de derivate of a function as well
    Any ideas?

    Huicho

  2. #2
    vbuggy krtxmrtz's Avatar
    Join Date
    May 2002
    Location
    In a probability cloud
    Posts
    5,573

    Re: HELP I need to make a VB code (Euler derivative)

    Quote Originally Posted by huicho3000
    Hi all

    I need to find the derivate from a specific function....
    How do u do it?

    I need also the Runge kutta method to reach de derivate of a function as well
    Any ideas?

    Huicho
    Derivative of f(x):

    df(x) / dx = lim (h -> 0) [f(x + h) - f(x)] / h

    so now you must calculate this limit for your specific function... or else learn the basic derivatives and derivation rules and apply them.

    As far as I know the Runge-Kutta method is a numeric method for solving differential equations.
    Lottery is a tax on people who are bad at maths
    If only mosquitoes sucked fat instead of blood...
    To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)

  3. #3
    Lively Member oswaler's Avatar
    Join Date
    Jul 2006
    Location
    U.S. of A.
    Posts
    87

    Re: HELP I need to make a VB code (Euler derivative)

    Yes, Runge-Kutta is used for solving differential equations. Here's some code for finding the derivative:


    Sub calcderiv()

    Dim origx As Double
    Dim h As Double
    Dim df As Double
    Dim f As Double
    Dim x As Double
    Dim fprime As Double

    'set x
    x = 500

    'Define h as a very small value
    h = 1 / 2109999999

    'Hold original value of x to be used later
    origx = x

    'set x value to x plus a very small amount
    x = x + h

    'calculate the function with the slightly increased value of x
    df = 200 + 0.05 * x + 0.0001 * x ^ 2

    'set x back to original value
    x = origx

    'calculate the function with the original value of x
    f = 200 + 0.05 * x + 0.0001 * x ^ 2

    'find the numeric derivative
    fprime = (df - f) / h
    MsgBox fprime

    End Sub
    Last edited by oswaler; Sep 30th, 2006 at 03:29 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width