# Tag Info

11

You can input numbers in any base up to 36 using the notation base^^digits. Digits over 9 are represented using a, b, c, ... You can print numbers in any base up to 36 using BaseForm. Thus, In[1]:= a=2^^0.10101 Out[1]= 0.65625 In[2]:= BaseForm[a^2,2] Out[2]//BaseForm= Subscript[0.0110111001, 2] Note that the internal representation of numbers doesn't ...

6

I feel like I should be prefacing this answer with three confessions, considering that this is an arithmetic question. First, I had a hard time with the multiplication tables until I was nine years old. Second, even after I finally got the hang of multiplication, I was never a fan of multiplying from right-to-left; I preferred going left-to-right. (Arthur ...

6

You can enter a number in an arbitrary base using base^^digits: alpha = 2^^0.10101; BaseForm[alpha, 2] BaseForm[alpha^2, 2]

4

Please tell me if this simplified function does what you want: f[x_, n_] := Round[x, 10^(1 - n + ⌊ Log10 @ Abs @ x ⌋)] ~SetPrecision~ n Test: Table[f[x*Pi, 4], {x, {1/100, 1/10, 1, 10, 100}}] % // FullForm {0.03142, 0.3142, 3.142, 31.42, 314.2} List[0.031424., 0.31424., 3.1424., 31.424., 314.2`4.] Update The OP wrote: I understand that ...

3

If you look up the term pure function you'll find that in Mathematica jargon (as e.g. used in documentation) it actually means something that in computer science jargon is typically called an "anonymous" function. In CS jargon a pure function is usually one with no inner state, no side effects and isn't depending on any external input. The right hand side of ...

2

Probably something like this would work: f := (If[AllTrue[{##}, IntegerQ] , +##]) &

2

Most users probably want to use SetPrecision, which preserves extra digits and automagically handles fractional digits of precision. However, in this case, we need to somehow override this behavior. I'll use a custom object, sigFigNumber. First I'll define how it's displayed. Format[sigFigNumber[s_, d_]] := N[s, d] So we can see that sigFigNumber has ...

1

At the moment, this is just some random thoughts and observations. I will try to morph it into a coherent answer, soon. First, a determinant can be reasonably calculated using LUDecomposition, e.g. Clear[ludet]; ludet[nn_] := ludet[nn] = Block[{u, s1}, u = First@LUDecomposition@Table[s1[i1, i2], {i1, 1, nn}, {i2, 1, nn}]; Times @@ Diagonal[u ...

1

You have quite a small data set, so a really inefficient brute force search will still run pretty fast (<1 sec on my computer). I stress that this is STUPID way to do it, and with list manipulation you can surely make it MUCH more efficient. But as I said - it works. First, transform the data so that you could retrieve the data by calling f[x1,x2,x3], ...

Only top voted, non community-wiki answers of a minimum length are eligible