HP Forums

Full Version: integration on 39gII emulator
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

I was playing around with the 39gII emulator from the hp.com and I'm getting some strange results. Could someone confirm and see if I'm doing something wrong.

integral(SIN(X),X,0,pi) = 2 (correct)
integral(SIN(X),X,0,2*pi) = -1.93772545304 (???)
Should be 0.

integral(5*e^(-X)-1,X,0,4) = .90842180557
integral(ABS(5*e^(-X)-1),X,0,4) = -1.81684361113 (???)
Should be 3.872702369417088. Certainly can't be negative.

Is this an emulator issue, a calculator issue, or a "me" issue?

-wes

REPLACE THIS TEXT WITH YOUR LISTING

HP39GII Rev 17218 :

Same errors, both with calculator and emulator ...
Rom bug !

HP50G exact mode returns :


Edited: 31 May 2013, 5:11 p.m.

Just for the heck of it, I tried it on the 15c:

The integration routine on the 15c works correctly for the first case when integrating from 0 to pi. However, when integrating from 0 to 2*pi it also gives a wacky result. The wackiness of the result changes based on the display mode.

Both cases of the second equation integrate correctly on the 15c.

Tried it on my nSpire CX CAS, which I disappointingly find better than the 39gII, and it got all the right answers.

Gave 1-5*e^-4 which is 0.908422 as the exact answer for the third one. Only approximated the fourth one, but correctly.

Edited: 31 May 2013, 8:20 p.m.

Quote:
However, when integrating from 0 to 2*pi it also gives a wacky result. The wackiness of the result changes based on the display mode.

What are the wacky results that you got? Because my result with FIX 9 was reasonable:

0 ENTER
6.283185307
A

-2.559151-10

WolframAlpha gives the following result:

7.77156x10-16

Cheers

Thomas

Well, I no idea what I was doing because I just tried it again and as you point out, it works correctly.

Sorry for the waste of time.

When I do the integration from 0 to 2pi on my 50g, I get -3.6737E-12. How did you set it up to get the right answer? I do have exact mode set.

Has to do with an internal problem when converting the result back from the CAS with a negative exponent (which gets dropped during the conversion...)

The internal result there is actually -1.93772545304E-12.


TW

Edited: 31 May 2013, 11:41 p.m.

"When I do the integration from 0 to 2pi on my 50g, I get -3.6737E-12. How did you set it up to get the right answer? I do have exact mode set."

Try :

- RightShift ENTER to get |R= (and not |R~) in the header

- Flag 03 must be off : Function -> Symb (and not Function -> num)

The flag 03 is very important for the CAS. Must be OFF

Does it works like this ?

For the fourth, to get a simplify exact answer :

- EQW (or RPN to enter equation) EVAL (return the result) EVAL (simplify it) FDIST (full distribution : in convert - Rewrite)

- to get the approx in a speed way :

EQW (or RPN to enter equation) EVAL ->NUM

Edited: 1 June 2013, 11:32 a.m.

CXCAS : "Gave 1-5*e^-4 which is 0.908422 as the exact answer for the third one. Only approximated the fourth one, but correctly. "

CAS are really strange things ... It's curious that the TI don't give the exact result for the fourth one. How time did it take for the fourth one ? With the 50G it's almost instantaneous in exact mode but very very slow in numeric (depending of the precision, but quite unusable with maximum precision unless you like really very much coffee). The best way is to solve in exact mode and then ->NUM (and in general with the 50 it's a good idea to try first in exact mode folowed by a ->NUM and try numeric integration if the CAS is unable to solve it)


Edited: 1 June 2013, 3:03 a.m.

Quote:
Has to do with an internal problem when converting the result back from the CAS with a negative exponent (which gets dropped during the conversion...)

The internal result there is actually -1.93772545304E-12.


Ah. That would explain the unusual graph of

  F1(X)=integral(SIN(T),T,0,X)
6.2 < X < 6.4
0 < Y < 15

But it doesn't explain the problem with the second integral.

Let F(X)=5*e^(-x) - 1
F(A)=0, A = 1.60943791243

integral(ABS(F(X)),X,1,4)=1.71209957, but 39gII reports 2.50436197717, which coincidentally is equal to 2*ABS(integral(F(X),X,1,4)). Using integral(ABS(F(X)),X,1,A)+integral(ABS(F(X)),X,A,4) gives the correct answer.

It seems that the ABS( ) is confusing the CAS.

-wes

Quote:
integral(ABS(F(X)),X,1,4)=1.71209957, but 39gII reports 2.50436197717, which coincidentally is equal to 2*ABS(integral(F(X),X,1,4)).

Or more more simply, it's equal to -2*integral(F(X),X,1,4) which is consistent with the example in the original posting.

-wes

Quote:
HP39GII Rev 17218 :

Same errors, both with calculator and emulator ...
Rom bug !


At least the first bug (SIN from 0 to 2*pi) is solved with the ROM ver. 2012-11-23 Rev.19017, which was published some time ago but then redrawn again because of 'stability' problems (?).

But the second bug (with ABS) still exists.

Such heavy bugs definitely disqualify the 39gII for a serious use - I would have never imagined that this could happen with any calculator of HP, the most famous and important company for calculators at all! :-(

And the conclusion from this desaster: HP should dramatically extend their group of beta-testers from only a few to really _lots_ of users (else they will probably have the same problems with their new HP-Prime again).

Franz


Edited: 1 June 2013, 5:36 a.m.

Quote:
integral(ABS(5*e^(-X)-1),X,0,4) = -1.81684361113 (???)
Should be 3.872702369417088. Certainly can't be negative.

Not quite:

integral(ABS(5*e^(-X)-1),X,0,4) = 7 + 5*e^-4 - 2*ln(5) = 3.87270236957547...

Still, definitely not negative!

Quote:
which gets dropped during the conversion...

That's not how math works.

Works great now! Thanks for the help. Flag 3 was set num.

Same for number 4. Before, the hourglass (waiting icon) displayed for 10 mins and I finally broke out of it. Now, it gets the same answer you have in about 10 seconds.

Not quiet...

3.8727023695754701522670714399138309320083576292303425300227038542478941825752550841765797344581510370478471898395502858417120205498191900519127250788722525382494597451230795958547287109551998041571567264937396248062950246831176921524871640916353926755170115649237277089608539043182253570236337049657898721083798378694462207055410217484505024734777075012865817142248605836459928431100549021516325655184586267287193468770718203323589781282973681058417713090939794486615187117186783269424713094759477005841084653503287141257402302277294221712509348532434588129182111452181379341815635219457774126084364515000564146785778542546347773308636138289754929493755998924406311358377587834710803536810742141121189112358605056997523787610307685019602819903503356438046217577041848232630398273005691909328122933895692944409082916770053199356202164524054703411823208290097445538829522188344529568783625574149206827186992596695442958844451239698229765510432113286897304284149165256088259135531069362525070036539173601665223058562456774646194740283187211171445022001503714715457460816370743622720926586009847873191031919698074832548653008568726976926308865112852280134227691024999690259793756002947353140449047629748566640755516121129889706294475030811295876814786672174092797643063863817021853431281853275171066797813455662958619624772655724960356930482207409648416479802224422352363749791882458079218442078595055993388449361874419911434552451413980574437012721011592598441242161109369064551081218259441714529576249906994200669766931924399313797231587138167261455266248323941243078606233099407768168339387966414321679973349448761226417671870505464961043254147651344241297809333429790790996972616962688215873339675568576572628528545297538519150906837737517180737125460709429727541343900395985929215348752306807106792849348874343454457353767892990448836432052702248749717954002554598829474036924589707381033506703303646256822611608783467163558648355657027660186934514683322493109436273458852786876087271920112464111954811292885735903659069431554602372025437388600222518565692210542488249241590992630175885622219474637109578380553321435237893668947015667982383384421600550407798390838374989542949374426329842883507343230878421677862476421646813247443128935255212827802112449821229329978577990532378628123591766397299960074916713576183357417609988753023915253017599652337767871949499494650974642873594743572047619316895005234244202891758808527463449836368250215439390541681247880102567403965092188499654506089191982926465721312702053334615332349170366875790391282345257686996782026690588814948585706460689776447879805051809749339844722959820454383387913317510532205082334426473909731271212007839670614524289936988317172095658942499790210761372742057299729969180840433449815424612090834789123079035281152755239711240768347720276174156103633172752112277710876147882220020154547233772805609413894427038792157420934982762683494053247788703596319242908481893251650543487898140515073171727480807028288661570519354996603007890474772153137476990247544866561322288801247095053674456002239148157600920061594551737433038024660556579491595390208377433296445676179245334234518105061667042964574858029901273295260782517469630707386650539017052042158409452185929448688791232600280761125838499391707107265360949407762945402927221750328630413888020239844806213220353897587197092614163581427312761828005731308758971168139541739547696867725811585633355662182507875599964156569682801566711448669648401004879036269638368317230246175485074960309158493943565629503558079145450276098254622099584697543370794287917162007488891888301041290964172504398739855924390910481248696453953725238316707836080410800508920031388647035262284274062806811977180147438260775345617703250850883958093951941048304765056789752270489749904145674283601955420577037614006873310383546937929190394993873835549664047160518174611508226523629191424060228256644361317150322892... APPROXIMATELY.


Sorry, just couldn't resist

TI was not quick to respond to a couple of problems that I found on the NSpire CAS about 3 years ago...integrating (3/(2-cos x))^2 from 0 to pie produced 6*(sqrt 3)*pie instead of 2*(sqrt 3)*pie. The NSpire correctly produced 2*(sqrt 3)*pie integrated from -pie to 0. They tried it out, and verified that I had discovered a bug...took them 3 update cycles after staying on their case until they fixed it.

Another glitch that they refuse to correct involves the random number seed. If the NSpire goes into sleep mode and goes thru the rebooting upon powering it up, it will reset the seed to factory default meaning that the user will repeat the same string of random numbers upon each rebooting. It should be desirable to have the unit remember last seed so that it resumes without repeating the same string of random numbers. Hopefully, HP will be responsive to the inevitable bugs.

TI calcs have always had the random seed bug. I used this to my advantage a few times with some gambling software I wrote at university that relied on people's ignorance towards pseudo random number generation. I feel guilty now :)

Quote:
TI calcs have always had the random seed bug.

I'm curious what bug this is? I've never noticed anything unusual in the random seeding on a TI. I demonstrate the use of seeding in Stats class when trying to explain the difference between random and pseudo-random.

Speaking of TI bugs though, you should have heard the fury after the AP Calculus exam last month. There was one question that required students to use a calculator to solve |f(x)|=c. Students that used f(x)=+/-c did fine, but those that used |f(x)|=c directly on the TI-89 and Nspire-CAS had their calculators hang. (See question 2a of the test) Those pesky absolute values sure can be a pain in the CAS. ;-)

I found it interesting that teachers on the AP forum were mostly upset at the College Board for using that function, not at TI for having the bug.

-wes

Agree with the distinction, but most classes don't go into how random something is.

The "art" of doing this on a program to force a known result is doing an n->rand first to set the seed.

The bug is the random seed should be an external value (say battery voltage reading). The seed shouldn't be user settable i.e. should be read from an interrupt/counter or something, otherwise the value is dishonest.

There is absolutely no purpose for a known seed if you ask me.

Doesn't surprise me with the nSpire - mine crashes all over the place. I had a '92 - never crashed that!

Edited: 3 June 2013, 6:05 p.m.

I don't have my nSpire with me right now, but as a I recall it was essentially instantaneous. I guess the ABS function caused it to revert to numeric.

Just checked, it was instantaneous.


Edited: 3 June 2013, 7:55 p.m.

What you call a bug can be found in the HP-15C as well:

Quote:
At initial power-up (including reset of Continuous Memory), the HP-15C random number generator will use zero as a "seed" to initiate a random number sequence.

[STO][f][RAN#] will store the X-register number (0<=r<1) as a new seed for the random number generator.

-- HP-15C Owner's Handbook


And since we all know that the HP-15C is bug-free that feature can't be a bug.

Quote:
There is absolutely no purpose for a known seed if you ask me.

Reproducibility of a simulation or a test might be something. And sometimes it makes debugging easier. There's a reason why this is called a pseudo-random generator.

Kind regards

Thomas

Quote:
otherwise the value is dishonest.

Yes, but we know it's lying to us. :-)

Quote:
I had a '92 - never crashed that!

Try taking the limit as x -> infinity of x*(sqrt(4x^2+1)-2x). On my 92 (ver 1.4), it sometimes comes up with a Memory Error, but sometimes it has a complete crash/memory lost. I've never able to find a pattern of when it would fail gracefully and when it would reset. In either case, it doesn't find the answer. (Disclaimer: the 92 was a gift.)

-wes

The HP-39gII seems to be full of bugs - see here:

http://www.omnimaga.org/index.php?topic=16426.msg295727

Just look at the MAKELIST result on the 39gII ... :-(

Franz

Edited: 4 June 2013, 2:51 p.m.

No excuse for that one.

At least it can add better than an iPhone (for a while 225/15 apparently equals 1)

Urban legend on the iphone bug. Its actually an example of what lack of tactile (or other) feedback does for you.

Person enters 225 / 15 on the iphone calculator, followed by the "=".

The calculator shows no change, and the user thinks that it didn't take the keypress and hits "=" again. Now the calculator shows one and the user thinks that there is a bug....

In reality, the first "=" did actually do the division but because the output is the same as the last input and there is no other visual or tactile feedback, the user is mistaken in thinking that their keypress was not processed.

Does the same thing on any square divided by one of its roots.

The current calculator does actually have button press (visual) feedback, but it is somewhat disconcerting to see no display change. Shows how subtle UI design can be.

Interesting! That'll teach me not to do research :)

The case for real buttons and RPN/RPL (with visual feedback) is now made though!