Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Converting Binary form to a desired array

  • To: mathgroup at smc.vnet.net
  • Subject: [mg76068] Re: Converting Binary form to a desired array
  • From: dh <dh at metrohm.ch>
  • Date: Tue, 15 May 2007 05:08:33 -0400 (EDT)
  • References: <f2959d$n0n$1@smc.vnet.net>


Hello Sharon,

one way to do it is to multiply an array of binary powers (2^i..) by 

the binary digits of your number. E.g.:

(t=IntegerDigits[212,2]) ( HoldForm[2^i]/.i\[Rule]#&  /@ 

Range[Length[t]-1,0,-1])

hope this helps, Daniel





athlonspell wrote:

> Hello,

> 

> I have this:

> 

>>  BaseForm[212,2] = 10100 

> 

> Now, I am trying to achieve this output from above:

> 

>>  {2^4, 0, 2^2, 0, 0}

> 

> How do I go about do this? 

> 

> Thank you,

> Sharon

> 




  • Prev by Date: weird behavior when plotting multiple functions in 6.0
  • Next by Date: Re: v6 resizing palettes on a mac
  • Previous by thread: Re: Converting Binary form to a desired array
  • Next by thread: Re: Converting Binary form to a desired array