How do I convert a hexadecimal number to base 10 in Mathematica?

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 22K views
Science Advisor
Homework Helper
Messages
1,118
Reaction score
1
I've never really used Mathematica before so I'm rather confused by it, how would I say convert a number, 23a94b13 to base 10?
 
Physics news on Phys.org
To enter a number of an arbitrary base, use the syntax:

base^^digits

For example, to enter the hexadecimal number 1AD, use the notation 16^^1AD.

To print a number out in an arbitrary base (Mathematica normally uses decimal), use the BaseForm[number, base] function.

For example, to print that same number in binary, use BaseForm[16^^1AD, 2].

NB: Mathematica has very good built-in searchable help. Always start by checking the help files.

- Warren
 
Uber thanks, couldn't make sense of the help files.