MathGroup Archive 2003

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

Search the Archive

Re: Simple Problem ??

  • To: mathgroup at smc.vnet.net
  • Subject: [mg39241] Re: Simple Problem ??
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Wed, 5 Feb 2003 00:11:26 -0500 (EST)
  • References: <b1nqk1$o50$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Werner,
Imagine typing in and you can do it!

    Convert[number_,base_]:=
      ToExpression[ToString[base]<>"^^"<>ToString[number]]

Test:

    base=2; number=1000111;

    Convert[number,base]

        71


   --
Allan

---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565


"AON NEWS" <frodo.biggins at gmx.net (nospam)> wrote in message
news:b1nqk1$o50$1 at smc.vnet.net...
> Hi
> it seems I have a simple problem, but I cannot find a (simple)solution:
>
> if I type 2^^1000111 mathematica calculates the correct dec. number
>
> but if I type: base=2; number=1000111; base^^number  all I get is a error
> message ???
>
> So a function Convert[number_,base_] for base convertions cannot work ...
> Any ideas
> Thx
> Werner
> --
>
>
***************************************************************************
> Prof. Mag. Werner CYRMON
> HTBLuVA Wr. Neustadt Abt. EDVO
> http://edvowww.htlwrn.ac.at/cyx
>
***************************************************************************
> If you can imagine it, you can do it! Walt Disney
>
***************************************************************************
> Want to learn math with fun or calculating some stuff online:
> Look at http://Onlinemath.htlwrn.ac.at
>
>
>




  • Prev by Date: Re: Simple Problem ??
  • Next by Date: Interpolation over an irregular surface
  • Previous by thread: Re: Simple Problem ??
  • Next by thread: RE: Simple Problem ??