Dirk Laurie on Sat, 16 Aug 2014 22:19:20 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Fwd: Vec() and leading zeros of generating function


2014-08-16 8:12 GMT+02:00 Dirk Laurie <dirk.laurie@gmail.com>:
> 2014-08-16 7:43 GMT+02:00 Kevin Ryde <user42_kevin@yahoo.com.au>:
>>My main use has been to compare against expected or desired
>> values, so
>>
>>     want = [1, -1, 1, -1]
>>     Vec(1/(1+x) + O(x^length(want))) == want || error("oops")
>>
>> I see some Pol(Vecrev()) can turn the values into a poly for the
>> compare, but poly -> values helps for printing the values too.
>
> I would do that job by
>
> expr1 = 1/(1+x)
> expr2 = 1-x+x^2-x^3
> if(expr1-expr2-O(x^4),"different","equal")

Wth (poldegree(expr2)+1) instead of 4 if you need
to make it automatic.