The following warnings occurred:
Warning [2] Undefined array key 146308 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 146313 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $thread - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $fid - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 146313 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $theme - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $theme - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $lang - Line: 5 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 5 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Attempt to read property "messages_in_thread" on null - Line: 5 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 5 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks





Gamma and Factorial for 10C/12C/12CP (thread hijack)



#2

Quote:
Out of context (i.e. calculator nerd bashing), I found it quiet funny. Especially because I got a calculator for Christmas and then proceeded to write a Gamma function for it. Details here: http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv018.cgi?read=145337#145337.

Egan, in original 12C post you use the following to approximate the factorial:

x! = x^x*sqrt(2PIx)*e^(1/[12x + 2/(5x + 5/4x)] - x) 

Very elegant, with simple constants, and seems to work pretty well--indeed for calculator use with limited steps it is hard to get much better, especially if you use the shift-divide correction for the smaller arguments.

But I notice that it is a slight variation of a Stieltjes continued fraction. (stieltjes3 at Peter Luschny's site is the analagous formula.) The only difference is that in the version I know and which I can find on on Viktor Toth's site, the innermost term is actually 53/(42x).

I am curious whether you made the choice to approximate 53/42 by 5/4 yourself, or did you see another version of the formula on an earlier version of Viktor's site? I have to admit that deciding on the slight modification of that term is very wise, especially on the 10C and 12C where every digit is a keystroke.

I am kind of preoccupied myself with computing gamma on calculators that don't have it for noninteger values, so I am curious on the provenance of the formula you chose. (Right now I am experimenting with a variation of the Windschitl formula, but I think it takes more steps without any huge improvement in accuracy. With a 10 or 12 digit calculator, rounding error becomes significant quickly and mitigates the benefit of adding too many correction terms!)

Les


#3

Quote:
I am curious whether you made the choice to approximate 53/42 by 5/4 yourself, or did you see another version of the formula on an earlier version of Viktor's site?

IIRC, it was another version.
Quote:
I am kind of preoccupied myself with computing gamma on calculators that don't have it for noninteger values, so I am curious on the provenance of the formula you chose. (Right now I am experimenting with a variation of the Windschitl formula, but I think it takes more steps without any huge improvement in accuracy. With a 10 or 12 digit calculator, rounding error becomes significant quickly and mitigates the benefit of adding too many correction terms!)

I look forward to your discoveries.

Possibly Related Threads…
Thread Author Replies Views Last Post
  HP-10C Series Family Photo Max Stone 5 2,134 10-24-2013, 10:31 PM
Last Post: Eddie W. Shore
  Factorial misbehavior Han 10 2,969 10-09-2013, 02:36 AM
Last Post: Ed Hodapp
  HP15c continued fraction for Ln(Gamma) Tom Grydeland 0 1,082 09-30-2013, 05:48 AM
Last Post: Tom Grydeland
  HP Prime emulator: Gamma function Stephan Matthys 28 7,685 08-21-2013, 04:52 PM
Last Post: Namir
  What is the Gamma approximation you use? Namir 21 5,122 08-05-2013, 07:14 AM
Last Post: Namir
  10C, 11C, 12C logos on The Auction Site Peter Murphy (Livermore) 0 949 06-14-2013, 11:24 PM
Last Post: Peter Murphy (Livermore)
  [wp34s] Say thank you thread RalfGeiger 11 2,677 04-08-2013, 10:42 PM
Last Post: Eduardo Dueñez
  SandMath routine of the week: Inverse Gamma Function Ángel Martin 39 9,120 03-24-2013, 08:19 AM
Last Post: peacecalc
  HP41C: Factorial (kind of) in MCODE Frido Bohn 7 2,381 05-26-2012, 09:18 AM
Last Post: Frido Bohn
  [wp34s] Incomplete Gamma on the wp34s Les Wright 18 4,969 12-06-2011, 11:07 AM
Last Post: Namir

Forum Jump: