Post Reply 
HP 15C and INT(1/√(1-x),0,1)
01-09-2018, 06:59 PM
Post: #21
RE: HP 15C and INT(1/√(1-x),0,1)
(01-09-2018 06:58 PM)salvomic Wrote:  original HP15 had problems already with 1E-5, HP 15C LE returned the result with 1E-5 in 25 minutes but returned error with 1E-6...

OK, but at which program line did this error occur and for which x-value (take a look at the other stack registers)?

Dieter
Find all posts by this user
Quote this message in a reply
01-10-2018, 01:33 PM
Post: #22
RE: HP 15C and INT(1/√(1-x),0,1)
Tested on a wp34s (with the last version of the integration routine):
  • SCI2: 1.999279690943348 (2 s)
  • SCI4: 1.999609653263110 (3 s)
  • SCI6: 1.999968878589093 (3 s)
  • SCI8:1.999998824537611 (3 s)
  • SCI10: 1.999999985077354 (3 s)
  • ALL0: 1.999999985077354 (4 s)
  • DBLON: 1.999999999999999976156369124294215 (16 s)

Regards.
Find all posts by this user
Quote this message in a reply
01-10-2018, 01:43 PM
Post: #23
RE: HP 15C and INT(1/√(1-x),0,1)
(01-09-2018 06:59 PM)Dieter Wrote:  OK, but at which program line did this error occur and for which x-value (take a look at the other stack registers)?
Dieter

Definitely I must take again the experiment, timing and then control the line. I'll do it asap.

(01-10-2018 01:33 PM)emece67 Wrote:  Tested on a wp34s (with the last version of the integration routine):
    ...
  • SCI10: 1.999999985077354 (3 s)
  • ALL0: 1.999999985077354 (4 s)
  • DBLON: 1.999999999999999976156369124294215 (16 s)

Regards.

so, are you saying I should also buy a WP34? Smile
Yes, I should do it (I need some other many to spend in collection...)

Salvo

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
01-10-2018, 01:54 PM
Post: #24
RE: HP 15C and INT(1/√(1-x),0,1)
(01-09-2018 06:19 PM)Dieter Wrote:  
(01-09-2018 04:53 PM)Didier Lachieze Wrote:  Are you using the decimal or the binary version of Free32?

Free42 Decimal version 1.5.5.

I recommend getting the latest version; there was a bug in the INTEG termination condition before 2.0.5 that would make it return inaccurate results in some cases.

Even the latest code doesn't do very well on 1/sqrt(1-x), though.
Visit this user's website Find all posts by this user
Quote this message in a reply
01-10-2018, 03:20 PM
Post: #25
RE: HP 15C and INT(1/√(1-x),0,1)
(01-09-2018 06:59 PM)Dieter Wrote:  OK, but at which program line did this error occur and for which x-value (take a look at the other stack registers)?

Dieter

In "Limited edition" with accuracy 1E-6 the error 0 occurs after 47 minutes. The program ends in line "006 15", that's 1/x and the x is equal to 1, so the problem is the division by 0: 1/0.
That doesn't occur with 1E-5 (in 23 minutes) and 1E-4 (in 2'30'') nor 1E-3 or 1E-2, in witch the result is immediate or about immediate.

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
01-10-2018, 08:57 PM
Post: #26
RE: HP 15C and INT(1/√(1-x),0,1)
(01-10-2018 01:33 PM)emece67 Wrote:  Tested on a wp34s (with the last version of the integration routine):
  • SCI2: 1.999279690943348 (2 s)
  • SCI4: 1.999609653263110 (3 s)
  • SCI6: 1.999968878589093 (3 s)
  • SCI8:1.999998824537611 (3 s)
  • SCI10: 1.999999985077354 (3 s)
  • ALL0: 1.999999985077354 (4 s)
  • DBLON: 1.999999999999999976156369124294215 (16 s)

Actually this integral isn't quite as difficul as it seems when using purely numeric (not CAS) methods, it's just a matter of using some numerical quadrature method suited to the task at hand.

Just for instance my very own implementation of one such method for the barebones HP-71B does return 2.000000000000 (i.e.: exactly 2 to twelve digits) in just 4 seconds when run in J-F Garnier's Emu71 (about 15 min. in a real machine) using an accuracy as low as 1e-4.

Also, the fact that CAS can give the exact value almost instantly is completely irrelevant, most integrals cannot be managed by CAS and even slight changes to this one woul be intractable

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
01-10-2018, 09:43 PM
Post: #27
RE: HP 15C and INT(1/√(1-x),0,1)
(01-10-2018 08:57 PM)Valentin Albillo Wrote:  Also, the fact that CAS can give the exact value almost instantly is completely irrelevant, most integrals cannot be managed by CAS (...)

Why do you think this is completely irrelevant? If I want to solve an integral the first step is trying to solve it symbolically and get an exact result. Either "by hand" or with a CAS. If this is not possible – and you don't know unless you tried – a numeric approach (for a definite integral) is the second option that gives at least a more or less exact approximation.

Dieter
Find all posts by this user
Quote this message in a reply
01-10-2018, 10:29 PM (This post was last modified: 01-10-2018 10:30 PM by salvomic.)
Post: #28
RE: HP 15C and INT(1/√(1-x),0,1)
(01-10-2018 09:43 PM)Dieter Wrote:  If I want to solve an integral the first step is trying to solve it symbolically and get an exact result. Either "by hand" or with a CAS. If this is not possible – and you don't know unless you tried – a numeric approach (for a definite integral) is the second option that gives at least a more or less exact approximation.

I agree.
Actually I wanted to test numerical integral in some calculators that hasn't symbolic integration, but if I need to know the value of an integral for working purpose I search for it in a CAS machine (49, 50g, Prime...) if possible... Said that, if one doesn't remember by hearth the antiderivative (to do it by hand) and has got in that moment only a calculator like HP15 or HP41 or HP42s and so on, better trying numerical integration than nothing...
Anyway, this particular integral was for me a way to test the behaviour and potentiality of some beloved calculators of ours.

Salvo

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
01-11-2018, 04:48 PM
Post: #29
RE: HP 15C and INT(1/√(1-x),0,1)
A test with HP-41CX and Advantage (Advanced Solutions Pac).

FX1: function
Code:

01 LBL"FX1"
02 CHS
03 1
04 +
05 SQRT
06 1/X
07 RTN
08 END

Then:
0 ENTER 1, ALPHA_FX1_ALPHA, XEQ ALPHA_INTEG_ALPHA
0 in Y, 1 in X, FX1 in Alpha register, then execute INTEG (function in the module).

Accuracy and times:
1E-2 (FIX2) 1min 1.99
1E-3 (FIX3) 13 min 1.999
1E-4 (FIX4) 1h41m 1.9999
(I don't want to try 1E-5 just now ...;-) )

Salvo

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
01-11-2018, 06:53 PM
Post: #30
RE: HP 15C and INT(1/√(1-x),0,1)
(01-11-2018 06:35 PM)Mike (Stgt) Wrote:  Then try something else. You remember hint ii) in here: http://www.hpmuseum.org/forum/thread-957...l#pid88198 ?
Do you have the MoHP CD? ...

Well, thanks a lot, Mike, I've not MoHP stuff here, but a copy is on the way to get here and it should arrive tomorrow or Monday...
Please, in the meantime, if you have spare time send me via PM the V41 working link ;-)
I'll try asap your hint.

ciao
Salvo

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
01-11-2018, 07:57 PM
Post: #31
RE: HP 15C and INT(1/√(1-x),0,1)
(01-11-2018 07:12 PM)Mike (Stgt) Wrote:  
(01-11-2018 06:53 PM)salvomic Wrote:  V41 working link ;-)

Working link? Try URL hotel-papa-four-one-dot-oscar-romeo-golf

QSL! Smile

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
01-11-2018, 09:42 PM (This post was last modified: 01-11-2018 09:43 PM by Dieter.)
Post: #32
RE: HP 15C and INT(1/√(1-x),0,1)
(01-11-2018 06:35 PM)Mike (Stgt) Wrote:  Do you have the MoHP CD? Did you find the PPC ROM Users's Manual there? Did you read what's written about routine IG - Integrate?
...
SIZE 030
"XF1" ASTO 10
FIX 2
0 ENTER 1
XEQ IG

Result: 2.00

Any questions? (Timing you may test on your own machine.)

I neither own a physical Advantage ROM nor the PPC ROM, but I have V41 here, which is set to a speed that very closely matches that of a real '41.

- With FIX 2 set, the Advantage Pac's INTEG routine returns 1,99 after 1:34 minutes.
- The PPC ROM's IG routine (which shows successive approcimations) arrives at this point after about 3 minutes.
- The PPC ROM stops after two successive approximations with the same result, rounded to display precision. This requires 9:20 minutes with a final result of 2,00.

BTW both ROMs have different integration algorithms. The PPC ROM's IG program is a classic Romberg method while the Advantage ROM's INTEG routine seems to implement the same (or at least a similar) method as the 34C or 15C. While no details have been officially published it was said that this is "a Romberg method" with a modified way of sampling the function values.

Dieter
Find all posts by this user
Quote this message in a reply
01-11-2018, 10:25 PM
Post: #33
RE: HP 15C and INT(1/√(1-x),0,1)
(01-11-2018 09:42 PM)Dieter Wrote:  ...
BTW both ROMs have different integration algorithms. The PPC ROM's IG program is a classic Romberg method while the Advantage ROM's INTEG routine seems to implement the same (or at least a similar) method as the 34C or 15C. While no details have been officially published it was said that this is "a Romberg method" with a modified way of sampling the function values.

Dieter

See here.
Advanced Pac should use Romberg method as HP 15C, and timing are comparable, actually (I mean with classic 15, not LE).
I've both Math and Advantage. The manual of Advantage warns that some functions (complex...) are the same in the module and that would be better not to use both together, however some functions in Math aren't in Advantage (Fourier, hyperbolic...), some other are in Advantage and not in Math (Vectors, TVM...), so I'm trying to use both together or, if possible, one at a time...
However, the integration is more easy in Advantage and not in Math, IMHO.
I haven't V41, but i41CX in iPhone, so I wonder if there is IG for it, but I think that it is not so easy to set the speed "close to real 41CX" in iPhone or iPad. More, I noted (and I told it to its author) that when it is active, i41CX in my iPhone 6 drains soon the battery...

Salvo

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
01-12-2018, 01:45 AM
Post: #34
RE: HP 15C and INT(1/√(1-x),0,1)
(01-11-2018 09:42 PM)Dieter Wrote:  The PPC ROM's IG program is a classic Romberg method while the Advantage ROM's INTEG routine seems to implement the same (or at least a similar) method as the 34C or 15C. While no details have been officially published it was said that this is "a Romberg method" with a modified way of sampling the function values.

In the front of the Advantage ROM manual (p. 2), it states:

Quote:The root-finding and numerical-integration routines in this pac were
adapted from those in the HP-15C by Firmware Specialists, Inc., 605 NW
5th Street #2A, Corvallis, Oregon 97330.

Probably as close to official as these things get.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
01-12-2018, 04:18 AM
Post: #35
RE: HP 15C and INT(1/√(1-x),0,1)
(11-27-2017 01:33 AM)Carsen Wrote:  I set the HP-15C to a fix of 2 and integrated the integral from 0 to 1. In a time of 2 minutes and 42 seconds, I got the answer of 1.99.
Then I set the 15C to a fix of 4 and attempted to integrate the integral again. In a time of 16 minutes and 28 seconds, I stopped the 15C and didn't get an answer as a result.

I tried the DM15 (SwissMicros) with FIX2 and received the 1.99 answer within 30 seconds -- clearly faster. Then thought I'd try to split the difference between your tests with FIX3. The machine shut down before it could give an answer, 5 minutes later...

On the TI-36X Pro, within 1 minute it spat out a "DIVIDE BY 0" error....
Find all posts by this user
Quote this message in a reply
01-12-2018, 10:37 AM (This post was last modified: 01-12-2018 10:43 AM by Dieter.)
Post: #36
RE: HP 15C and INT(1/√(1-x),0,1)
(01-11-2018 10:25 PM)salvomic Wrote:  See [url=http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum
Advanced Pac should use Romberg method as HP 15C,

Romberg is not the same as Romberg. ;-) The implementations are different. The IG code is a (slightly modified) "classic" Romberg approach. The HP Integrate code however seems to be a bit more sophisticated as it uses a different sampling method to avoid problems with periodic functions. This was explained in the respective HP Journal Kahan article, cf. August 1980 issue, p. 26: "What method underlies the ∫xy key?":

Quote:The HP-34C uses a Romberg method; for details consult reference 2. Several refinements were found necessary. In stead of uniformly spaced nodes, which can induce a kind of resonance or aliasing that produces misleading results when the integrand is periodic, the ∫xy key's nodes are spaced nonuniformly. (...)

The article continues with further details.

(01-11-2018 10:25 PM)salvomic Wrote:  and timing are comparable, actually (I mean with classic 15, not LE).

The 41C is much faster than the 15C so I'd expect significantly shorter execution times.

(01-11-2018 10:25 PM)salvomic Wrote:  I've both Math and Advantage. The manual of Advantage warns that some functions (complex...) are the same in the module and that would be better not to use both together,

Why? Do they have the same function names so that a calling them can be ambiguous?

(01-11-2018 10:25 PM)salvomic Wrote:  however some functions in Math aren't in Advantage (Fourier, hyperbolic...), some other are in Advantage and not in Math (Vectors, TVM...),

And some are neither in the one nor the other. I would have expected a complete set of complex trig and hyperbolic functions along with their inverses in full precision 13-digit MCode routines.

(01-11-2018 10:25 PM)salvomic Wrote:  However, the integration is more easy in Advantage and not in Math, IMHO.

The Math and Math/Stat ROMs include an integration program (INTG) but, as usual, both the chosen algorithm and the implementation leave significant room for improvement: it's simply the standard Simpson method without any improvements (e.g. as in this example) and the program is not coded particularly well. So on the '41 the Advantage ROM's INTEG seems to be the best choice.

Dieter
Find all posts by this user
Quote this message in a reply
01-12-2018, 10:57 AM (This post was last modified: 01-12-2018 10:58 AM by Dieter.)
Post: #37
RE: HP 15C and INT(1/√(1-x),0,1)
(11-27-2017 01:33 AM)Carsen Wrote:  Then I set the 15C to a fix of 4 and attempted to integrate the integral again. In a time of 16 minutes and 28 seconds, I stopped the 15C and didn't get an answer as a result.

In fact you can get the current approximation of the integral during a running calculation. This is described in appendix E of the 15C manual ("Owner's Handbook", p. 257 of the English version): "Obtaining the Current Approximation to an Integral".

Dieter
Find all posts by this user
Quote this message in a reply
01-12-2018, 11:12 AM
Post: #38
RE: HP 15C and INT(1/√(1-x),0,1)
(01-12-2018 10:37 AM)Dieter Wrote:  Why? Do they have the same function names so that a calling them can be ambiguous?
Yes, e.g. for complex operations and few other functions. I can try putting Advantage on port 3 and Math in 4 (in Catalog 2 they are listed in that order), to give Advantage the priority (it has some machine coded programs and some RPN routines...), however, if I'm not wrong, for complex it uses the same RPN routines that Math. I need Math only for hyperbolic and Fourier, mostly.

(01-12-2018 10:37 AM)Dieter Wrote:  The Math and Math/Stat ROMs include an integration program (INTG) but, as usual, both the chosen algorithm and the implementation leave significant room for improvement: ...
So on the '41 the Advantage ROM's INTEG seems to be the best choice.

Right, indeed.

Salvo

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
01-12-2018, 06:11 PM
Post: #39
RE: HP 15C and INT(1/√(1-x),0,1)
(01-12-2018 04:18 AM)JimP Wrote:  I tried the DM15 (SwissMicros) with FIX2 and received the 1.99 answer within 30 seconds -- clearly faster. Then thought I'd try to split the difference between your tests with FIX3. The machine shut down before it could give an answer, 5 minutes later...

For the record, here are the results for the HP35s Integration routine. Here the function has been entered as an equation.

FIX 2 returns 1,98 ±0,02 in about 7 seconds.
FIX 3 returns 1,999 ±0,002 in about 1:35 minutes.

So the HP35s seems to have an improved algorithm. OK, it is much faster than the original 15C, but I especially like the good error estimates.

Dieter
Find all posts by this user
Quote this message in a reply
01-12-2018, 07:35 PM
Post: #40
RE: HP 15C and INT(1/√(1-x),0,1)
(01-12-2018 07:10 PM)Mike (Stgt) Wrote:  
(01-12-2018 10:37 AM)Dieter Wrote:  The 41C is much faster than the 15C so I'd expect significantly shorter execution times.

Really? Almost same CPU, functionally identical, but running much faster if boxed in an HP41? That's new to me.

Take a look at Carsen's result:

(11-27-2017 01:33 AM)Carsen Wrote:  I set the HP-15C to a fix of 2 and integrated the integral from 0 to 1. In a time of 2 minutes and 42 seconds, I got the answer of 1.99.

As noted, the 41C Advantage ROM's INTEG does it in 1:34 minutes. As opposed to 2:42 on the 15C.

Also take a look at the 8-queens benchmark:

HP-15C: 1:19'10"
HP-41C: 0:17'35"

So I think it is obvious that the 15C is significantly slower than the 41C. However, how much slower seems to depend on various factors.

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: