For example, $a=0.10101$ in binary representation.
Then how to calculate $a^2$ directly in mathematica?
Is there any function turning binary into decimal? I only found its inverse...
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.Sign up to join this community
You can input numbers in any base up to 36 using the notation
base^^digits. Digits over 9 are represented using
You can print numbers in any base up to 36 using
In:= a=2^^0.10101 Out= 0.65625 In:= BaseForm[a^2,2] Out//BaseForm= Subscript[0.0110111001, 2]
Note that the internal representation of numbers doesn't know or care about bases. These tools are only for inputting or printing numbers, but do not affect how numbers are stored internally. The internal representation is always binary.
You can enter a number in an arbitrary base using
alpha = 2^^0.10101; BaseForm[alpha, 2] BaseForm[alpha^2, 2]