Post Reply 
TRIGEXPAND FUNCTION
12-14-2022, 09:10 PM
Post: #1
TRIGEXPAND FUNCTION
in the Manual and in the Prime "Help" feature, "trigexpand" is shown to expand sin(3*x) into (4*cos(x)^2-1)*sin(x). However on my G2 version 2021 12 02, and in the emulator, trigexpand" merely repeats the input function, sin(3*x). I've tried changing various items in the CAS settings to no avail. What am I doing wrong??
Find all posts by this user
Quote this message in a reply
12-14-2022, 10:32 PM
Post: #2
RE: TRIGEXPAND FUNCTION
Check your settings. With Exact=Off, trigexpand does not work (it does not know 3. is exactly 3)

Cas> trigexpand(sin(3*x))      → SIN(3.*x)
Find all posts by this user
Quote this message in a reply
12-14-2022, 10:42 PM
Post: #3
RE: TRIGEXPAND FUNCTION
Thank you for your reply but my problem is that the calculator or the emulator does not expand the trig function as shown in the "help" feature but merely repeats the input. Checking or unchecking the "EXACT" box in CAS settings does not fix that problem.
Find all posts by this user
Quote this message in a reply
12-15-2022, 09:40 PM
Post: #4
RE: TRIGEXPAND FUNCTION
   
Bug Report? It appears that the "TRIGEXPAND" function has a bug. All of the TRIGXXX functions return the proper output but TRIGEXPAND just repeats the input function. In this case whether EXACT is checked or not (or any other CAS Setting items) makes no difference.
Find all posts by this user
Quote this message in a reply
12-16-2022, 02:54 AM
Post: #5
RE: TRIGEXPAND FUNCTION
Oddly, it works if you enter trigexpand(SIN(3*x)).
Find all posts by this user
Quote this message in a reply
12-16-2022, 04:29 AM
Post: #6
RE: TRIGEXPAND FUNCTION
(12-14-2022 09:10 PM)G. Cook Wrote:  in the Manual and in the Prime "Help" feature, "trigexpand" is shown to expand sin(3*x) into (4*cos(x)^2-1)*sin(x). However on my G2 version 2021 12 02, and in the emulator, trigexpand" merely repeats the input function, sin(3*x). I've tried changing various items in the CAS settings to no avail. What am I doing wrong??

It works on mine. Here are the settings I use

[Image: trig.png?raw=1]

[Image: cas.png?raw=1]

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
12-16-2022, 03:49 PM
Post: #7
RE: TRIGEXPAND FUNCTION
To be clear, it does not work with sin (3*x), but works with SIN (3*x)
Find all posts by this user
Quote this message in a reply
12-16-2022, 06:01 PM
Post: #8
RE: TRIGEXPAND FUNCTION
(12-16-2022 03:49 PM)lrdheat Wrote:  To be clear, it does not work with sin (3*x), but works with SIN (3*x)

OIC. Do you type in the letters s-i-n? I have to do that in order to get it in lowercase. There is no "sin" function on my calc, only SIN. I can't get the lowercase version even in the catalog.
Why they're different, I don't know. This is another example of why I don't like a totally separate CAS from exact mode. Things like this only serve to confuse people.

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
12-16-2022, 06:25 PM
Post: #9
RE: TRIGEXPAND FUNCTION
Yes…I have to type in the upper case letters. Why this is necessary is unknown to me…do not know if this is a bug, or intended behavior. Unexpected to me…
Find all posts by this user
Quote this message in a reply
12-16-2022, 08:59 PM
Post: #10
RE: TRIGEXPAND FUNCTION
Generally speaking, uppercase Fn names are HOME mode functions and lowercase Fn names are CAS functions. Part of the reason for the difference is so that one may call functions from one mode, while in the other mode.

I've not a clue on earth if that is relevant for this particular problem, but it's an annoying side-effect of the 2 distinct mode, and could be causing some of these issues.

Seems to me it would have been a WHOLE let better if the Prime simply tagged the functions when calling from the 'other' mode, such as:

HOME mode: X := CAS.SIN(X)
CAS mode: x:= home.sin(x)
etc.
which would have been unambiguous.

But no doubt there were good reasons this could not be done.

Tim?
Cyrille?

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
12-16-2022, 10:19 PM
Post: #11
RE: TRIGEXPAND FUNCTION
To make things even more confusing, the SIN that we are seeing is actually CAS sin

On the older HP emulator version, Build 2.1.14181 (2018 10 16):

Even if you type "trigexpand(SIN(3*x))", internally, it uses CAS sin.
However, INPUT and OUTPUT displayed both sin/cos as SIN/COS (a display bug, I think)
If you copy/paste the expression for later use, you will see CAS sin/cos is actually used.

It make sense. There is no reason CAS side will use HOME side SIN for symbolic processing.



Slightly OP, there is a reason we name the function trigexpand.
It is simply doing expand(RHS), into real and imag parts

cis(n*x) = cis(x)^n

CAS> cis(x) := exp(i*x) // = cos(x) + i*sin(x)
CAS> im(cis(x)^3)        // = trigexpand(sin(3*x))

3*COS(x)^2*SIN(x) - SIN(x)^3

Again, what is displayed is *not* what is used. Internally, it is CAS sin/cos
Find all posts by this user
Quote this message in a reply
12-16-2022, 11:51 PM
Post: #12
RE: TRIGEXPAND FUNCTION
Thanks to all for the help. I reset both the calculator and the emulator and now all works. It works whether I use the SIN key, or type in SIN or sin but only displays the result in caps. I notice it also works with fractional inputs but not decimal i.e. sin(3/2*x) works but not sin(1.5*x). I guess that is normal for CAS.
Find all posts by this user
Quote this message in a reply
Post Reply 




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