operations with terms

Messages in english

Modérateur : xcasadmin

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

operations with terms

Message par compsystems » lun. déc. 02, 2019 3:43 am

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

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

Re: operations with terms

Message par parisse » lun. déc. 02, 2019 7:00 am

[op(a*x^2+b*x+c)]
coeff(a*x^2+b*x+c,x,2)

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

Re: operations with terms

Message par compsystems » lun. déc. 02, 2019 4:21 pm

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

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

Re: operations with terms

Message par parisse » lun. déc. 02, 2019 5:40 pm

The leading coefficient command is lcoeff

Répondre