WP34s: Complex AGM (Bug...)



#30

Something is wrong with cAGM (complex arithmetic-geometric mean).

Finding the AGM of 1 and i, whose exact value is about 0.599+0.599i both crashes the Windows emulator and resets (?!) the physical calculator:

0 ENTER
1 ENTER
1 ENTER
0
cAGM
"Reset" on calculator screen! (However, a random answer is returned; can be different each time!)

Sorry ;-(

Eduardo

(Edited to remove spurious "ENTER" after last 0 above.)


Edited: 23 Apr 2012, 10:53 a.m. after one or more responses were posted


#31

You are evaluating AGM(1 + i, 0). It should have returned 0 + 0i, instead of crashing. Have you tried it without the last ENTER?

On my old V2 wp34s:

 keystrokes        display

0 ENTER 0.
1 ENTER 1.
1 ENTER 1.
0
CPX
cAGM ENTER 0.59907011737
x<>y 0.59907011737
+ 1.19814023474
1 ENTER 1.
2 sqrt 1.41421356237
AGM 1.19814023474
- 0. ok!


Edited: 22 Apr 2012, 11:15 p.m.

#32

This is a bug with recent v3 firmware -- result of the double precision support which I increased the number of digits carried by some of the complex functions & missed one.

Fix is committed now & will be in the next build.


- Pauli


#33

The "Reset" message most probably stems from the watch dog logic kicking in. Since his can happen any time, the results differ on each try.

I'm going to create a new build in due course.

#34

I knew about WP34s only thanks to this forum and actually I've no words to tell you and the team how I personal appreciate your efforts and you studies to make it real and your availability for any requested upgrade. When I met this board actually I thought that calculators were matter for nostalgic only and "old" people who love overpassed things, but all you do and others do (Monte for the Cl project I mean) is the best evidence that calculators are not "dead"....... at all. Thank-you for that one time more.

#35

This, along with complex square root, complex ABS and everything that depended on these were broken on the 10th of February. That's 73 days ago.

It seems like our complex number support really isn't being used :-( Makes me wonder why I bothered.

- Pauli

Edited: 23 Apr 2012, 3:55 a.m.


#36

Quote:
It seems like our complex number support really isn't being used :-( Makes me wonder why I bothered.

Well, do you really expect that we can check hundreds of built-in functions whenever you release a new version (with new bugs)?

A new implemented function or feature could be expected to introduce new bugs for THAT new function, but of course it should never break any old (already working) code.

Franz


#37

What I'm saying is quite different. Nobody has taken the square root of a complex number (either directly or indirectly) since early February.

This isn't a new function, it has been there since the beginning. It isn't even obscure. It is a function which I expected would be used extremely frequently. Yet it isn't apparently.


- Pauli


#38

I don't know how this new bug (since February) influenced the complex square root (crash or just a wrong result?), but if it just returned wrong results then not everybody would have noticed it.

If I use a calculator I usually trust its results and don't manually check every calculated function - unless the result seems to be obviously wrong or impossible.

Franz


#39

A crash was the most likely outcome.

- Pauli


#40

Quote:
A crash was the most likely outcome.

Ok, I've just tried my polynomial root solver PRS (which uses lots of complex calculations) with yesterdays release (where this bug hasn't been fixed yet), but I don't get any crash - I get results that look quite ok, but of course I can't check manually if they are indeed correct.

Also a manual cpx SQRT or cpx ABS didn't return any 'obvious' problem ...

Franz

#41

Hi.

I'm almost sure you may have not noticed, but this is my very first post about the WP34S.

I do not have an WP34S yet, but it seems to me that we have finally seen the actual backstage of a calculator development. I wonder the HP35 development team and ahead.

It seems to me, as a matter of pure speculation, that at some point the development of computing devices reaches a 'available technology' versus 'demanded resources' balance that never happens more than once. I see this balance being reached when calculators arose, then became programmable, then expandable, then pocket-size, then graphical and then symbolical. After the HP28 I do not recall seeing another major resource that demanded - or explored - a different technology. Neither in computers I recall seeing major enhancements, only faster and memory-filled machines running better algorithms.

What I feel is that technology has not been challenged by new demanded resources for about two decades. And great minds, like those involved with the WP34S, are actually being tasked in a kind of a different way: finding ways to make current, complex, 'full of possibilities' hardware to run algorithms that offer resources available more than two decades ago combined with some now-a-days flavor.

Congratulations, Pauli and the other guys at the WP34S development team. It's outstanding what you have been doing.

What a task!

Am I seeing beyond? Or just in the need of a shrink? Doc Meyers, any professional opinion?

Cheers.

Luiz (Brazil)

Edited: 23 Apr 2012, 5:28 a.m.


#42

Quote:
I do not have an WP34S yet

Then you should at least get the emulator. :-)

As you already said: it's really outstanding!

Franz

#43

Quote:
I do not have an WP34S yet, but it seems to me that we have finally seen the actual backstage of a calculator development. I wonder the HP35 development team and ahead.

Fix the first right away ;-)

I am quite sure that our development process isn't typical for a calculator. We're willing to extend features and functionality as we go. I very much doubt any other calculator development team has had such freedom.

We've also got very hit and miss testing. It depends on the users involved and their priorities. A production calculator would have far more directed and exhaustive testing.


- Pauli

#44

Hi Pauli,

I think it is your assumption here that is wrong, it is not the complex funtions that aren't used often, but perhaps not updating our firmware as often.

Anyway, that's the way it is with me, I have not reflashed for some time (still using build 2282 from January). I like wait until several enhancements & bug fixes are implemented and seem stable before updating.

Thanks for the continued work.
-B

#45

Quote:
It seems like our complex number support really isn't being used :-( Makes me wonder why I bothered.



May I offer a guess? 100% of the nerds using the WP-34s (me included) want 100% of all possible functions implemented. But 99% of WP-34s`s users only use +,-,/ and * in 99% of the time. ;-)


#46

Quote:
May I offer a guess? 100% of the nerds using the WP-34s (me included) want 100% of all possible functions implemented. But 99% of WP-34s`s users only use +,-,/ and * in 99% of the time. ;-)

Be careful with your words, else Pauli will remove again all those hundreds of 'unused' functions. ;-)

Franz


#47

Walter is the one arguing against many of the functions I've wanted to include :-) We'd have a truly bizarre suite if I got my way...


- Pauli


#48

Quote:
Walter is the one arguing against many of the functions I've wanted to include :-) We'd have a truly bizarre suite if I got my way...

Well, for me it's ok to have lots of functions available, as long as I know at least their name. But I would say your 'Gudermannian' is indeed a bit too much - although I'm a mathematician I've never heard about it in my whole life.

I'd suggest to include my 'Huber' function instead ... ;-)

Franz


#49

Wrong area of mathematics I suspect :-)

Are you talking about the statistical Huber function (quadratic around zero and linear once you move far enough away)? Or is there another Huber function?


- Pauli


#50

Quote:
Are you talking about the statistical Huber function (quadratic around zero and linear once you move far enough away)? Or is there another Huber function?

Well, I mean my own 'Franz Huber'-function.

But I have still to invent it. ;-)

#51

LOL!

Like you, I've yet to discover the "Richens function" though according to my wife I regularly demonstrate the "Richens paradox"...


#52

There are already enough "Cube" functions so I'm not in a hurry to invent my own. ;-)


#53

Quote:
There are already enough "Cube" functions so I'm not in a hurry to invent my own. ;-)

Ok, we already have a CubeRoot, but wouldn't be a CubeMarc much nicer? :-)
#54

Quote:
Walter is the one arguing against many of the functions I've wanted to include :-) We'd have a truly bizarre suite if I got my way...

We are at some 280 new functions and counting, with 'new' denoting functions implemented in the WP 34S for the first time ever in an RPN calculator. I'm quite sure that - if we'd start a poll and force people to explicitly write down each and every of these new functions they really need (NO copy & paste!) - many of the 280 would not get even a single vote. No wonder: some (like Gudermann) were only included for internal testing, some (like a few distributions) for sake of completeness, some programming commands were needed for (internal) XROM routines but were voted to be unveiled to the public, etc. If I had to decide alone, I'd move quite a few functions from X.FCN and P.FCN to the 'internal catalog' for advanced users - but as long as memory allows and no standard functions suffer: Let (three) hundred flowers blossom! d:-)

Edited: 24 Apr 2012, 3:38 a.m.

#55

Quote:

It seems like our complex number support really isn't being used :-( Makes me wonder why I bothered.


I was doing something that require complex numbers - I don't remember exactly what I did but it did involve * and 1/x. I just tried sqrt of a bunch of complex numbers and no crash - 2758 build Apr 2nd - also 2733 works. Results agree with google.

Is it just for certain values?

cAGM crashes but I don't care coz I don't even know what it does :-)


#56

Complex square root will walk over the stack almost always. More specifically, cmplxR walks the square root stack when called from comple square root. This might depend on being in double precision mode -- which the xrom code almost always is.

Both * and 1/x are fine, they got updated correctly.

Two other functions that will experience problems are arcsinh & arccosh in complex mode. Well, not now but before.


- Pauli

#57

Pauli,

I just "made" myself a WP34s yesterday. The reason I hadn't explored it before was simply that I had no physical calculator. I jumped right into complex functions: that is why I found the bug.

Complex number support not used?! That couldn't be further from the truth! (For me, at least, and I suspect for many others.)

Perhaps the (complex) AGM function itself is little known and not crucial (a short RPN program will evaluate it quite efficiently assuming only sum, product and square roots of complex numbers can be calculated). I just thought it was cool that a piece of mathematics going back to Gauss had finally made it to a pocket calculator some 200 years later.

Complex number algorithms are very important! (I'd say essential in any serious scientific calculator.) Day-to-day, I'm far more likely to use complex trig and hyperbolic functions than AGM. I'd be essentially happy to have *only* trig or *only* hyperbolics, so long as they worked on the complex domain. What the heck, just give me exponentials on the complex domain!

(Alright, I'm not being totally serious about the last bit, since computing trig functions via complex exponentials leads to loss of significant digits for arguments close to multiples of pi/2...)

Eduardo

#58

This is why every new calculator developed internally in HP the past few years was designed from the beginning to support scripting and automatic testing execution. This includes the 12/15c, 20/30b, 10bII+, and the 39gII. It has proven very helpful even though it is very annoying to waste the space in something like the 20/30b where more space would have been nice. :-(

Now granted, this only works as long as you have quality tests and scripts, but it does allow quick regression testing and over time has become rather thorough. It takes about 2.5 mins to run through a million+ test cases in the windows emulators, and about a day or so to do on the hardware itself.

TW


#59

Quote:

Now granted, this only works as long as you have quality tests and scripts, ...


...and takes considerable time to develop. In some areas where I work automated test case development is as high as 20%

#60

Tim, automatic testing is very helpful to find errors in algorithms and such but may be misleading at times. A good example is the famous PSE bug in the 15C LE. What can an automatic test do here? I guess it measures execution timing but does not check which segments are actually lit. If all automatic testing succeeds it may lull the developers in a wrong sense of safety.


#61

It depends on how the testing works. The hp49 automated tester that Jean-Yves developed used comparisons of screen dumps to look for changes.

More usefully, there's nothing to stop people here writing their own W34S regression tester using the Windows emulator because you can use a Windows script to send keystrokes to the emulator.

The best tests could then be incorporated into a central one distributed with the release.


#62

Yeah. That perl test system was slower than slow. I think it took around 28 days to test the full set of 50g scripts, and you'd have to babysit it constantly.

The system used now still does screen comparisons as an option, but the vast majority are just a textual result comparison.

TW

#63

Marcus and I have discussed something similar for the 34S in the past. Writing the tests will be the killer -- so much functionality and so little spare time.


- Pauli


Possibly Related Threads…
Thread Author Replies Views Last Post
  HP Prime: complex numbers in CAS. Alberto Candel 1 1,941 12-06-2013, 02:36 PM
Last Post: parisse
  [HP Prime] Plots containing complex numbers bug? Chris Pem10 7 3,707 12-05-2013, 07:40 AM
Last Post: cyrille de Brébisson
  Complex Number Entry on Prime Jeff O. 19 5,311 11-16-2013, 12:34 PM
Last Post: Jeff O.
  HP Prime complex results Javier Goizueta 0 1,008 10-06-2013, 12:59 PM
Last Post: Javier Goizueta
  HP Prime Solving Nonlinear System of Equations for Complex Results Helge Gabert 11 4,352 09-30-2013, 03:44 AM
Last Post: From Hong Kong
  wp34s binomial bug Andrew Nikitin 4 1,856 09-22-2013, 05:20 PM
Last Post: Paul Dale
  [HP-Prime xcas] operations with complex numbers + BUGs + Request CompSystems 9 3,562 09-08-2013, 10:40 PM
Last Post: CompSystems
  Expon bug in wp34s Andrew Nikitin 7 2,305 07-14-2013, 03:23 AM
Last Post: Marcus von Cube, Germany
  Elliptic integrals of 1st and 2nd kind calculated by complex agm Gjermund Skailand 3 1,525 06-29-2013, 03:39 PM
Last Post: Gjermund Skailand
  HP-11C and complex numbers Antlab 5 2,250 06-28-2013, 08:59 AM
Last Post: Antlab

Forum Jump: