Re: Re: FromDigits[{135,21}] -> 1371 (??!!)
- To: mathgroup at smc.vnet.net
- Subject: [mg53765] Re: [mg53763] Re: FromDigits[{135,21}] -> 1371 (??!!)
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Thu, 27 Jan 2005 05:40:57 -0500 (EST)
- Reply-to: hanlonr at cox.net
- Sender: owner-wri-mathgroup at wolfram.com
FromDigits just implements a polynomial in the specified base.
FromDigits[{a1,a2,a3,a4}]
10 (10 (10 a1+a2)+a3)+a4
FromDigits[{a1,a2,a3,a4},b]==
Fold[b*#1+#2&,0,{a1,a2,a3,a4}] // ExpandAll
True
Consequently, FromDigits is almost an inverse function of CoeffiicientList.
They use reverse orderings of the coefficients.
poly = x^4 + 2*x^3*y + 5*x*y^2 + 13*y^4;
poly==
FromDigits[Reverse[CoefficientList[poly,x]],x]==
FromDigits[Reverse[CoefficientList[poly,y]],y]
True
Bob Hanlon
>
> From: "Astanoff" <astanoff at yahoo.fr>
To: mathgroup at smc.vnet.net
> Date: 2005/01/26 Wed AM 04:37:40 EST
> To: mathgroup at smc.vnet.net
> Subject: [mg53765] [mg53763] Re: FromDigits[{135,21}] -> 1371 (??!!)
>
> > Can anyone please explain what happens,
> > if "Digits" actually are "integers":
> > FromDigits[{3,2}]
> > 32(!)
> > FromDigits[{13,2}]
>
> Digit : "One of the ten Arabic number symbols, 0 through 9,
> or such a symbol used in a system of numeration".
> So, without any base specified, FromDigits[{13,2}]
> assumes default base 10 and should output an error message.
> Imho, that's a bug.
>
> v.a.
>
>