Derivatives on HP 35s, 15c, 32s, yadda - Hewlett Packard

This is a discussion on Derivatives on HP 35s, 15c, 32s, yadda - Hewlett Packard ; Something my little pea brain has never understood is why, going back to the early '80's, the HP 15c was able to preform numerical integration, but not numeric differention. Q1: Does anyone know why?? Q2: Is it within the capibilities ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Derivatives on HP 35s, 15c, 32s, yadda

  1. Derivatives on HP 35s, 15c, 32s, yadda

    Something my little pea brain has never understood is why, going back
    to the early '80's, the HP 15c was able to preform numerical
    integration, but not numeric differention.

    Q1: Does anyone know why??

    Q2: Is it within the capibilities of these calculators to find the
    numeric derivative of a function, given the proper paramteters?

    Q3: Has anyone written a program to perform that operation, and made
    it available? Where?

  2. Re: Derivatives on HP 35s, 15c, 32s, yadda

    Mike Dougherty wrote:

    > Something my little pea brain has never understood is why, going back
    > to the early '80's, the HP 15c was able to preform numerical
    > integration, but not numeric differention.
    >
    > Q1: Does anyone know why??


    Probably because it's so trivial that HP didn't bother to integrate it.
    Into the 15C, that is. 8-)

    > Q2: Is it within the capibilities of these calculators to find the
    > numeric derivative of a function, given the proper paramteters?
    >
    > Q3: Has anyone written a program to perform that operation, and made
    > it available? Where?


    It's so simple that probably noone would publish it as a proof of his
    programming skills:

    As you might know, f'(x) = lim (h->0) of (f(x)-f(x+h))/h

    For numerical differentiation this expression is used with a small
    (but not too small) h in order to approximate the limit, i.e. the
    first derivate of f.

    Somewhat better precision may be obtained by evaluating the term
    (f(x+h)-f(x-h))/2h instead.

    h can be provided by the user, or the program itself can set an
    appropriate value. A good starting point is h = x/10000 (for x<>0).
    The smaller h gets, the better the approximation. OTOH if h gets too
    small, the calculator might not be able to distinguish f(x+h) from
    f(x-h). Which is just *one* problem here. <8)

    Enter f(x) the same way you'd do for integration: use a label, enter the
    usual keystrokes to program your function, finish with RTN.

    LBL A
    ..
    .. ;enter f(x) here
    ..
    RTN


    Write a small program:

    LBL B
    STO 0 ;x
    ENTER
    x=0? ; if x=0...
    e^x ; ...determine h for x=1 to avoid h=0
    1E4
    / ; -> h
    STO 1
    - ;x-h
    XEQ A ;f(x-h)
    STO 2 ;store in R2
    RCL 0 ;x
    RCL 1
    + ;x+h
    XEQ A ;f(x+h)
    RCL 2
    - ;f(x+h)-f(x-h)
    RCL 1
    /
    2
    / ;(f(x+h)-f(x-h))/2h
    RTN


    I didn't try it (no 15C here) but it should work.


    So, finally you get:


    x XEQ A -> f(x)
    x XEQ B -> f'(x) (approx.)


    If you want to set h yourself, simply omit the steps from ENTER to STO 1
    after LBL B and replace them by a RCL 1 command. In this case it's up to
    you to provide a value for h and store it in STO 1.

    More information, additional multi-point formulae and some of the
    various problems with numerical differentiation can be found on


    Dieter


  3. Re: Derivatives on HP 35s, 15c, 32s, yadda

    Mike Dougherty wrote:

    > Something my little pea brain has never understood is why, going back
    > to the early '80's, the HP 15c was able to preform numerical
    > integration, but not numeric differention.
    >
    > Q1: Does anyone know why??


    Probably because it's so trivial that HP didn't bother to integrate it.
    Into the 15C, that is. 8-)

    > Q2: Is it within the capibilities of these calculators to find the
    > numeric derivative of a function, given the proper paramteters?
    >
    > Q3: Has anyone written a program to perform that operation, and made
    > it available? Where?


    It's so simple that probably noone would publish it as a proof of his
    programming skills:

    As you might know, f'(x) = lim (h->0) of (f(x+h)-f(x))/h

    For numerical differentiation this expression is used with a small
    (but not too small) h in order to approximate the limit, i.e. the
    first derivate of f.

    Somewhat better precision may be obtained by evaluating the term
    (f(x+h)-f(x-h))/2h instead.

    h can be provided by the user, or the program itself can set an
    appropriate value. A good starting point is h = x/10000 (for x<>0).
    The smaller h gets, the better the approximation. OTOH if h gets too
    small, the calculator might not be able to distinguish f(x+h) from
    f(x-h). Which is just *one* problem here. <8)

    Enter f(x) the same way you'd do for integration: use a label, enter the
    usual keystrokes to program your function, finish with RTN.

    LBL A
    ..
    .. ;enter f(x) here
    ..
    RTN


    Write a small program:

    LBL B
    STO 0 ;x
    ENTER
    x=0? ; if x=0...
    e^x ; ...determine h for x=1 to avoid h=0
    1E4
    / ; -> h
    STO 1
    - ;x-h
    XEQ A ;f(x-h)
    STO 2 ;store in R2
    RCL 0 ;x
    RCL 1
    + ;x+h
    XEQ A ;f(x+h)
    RCL 2
    - ;f(x+h)-f(x-h)
    RCL 1
    /
    2
    / ;(f(x+h)-f(x-h))/2h
    RTN


    I didn't try it (no 15C here) but it should work.


    So, finally you get:


    x XEQ A -> f(x)
    x XEQ B -> f'(x) (approx.)


    If you want to set h yourself, simply omit the steps from ENTER to STO 1
    after LBL B and replace them by a RCL 1 command. In this case it's up to
    you to provide a value for h and store it in STO 1.

    More information, additional multi-point formulae and some of the
    various problems with numerical differentiation can be found on


    Dieter


+ Reply to Thread