Page 1 sur 1

operations with terms

Publié : lun. déc. 02, 2019 3:43 am
par compsystems
Hello BP
1: Is there an included function that returns the terms of expression?

subst(a*x^2+b*x+c,'+', nop) enter [a*x^2, b*x, c]

possible name of the command
terms(a*x^2+b*x+c) -> [a*x^2, b*x, c]

2: to get the coefficient of a term

increasing_power(0)
coeff(a*x^2)[0] enter a
coeff(x^2)[0] enter 1
coeff(a*x^2, degree(a*x^2)) enter a

possible name of the command
coeffterm(a*x^2) -> a
coeffterm(x^2) -> 1
or
coeff(a*x^2, 'term') -> a

Thanks

Re: operations with terms

Publié : lun. déc. 02, 2019 7:00 am
par parisse
[op(a*x^2+b*x+c)]
coeff(a*x^2+b*x+c,x,2)

Re: operations with terms

Publié : lun. déc. 02, 2019 4:21 pm
par compsystems
coeff(a*x^2+b*x+c,x,2) ok, but you have to know what degree of the polynomial is, sometimes it is very important to determine if the coefficient of the highest degree is 1, so it would be very useful to add a word to identify it

coeff(a*x^2+b*x+c,`>`) -> a

Re: operations with terms

Publié : lun. déc. 02, 2019 5:40 pm
par parisse
The leading coefficient command is lcoeff