Post Reply 
tan(pi/2)=-195948537906 (?)
06-09-2020, 09:25 AM
Post: #1
tan(pi/2)=-195948537906 (?)
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


Attached File(s) Thumbnail(s)
   
Find all posts by this user
Quote this message in a reply
06-09-2020, 09:36 AM
Post: #2
RE: tan(pi/2)=-195948537906 (?)
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
Find all posts by this user
Quote this message in a reply
06-09-2020, 10:04 AM
Post: #3
RE: tan(pi/2)=-195948537906 (?)
CAS gives correct results. See.



   
Find all posts by this user
Quote this message in a reply
06-09-2020, 11:22 AM
Post: #4
RE: tan(pi/2)=-195948537906 (?)
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)
Find all posts by this user
Quote this message in a reply
06-09-2020, 01:25 PM
Post: #5
RE: tan(pi/2)=-195948537906 (?)
I'm afraid it's the TI's answer that is misleading...
try tan(5*pi/2) or so.

Werner
Find all posts by this user
Quote this message in a reply
06-09-2020, 01:51 PM
Post: #6
RE: tan(pi/2)=-195948537906 (?)
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.
Find all posts by this user
Quote this message in a reply
06-09-2020, 02:06 PM
Post: #7
RE: tan(pi/2)=-195948537906 (?)
As TAN(PI/2) is undefined, Home and CAS give the right result when using the limit expression.
   
   
Find all posts by this user
Quote this message in a reply
06-09-2020, 03:13 PM
Post: #8
RE: tan(pi/2)=-195948537906 (?)
(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?
Find all posts by this user
Quote this message in a reply
06-09-2020, 04:30 PM (This post was last modified: 06-09-2020 04:32 PM by Joe Horn.)
Post: #9
RE: tan(pi/2)=-195948537906 (?)
(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.

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
06-09-2020, 05:39 PM
Post: #10
RE: tan(pi/2)=-195948537906 (?)
[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
Find all posts by this user
Quote this message in a reply
06-09-2020, 06:35 PM
Post: #11
RE: tan(pi/2)=-195948537906 (?)
Yes I was in Double mode off. Same result when toggling Double on.
Find all posts by this user
Quote this message in a reply
06-09-2020, 07:56 PM
Post: #12
RE: tan(pi/2)=-195948537906 (?)
(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....
Find all posts by this user
Quote this message in a reply
06-09-2020, 09:28 PM
Post: #13
RE: tan(pi/2)=-195948537906 (?)
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)
Visit this user's website Find all posts by this user
Quote this message in a reply
06-10-2020, 05:33 AM
Post: #14
RE: tan(pi/2)=-195948537906 (?)
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

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
06-10-2020, 07:40 PM
Post: #15
RE: tan(pi/2)=-195948537906 (?)
(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

Esben
28s, 35s, 49G+, 50G, Prime G1 HW A, Prime G2 HW D, SwissMicros DM42
Elektronika MK-52 & MK-61
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)