Page 1 sur 1
Factoring as list
Publié : sam. août 12, 2017 12:45 am
par compsystems
Xcas has a command that returns a list of expressions, but without multiplicity?
1:
factors( x^4-1 ) returns
[x-1,1,x+1,1,x^2+1,1]
2:
factor( x^4-1 ) returns
(x-1)*(x+1)*(x^2+1)
3:
split( x^4-1, x) returns
Error =(
x^4-1 ->
[x-1,x+1, x^2+1]
Re: Factoring as list
Publié : sam. août 12, 2017 5:01 am
par parisse
you can easily write a user program from the output of factors to do that.
Re: Factoring as list
Publié : mer. août 16, 2017 2:44 pm
par compsystems
Code : Tout sélectionner
splits(pol):=
{
fs:=factors(pol);
sz:=size(fs);
return seq('fs[k-1]',k,1,sz,2);
}
1:
factors(x^4-1) returns
[x-1,1,x+1,1,x^2+1,1]
2:
splits(x^4-1) returns
[x-1,x+1,x^2+1]
3:
split(x^4-1,[x,y]) trick
[(x-1)*(x+1)*(x^2+1), 1]
An idea, I like that commands embedded in the system
add a Full keyword, to denote total separation, As does matlab
https://www.mathworks.com/help/symbolic/factor.html
4:
split(x^4-1,x,'full')
[x-1,x+1,x^2+1]