The following warnings occurred:
Warning [2] Undefined array key 109263 - 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 109342 - 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 109346 - 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 109393 - 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 109402 - 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 109409 - 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 109504 - 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 109519 - 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 109519 - 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 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/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 array key 109402 - 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 332 ThreadedMode::buildtree
/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





HP 33S interactive site



#9

Look at this site under product tour, it takes you through each button function. Good graphics.
http://h20331.www2.hp.com/hpsub/cache/301034-0-0-225-121.html


#10

I think all of the present HP calcs have similar sites. Very helpful indeed!

I like the wide collection of pdf downloads available, even if some of them do duplicate what is already in the manual.

FWIW, I actually have a 33S routine for the normal and inverse normal distribution that is faster and more accurate since it works with the upper tail and doesn't depend on having to do an integration. I can share the listing if anyone wishes.

I have also just acquired a 17bii+, and I must confess I rather like it, though I have yet to bash heads with any of its bugs. The solver, cashflow, and TVM applications are very neat to use.

Les


#11

Hi Les --

Would *definitely* be interested in your routines for the 33s. It's a great calc. Glad you're liking the 17bii+ -- Don and I have been having a blast with it -- admittedly sometimes frustrating -- and learning its nuances.

thanks!
bruce


#12

Sure--basically, I have ported Baillard's HP41 routine for the error function, and added on another routine to compute the upper-tail normal distribution using it via the formula Q(x) = 0.5 erfc(x/sqrt(2)). Given this, you can set up a routine for the solver that finds x for a given upper-tail probability.

Let me work out some of the inefficiencies and get the code to you in the next few days. I have made a preliminary submission to Dave but have asked him not to post it until I revise it. In the 33S memory saving isn't as important as efficient use of labels, and I am trying to find ways of reducing label usage even if it means repeating similar steps at various points in the program.

Les


#13

Here are those listings.

Please note that the original routines for the HP41 are due to J-M Baillard and come from here, though I have necessarily had to retool things to work with the limitations of the 33S.

Routine E computes erf and erfc for any real input using the alternating series expansion (http://mathworld.wolfram.com/Erf.html equation (6)) for x < 1.8 and the continued fraction expansion (a version of equation (33) on the same page, computed out to 35 terms) for larger values.

Routine Q computes the upper tail and cumulative normal distribution using routine E and the relationship 1- P(z) = Q(z) = 0.5 erfc(z/sqrt(2)), where Q(z) is the upper tail and P(z) is the cumulative probability associated with z from a standard normal distribution (mean 0, variance 1).

Routine I is basically a programmed equation to compute the inverse distribution using Solve.

Thanks to the speed of the 33S, E and Q are surprisingly fast, returning a result in no more than a couple of seconds or so.

Computing the inverse probabilities takes longer since it uses the solver and requires repeat evaluations of Q, but with decent initial guesses will return a result in under a minute, I find. Note in routine I I take the difference of logarithms. This is especially helpful when the probabilities get really tiny and it helps the Solver avoid converging prematurely since the difference between two tinies is a tiny and may signal convergence before it is desired. Taking logarithms lets the solver work with numbers of more normal magnitude.

E0001 LBL E
E0002 STO A
E0003 ABS
E0004 1.8
E0005 x<=y?
E0006 GTO C
E0007 CLx
E0008 STO i
E0009 Rv
E0010 STO R
E0011 STO S
E0012 x^2
E0013 STO X
E0014 LASTx
L0001 LBL L
L0002 STO T
L0003 ISG i
L0004 SGN
L0005 2
L0006 RCL* i
L0007 1
L0008 +
L0009 1/x
L0010 ENTER
L0011 +
L0012 1
L0013 -
L0014 RCL/ i
L0015 RCL* X
L0016 STO* R
L0017 RCL R
L0018 STO+ S
L0019 RCL T
L0020 RCL S
L0021 x#y?
L0022 GTO L
L0023 ENTER
L0024 +
L0025 PI
L0026 SQRT
L0027 /
L0028 ENTER
L0029 +/-
L0030 1
L0031 +
L0032 x<>y
L0033 RCL A
L0034 x<0?
L0035 GTO N
L0036 Rv
L0037 RTN
C0001 LBL C
C0002 CLx
C0003 35
C0004 STO i
C0005 Rv
C0006 STO X
C0007 CLx
M0001 LBL M
M0002 RCL+ X
M0003 1/x
M0004 0.5
M0005 RCL* i
M0006 *
M0007 DSE i
M0008 GTO M
M0009 RCL+ X
M0010 1/x
M0011 RCL X
M0012 x^2
M0013 +/-
M0014 e^x
M0015 *
M0016 PI
M0017 SQRT
M0018 /
M0019 ENTER
M0020 +/-
M0021 1
M0022 +
M0023 RCL A
M0024 x<0?
M0025 GTO N
M0026 Rv
M0027 RTN
N0001 LBL N
N0002 Rv
N0003 ENTER
N0004 ENTER
N0005 1
N0006 +
N0007 x<>y
N0008 +/-
N0009 RTN

Q0001 LBL Q
Q0002 2
Q0003 SQRT
Q0004 /
Q0005 XEQ E
Q0006 Rv
Q0007 2
Q0008 /
Q0009 ENTER
Q0010 +/-
Q0011 1
Q0012 +
Q0013 x<>y
Q0014 RTN

I0001 LBL I
I0002 INPUT Q
I0003 INPUT Z
I0004 RCL Z
I0005 XEQ Q
I0006 LOG
I0007 RCL Q
I0008 LOG
I0009 -
I0010 RTN

Given any real x for input, XEQ E will return erf(x) in the X register and erfc(x) in the Y register.

Given any real z for input, XEQ Q will return the upper tail normal probability associated with z in register X, and the complement lower tail cumulative probability in Y.

For example 2 XEQ E returns erf(2) = 9.99532223502e-1 in register X and erfc(2) = 4.677734981e-3 in register Y.

Similarly 2 XEQ Q returns Q(2) = 2.2750131948e-2 in register X (the upper tail probability associated with z = 2), and P(2) = 1 - Q(2) = 9.7724986805e-1 in register Y.

To compute the inverse normal distribution, use the routine I with the Solver.

For example, to compute the z associated with an upper tail probability of 0.0001:
1. Set FN = I.
2. Place guesses for Z on the stack--I just use 3 ENTER 3 here.
3. Execute SOLVE Z.
4 At the prompt Q?, enter 1e-4 R/S.
This takes a few seconds but will return Z = 3.71901648545. Checking it with XEQ Q returns 0.0001 in register X, 0.9999 in register Y.

Hope you get some use out of this.

Les


#14

Hi Les --

Looks great! Thank you. I'm out of town at the moment and didn't bring my 33s with me, but I'll take a gander at this next week. I appreciate the work.

thanks!
bruce


#15

I have also produced a routine for the 42S that computes the cumulative normal and upper tail probabilities directly using formula 26.2.11 and 26.2.14 in Abramowitz and Stegun. I have discovered that with the 33S code above the scaling of the input by 1/sqrt(2) introduces rounding error that gets propagated throughout the calculations and leads to digit loss, so usually you can trust at most 10 digits and occasionally 11. Computing the cumulative normal distribution directly by its own series and continued fraction expansions tends to produce better results than routing the computation through erf and erfc. Of course, in Free42 with its 25 digits of precision, all of this is moot since there are so many guard digits internally that the 12 digits that get displayed, and then some (usually up to 20 or 21) are usually right.

Of course, if you are interested in doing a lot better than, say, the SigmaNORMD routine in the HP41 Stat Pac, which uses an antiquated rational approximation that is prone to subtraction digit loss in the upper tail, then this routine will give great results as it is.

I haven't ported the "normal distribution directly" routine to the 33S yet. It shouldn't be too hard, since there is nothing I did in the 42S routine that doesn't have a direct equivalent on the 33S. If you have any interest in this I will get to it when I can. The problem is I am running out of labels in my 33S!

Looking at the relevant formulae in Abramowitz and Stegun, which can be found free online, is very informative. I think my point in all this is that I think it is more sensible and quicker to compute thes e things directly than by the numerical integration scheme in the 33S manual that takes at least a few seconds each time to give modest accuracy. Thanks to JM Baillard, I have also learned that it is feasible to write simple code that computes continued fractions from right to left that is fairly quick, and it takes just a little experimenting to discern how many iterations you should take for maximum accuracy.

Les

#16

Edited: 2 Mar 2007, 2:09 a.m.


Possibly Related Threads…
Thread Author Replies Views Last Post
  OT: a math competition site Pier Aiello 0 1,026 09-16-2013, 06:03 AM
Last Post: Pier Aiello
  WP-34S on German Auction Site Joerg Woerner 3 1,776 09-08-2013, 04:36 PM
Last Post: Maximilian Hohmann
  Jacques Laporte's Fantastic Site BShoring 3 1,635 06-15-2013, 08:36 AM
Last Post: aj04062
  10C, 11C, 12C logos on The Auction Site Peter Murphy (Livermore) 0 950 06-14-2013, 11:24 PM
Last Post: Peter Murphy (Livermore)
  HP 39gii Programming Tutorial Part 6: Interactive Programs Eddie W. Shore 0 873 04-01-2013, 06:00 PM
Last Post: Eddie W. Shore
  O.T. Aston Martin mentions Golden Ratio on their web-site. Pavneet Arora 1 1,033 01-24-2013, 06:12 PM
Last Post: Mark Scheuern
  New HP 39gII programs on my web site Namir 10 3,159 12-23-2012, 06:04 PM
Last Post: Eddie W. Shore
  HP 15C LE now on UK HP web site - SRP £120 Antonio Petri (UK) 1 1,053 02-11-2012, 01:02 PM
Last Post: Maximilian Hohmann
  HP 15C LE on HP Web Site is OoS Namir 4 1,395 09-19-2011, 10:51 AM
Last Post: x_25
  HP Home shopping site has 15c in stock now sav 21 4,710 09-19-2011, 08:02 AM
Last Post: Quan

Forum Jump: