coeff cmd with second parameter

Messages in english

Modérateur : xcasadmin

compsystems
Messages : 603
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

coeff cmd with second parameter

Message par compsystems » sam. oct. 12, 2024 12:50 am

Hello

if coeff(-6*x^2,x^2) -> -6
if coeff(-6*x^4,x^3) -> -6
if coeff(-6*x^4,x^4) -> -6

then
coeff(-6*x^1,x^1) -> [-6,0] ?
coeff(-6*x,x^1) -> [-6,0] ?

parisse
Messages : 5881
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: coeff cmd with second parameter

Message par parisse » lun. oct. 14, 2024 11:59 am

coeff expects a variable name as 2nd argument and a positive integer as 3rd argument. The variable name may be omitted if it is x.

compsystems
Messages : 603
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

Re: coeff cmd with second parameter

Message par compsystems » jeu. oct. 17, 2024 2:41 am

but as I see in the examples it also accepts in the second argument a power, only that for x^1 = x it does not work

parisse
Messages : 5881
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: coeff cmd with second parameter

Message par parisse » jeu. oct. 17, 2024 5:46 am

That's expected, x^1 is evaled to x before coeff is called. You can however run coeff(-6*x^1,'x^1')

compsystems
Messages : 603
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

Re: coeff cmd with second parameter

Message par compsystems » dim. oct. 27, 2024 7:14 pm

but in this case it fails
coeff(-6*x,'x') returns [-6, 0] expected -6

parisse
Messages : 5881
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: coeff cmd with second parameter

Message par parisse » lun. oct. 28, 2024 7:46 am

'x^1' is not the same as 'x', it's a symbolic of rootnode ^, not an identifier.

Répondre