Page 1 sur 1

coeff cmd with second parameter

Publié : sam. oct. 12, 2024 12:50 am
par compsystems
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] ?

Re: coeff cmd with second parameter

Publié : lun. oct. 14, 2024 11:59 am
par parisse
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.

Re: coeff cmd with second parameter

Publié : jeu. oct. 17, 2024 2:41 am
par compsystems
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

Re: coeff cmd with second parameter

Publié : jeu. oct. 17, 2024 5:46 am
par parisse
That's expected, x^1 is evaled to x before coeff is called. You can however run coeff(-6*x^1,'x^1')

Re: coeff cmd with second parameter

Publié : dim. oct. 27, 2024 7:14 pm
par compsystems
but in this case it fails
coeff(-6*x,'x') returns [-6, 0] expected -6

Re: coeff cmd with second parameter

Publié : lun. oct. 28, 2024 7:46 am
par parisse
'x^1' is not the same as 'x', it's a symbolic of rootnode ^, not an identifier.