Polynomial Sequences part 2 by yvl

#!ruby -plarmathn
M=Matrix
$_=([*M[*(r=1..n=$F.size).map{|j|r.map{|i|j.**n-i}}].inv*M[*$F.map{|v|[v.to_i]}]].map{|v|n-=1;v[0]==0?0:"%+dx^#{n}"%v}-[0])*" "
gsub(/^\+|x.0|1(?=x.[^0])|\^1/){}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page