Post Reply 
(15C) (DM 15L) Analyzing a function f(x)
06-05-2020, 11:34 PM (This post was last modified: 06-05-2020 11:35 PM by Valentin Albillo.)
Post: #2
RE: (15C) (DM 15L) Analyzing a function f(x)
.
Hi, rawi:

First of all, welcome to the MoHPC fora. I'm sure you'll enjoy your stay here. Smile

(06-05-2020 05:04 PM)rawi Wrote:  This program helps in analyzing a function f(x) in a given area of x.

Thanks for posting your efforts, that's the spirit. Some comments:

Quote:The program approximates the derivate by adding and subtracting the small value d stored in Register I to x and evaluation the function. The derivative is estimated by (f(x+d)-f(x-d)/(2d).
The second derivative is approximated in a similar way by using additionally f(x).
Making the small value too big or too small delivers poor approximations. In this example 0.01 delivers good results with four significant digits after decimal point.

First, making the increment equal to 0.01, a constant, for all x arguments isn't the best idea, it must really depend on the value of x, i.e.: if you're computing the derivative at x=5 then the increment might be 5*0.01 = 0.05 so you compute the derivative using f(5+0.05) and f(5-0.05). If the argument is x=100, you'd compute f(100+1) and f(100-1), and so on. For x=0, simply use 0.01.

Second, the HP-15C is a 10-digit machine so you'll get greater accuracy using a constant smaller than 0.01. For the first derivative, use 0.00001 instead, and for the second derivative use 0.001. The first is 10^Int(-10[digits]/2) while the second is 10^Int(-10[digits]/3).

Third, for the HP-15C specifically there are better ways to compute first derivatives, faster and giving up to 10 correct digits. See how it's done by having a look at this PDF document:

Technique for computing first order derivatives using complex operations

Best regards and have a nice weekend.
V.

  
All My Articles & other Materials here:  Valentin Albillo's HP Collection
 
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: (15C) (DM 15L) Analyzing a function f(x) - Valentin Albillo - 06-05-2020 11:34 PM



User(s) browsing this thread: 3 Guest(s)