# HP Forums

Full Version: CAS vs Plot
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

Hi all!

I am _not_ the mathematician so I need some help for following function I found in the CAS examples.

```      SIN(X)^2
------------
COS(X)TAN(X)
---------------------- = 1
_ +------------------
|/ SIN(X)COS(X)TAN(X)```
On the emulated HP40 with CAS version 4 (4/27/2000) I get this result too (after TAN2SC and EXPAND). But if I plot this function it shows a square wave between 1 and -1.
Question: CAS does not respect the sign?

Ciao.....Mike

Mike,

It depends on where the square should be on the top term.

Is it (sin(x))^2 (i.e. the entire sin function that is squared) or sin (x^2) (i.e. the argument of the sin function that is squared)?

If it is the first, then this set of trig functions does not even have to be evaluated! It reduces exactly to 1.

Why? Well, you can express tan(x) as sin(x)/cos(x). If you do this, then everything cancels out. In the denominator square root, for instance, you'd get (leaving off the (x) arguments for ease of notation)

sqrt( sin cos (sin/cos) ) = sqrt (sin^2 ) = sin

Similarly, the top of your equation reduces first to

sin^2/sin = sin

Leaving for the final step, sin/sin = 1

Thank you Dave for your investigation, but I am not convinced: in the denominator you may reduce to sqrt(sin^2) what is never negative due to square. Further reduction would be abs(sin). But as numerator you get after reduction sin^2/sin what keeps the sign of sin (even if you keep your fingers crossed <G>).

So the overall reduction would be sin/abs(sin) what is 1 or -1 every now and again. So the plot on the HP-40G revealed a nasty surprise (as ugly as sin or remissible peccadillo?) in it's own CAS. Bombs on Babylon! Mathematical gomorrah!! The 40G was made to use at school.

Ciao.....Mike (sinning, pondering, scapegoat)
No-no abs(sin) has nothing to do with absinth and I did not drink too much of it...

Edited: 16 Nov 2004, 11:05 a.m.

Mike says: "Thank you Dave for your investigation, but I am not convinced: in the denominator you may reduce to sqrt(sin^2) what is never negative due to square."

NO! because

sqrt(anything^2) = +/-anything

So, in the end, Mike's original expression reduces to *either* +1 or -1, depending on your choice of root. The "abs" function has no relevence here.

(I am assuming that when Mike writes "SIN(X)^2" he means exactly that---namely "(SIN(X))^2" which mathematicians prefer to write as "SIN^2(X)".)

--Mark

Yep - you are correct! Now when I read

`sqrt(anything^2) = +/-anything`
I remember. How could I forget.

So the correct answer would be sign(sin(x)) or abs(sin(x))/sin(x)?

Ciao.....Mike