The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
A Tiny (WP34S) program does a lot
11-28-2014, 03:16 PM (This post was last modified: 11-29-2014 11:33 AM by BarryMead.)
Post: #1
A Tiny (WP34S) program does a lot
While looking at a graph of the "Factorial" Gamma(X+1) function I noticed that between the points 0 and 1 where the value of the function is 1 (one), the function dips below one. I was curious how to find the minimum value between these two points. Using SLV with the f'(x) function made it quite easy. This tiny program illustrates how powerful a small WP-34S program can be. It took only 15 program steps on the WP-34S and over 40 on the HP-15C.
Code:

LBL A                //Entry point for the program
# 000                //Lower search limit 0
# 001                //Upper search limit 1
SLV 00               //Find the zero point of the derivative
RTN                  //Return if SLV succeeds
ERR 20               //If SLV fails show "No root Found"
LBL 00               //Function to find the first derivative
f'(x) 01
RTN
LBL 01               //Function to calculate the Factorial of value
x!
RTN
LBL'[DELTA]X'        //Function to set the Delta X of derivative
# 001
SDR 005              //Set Delta X to .00001
END

It takes a while to run on the real WP-34S (about 46 seconds), but is almost instantaneous on the emulator.
Obviously when a function reaches a "Minimum" value, its first derivative (slope) will be zero.
Since I don't know what the first derivative of the Factorial Gamma(X+1) looks like, I used the f'(x) function
to approximate it. Note: The Optional '[Delta]X' routine helps to improve the accuracy of the result.
And the answer is: 0.4616321449683623 where the factorial reaches it's minimum value of: 0.8856031944108887
Thanks to Paul Dale and Dieter for the excellent enhancements to the program.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
A Tiny (WP34S) program does a lot - BarryMead - 11-28-2014 03:16 PM



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