Post Reply 
Command 'coeff' (CAS Mode)
05-31-2024, 07:05 PM (This post was last modified: 05-31-2024 07:12 PM by hp-zl.)
Post: #1
Command 'coeff' (CAS Mode)
There is a trigonometric series (screenshot):
a:=(5*q+1)*sin(2*v)+(6*q^2+2)*sin(4*v)

We want to find the coefficient of sin(2*v), so we do:
coeff(a, sin(2*v),1) we get the correct result: 5*q+1.

But when we type:
coeff(a, sin(v*2),1) then we get zero.

With 'sin(4*v)' similarly (see screenshot).

The same results are given by both the physical calculator (with the latest firmware 2.1.14730) and the virtual calculator (HP_Prime_Virtual_Calculator-x86_64.AppImage, firmware 2.1.14288).

What do you think about it?
[attachment=13595]


Attached File(s) Thumbnail(s)
   
Find all posts by this user
Quote this message in a reply
05-31-2024, 07:51 PM
Post: #2
RE: Command 'coeff' (CAS Mode)
This problem also occurs for much simpler cases.
Assigning the expressions:
5*sin(2*x) and 5*sin(x*2) to the variables "a" and "b" results in "a" and "b" containing exactly the same expression: 5*sin(2*x).
However, applying the coeff function to each of these variables yields different results => screenshot.
   

Piotr Kowalewski
Find all posts by this user
Quote this message in a reply
05-31-2024, 08:24 PM
Post: #3
RE: Command 'coeff' (CAS Mode)
coeff is meant to work on polynomials with respect to an identifier, not with respect to a subexpression. It will work only if the subexpression is written exactly the same way in an expression.
If you run b:=sin(x*2) then the answer is displayed according to autosimplify mode, but b is not autosimplified.
Find all posts by this user
Quote this message in a reply
05-31-2024, 08:54 PM
Post: #4
RE: Command 'coeff' (CAS Mode)
(05-31-2024 08:24 PM)parisse Wrote:  coeff is meant to work on polynomials with respect to an identifier, not with respect to a subexpression. It will work only if the subexpression is written exactly the same way in an expression.
If you run b:=sin(x*2) then the answer is displayed according to autosimplify mode, but b is not autosimplified.

That's right. The syntax for the coeff in the help states that the second parameter should be [Var]. Moreover, setting the simplify parameter to 'None' in the CAS settings and repeating these operations explains everything. Thank you for the clarification.

Piotr Kowalewski
Find all posts by this user
Quote this message in a reply
Post Reply 




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