HP Forums
tan(pi/2)=-195948537906 (?) - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: tan(pi/2)=-195948537906 (?) (/thread-15166.html)



tan(pi/2)=-195948537906 (?) - StephanP - 06-09-2020 09:25 AM

This is discovered by a colleague of mine.

From the Home screen
tan(pi/6) gives 0.577.. and pressing [a b/c] gives a nice sqrt(1/3)
tan(pi/2) is giving -195948537906
Surely, Prime could do better than that, e.g. "Error: x/0" or "Math error"?

Version: 2020 01 21


RE: tan(pi/2)=-195948537906 (?) - Werner - 06-09-2020 09:36 AM

Well, that IS the correct answer for tan(1.5707963268)...
I don't know the Prime, but I gather the same difference applies as in the 49G and up: the difference between numeric pi and symbolic 'PI'. The former is a 12-digit approximation, the latter the real thing.
Werner


RE: tan(pi/2)=-195948537906 (?) - Jan 11 - 06-09-2020 10:04 AM

CAS gives correct results. See.



[attachment=8564]


RE: tan(pi/2)=-195948537906 (?) - StephanP - 06-09-2020 11:22 AM

TI-84 CE-T (v5.4.0.0034)
returns an error
tan(pi/2) = Error

I'd prefer an error over the misleading answer that is the result of underlying approximations.
My guess is that TI and other calculators recognize the special condition and bypass the approximate calculation and issue a predefined result.

(I'm not into CAS as of yet)


RE: tan(pi/2)=-195948537906 (?) - Werner - 06-09-2020 01:25 PM

I'm afraid it's the TI's answer that is misleading...
try tan(5*pi/2) or so.

Werner


RE: tan(pi/2)=-195948537906 (?) - pinkman - 06-09-2020 01:51 PM

HP15C -> -4878048780
HP35s -> -195948537906
HP49g+: -195948537906 (or infinite symbol if CAS / Approx is unchecked)
Free42 (iOS): -1,79243... E33
WP34s (iOS): 1,6149... E15

It's a resolutely numerical approach.

Quote:I'm not into CAS as of yet
You should not dissociate the CAS from the rest of the Prime, especially if you're looking for symbolic computation such as TAN(PI/2) -> infinite.


RE: tan(pi/2)=-195948537906 (?) - pinkman - 06-09-2020 02:06 PM

As TAN(PI/2) is undefined, Home and CAS give the right result when using the limit expression.
[attachment=8565]
[attachment=8566]


RE: tan(pi/2)=-195948537906 (?) - KeithB - 06-09-2020 03:13 PM

(06-09-2020 11:22 AM)StephanP Wrote:  I'd prefer an error over the misleading answer that is the result of underlying approximations.
My guess is that TI and other calculators recognize the special condition and bypass the approximate calculation and issue a predefined result.

(I'm not into CAS as of yet)

What if you want the tan of 1.5707963268? Now who has the misleading answer?


RE: tan(pi/2)=-195948537906 (?) - Joe Horn - 06-09-2020 04:30 PM

(06-09-2020 01:51 PM)pinkman Wrote:  HP15C -> -4878048780
HP35s -> -195948537906
HP49g+: -195948537906 (or infinite symbol if CAS / Approx is unchecked)
Free42 (iOS): -1,79243... E33
WP34s (iOS): 1,6149... E15

It's a resolutely numerical approach.

HP's philosophy is very different from other calculator manufacturers:

"Our users know what they're doing and know how to use the tool in their hand. The numbers that they input to any function are exactly what they intended to input, to the last digit. We do the same with the output. We show ALL the digits. We don't cheat by hiding several digits behind the euphemism of 'guard digits'. So if a user presses the PI key, we assume that the user knows that the result is not the infinite number of digits of pi, nor is it a result whose last few digits are a secret. The user is smart enough to know that pressing PI on an HP 12-digit-mantissa machine yields exactly 3.14159265359, no more and no less. If the user then divides by 2 and then presses the TAN key in radian mode, we assume that the user wants the tangent of exactly the number of radians in the display, and we return all the digits of the result rounded to 12 significant digits. On HP calculators, what you see is exactly what you have."

TI's philosophy is, "We assume that the user is an idiot who thinks that pressing the PI key actually returns exactly pi. Furthermore, if they then divide it by 2 and take the TAN in radian mode, we catch that particular case and we ASSUME that we know better than the user does, and we return what WE think that the user PROBABLY expects. We also display fewer digits than are calculated, hiding the roundoff errors behind 'guard digits' so that nobody is confused when they get nasty EXACT results like HP gives."

It's not a matter of who is right or which philosophy is better. It's a matter of knowing how your tools work and using them accordingly.


RE: tan(pi/2)=-195948537906 (?) - Jake Schwartz - 06-09-2020 05:39 PM

[quote='pinkman' pid='132979' dateline='1591710691']

Free42 (iOS): -1,79243... E33
WP34s (iOS): 1,6149... E15

[quote]

On my actual WP34S in double-precision mode, I get
1.792 431 373 312 990 354 164 577 572 292 315 E33

Jake


RE: tan(pi/2)=-195948537906 (?) - pinkman - 06-09-2020 06:35 PM

Yes I was in Double mode off. Same result when toggling Double on.


RE: tan(pi/2)=-195948537906 (?) - David Hayden - 06-09-2020 07:56 PM

(06-09-2020 09:25 AM)StephanP Wrote:  tan(pi/2) is giving -195948537906
It's also helpful to put this into perspective. Suppose you stood up a tower that leaned with this slope (195,948,537,906). How tall would the tower be if it was out-of-plumb by 1 foot at the base?

The answer is it would have to reach almost to Mars....


RE: tan(pi/2)=-195948537906 (?) - Dave Britten - 06-09-2020 09:28 PM

Interestingly, if you go back to the HP-45 and TI-30, it appears the HP fudges it, but the TI doesn't!

HP 45:
Pi/2 = 1.570796327
tan(Pi/2) = 9.999999999E99 (the overflow display on the HP-45)

TI 30:
Pi/2 = 1.5707963268
tan(Pi/2) = 1.8312E09
tan(1.570796327) = 2.9298E09 (using the HP version of Pi/2)


RE: tan(pi/2)=-195948537906 (?) - cyrille de brébisson - 06-10-2020 05:33 AM

Hello,

Thanks Joe, I could not have said it (because I need to stay diplomaticSmile

In some ways, this is why there is a CAS mode and a num mode on Prime.
num (home) is to do numerical calculations. calculations with number where a number is a number...
cas is to do symbolic calculations, where variables and math concepts are being worked on.
You want tan(PI/2) to be undefined? this is cas world, you want real number crunching, this is home mode...

I find it EXTREMLY frustrating when I am in the workshop, grab one of the kids (junior high school calc) calculator (they were forced to get some other brand!!!) try to find the hypothenuse of a triangle to cut a chunk of wood, and the thing returns some symbolic expression... I mean, my ruler does not have any marking at square root (50)! I want 7.07!
Prime, at the touch of a button will let you do the calculations in whatever domain you want. And I find it great.

Cyrille


RE: tan(pi/2)=-195948537906 (?) - DA74254 - 06-10-2020 07:40 PM

(06-10-2020 05:33 AM)cyrille de brĂ©bisson Wrote:  Hello,

Thanks Joe, I could not have said it (because I need to stay diplomaticSmile

In some ways, this is why there is a CAS mode and a num mode on Prime.
num (home) is to do numerical calculations. calculations with number where a number is a number...
cas is to do symbolic calculations, where variables and math concepts are being worked on.
You want tan(PI/2) to be undefined? this is cas world, you want real number crunching, this is home mode...

I find it EXTREMLY frustrating when I am in the workshop, grab one of the kids (junior high school calc) calculator (they were forced to get some other brand!!!) try to find the hypothenuse of a triangle to cut a chunk of wood, and the thing returns some symbolic expression... I mean, my ruler does not have any marking at square root (50)! I want 7.07!
Prime, at the touch of a button will let you do the calculations in whatever domain you want. And I find it great.

Cyrille

Don't your kids calcs have an approx mode? Wink