Tag Info

0

not sure how helpful this is but whenever i work with binary I always use a table so you wanted 0.25 (base 10) in to binary: binary table 8 4 2 1 . 1/2 1/4 1/8 1/16 8 4 2 1 . 0.5 .25 .125 .0625 0 0 0 0 . 0 1 0 0 (0.25 in binary) 1 1 1 1 . 1 1 0 0 (15.75 in binary) etc and the other way 15.375 to binary for example 15 - 8 = 7 (1) 7 - ...

0

If I correctly understand what you're doing, $$n>>m=\frac{n}{2^m}$$ and $$n<<m=n\cdot 2^m.$$ This is similar to the way that moving a decimal point one place to the left (right) corresponds to division (multiplication) by $10$. For example, then: $$16>>1=8\\16>>2=4\\16>>3=2,$$ and so on; or the other way, ...

0

I am (still) not sure if I understand the problem correctly. I'm considering the following problem: given a set of numbers $a_n$, find the group of numbers whose sum is minimal, given that it exceeds a certain threshold. $$\min_{x_n}\sum_n x_na_n\\ \text{s.t. } \sum_n x_na_n \ge t,\quad x_n\in\{0,1\}$$ where $t$ is the threshold and $x_n$ are the unknown ...

0

The APM MATLAB interface can be used to solve this problem. The APMonitor modeling language can solve problems with Mixed Integer Nonlinear Programming but you'll need to select the APOPT solver. The models can be solved either through a web-interface or through APIs for MATLAB or Python.

1

a=.665811575; b=.6658289 print "0." while (b<=.5 or a>.5) { if (b<=.5) { print "0"; a=2*a; b=2*b; } else { print "1"; a=2*a-1; b=2*b-1; } } print "1"

1

If I recall correctly, your method is near what I'd suggest. If > 1, write '1' subtract 1, else write 0 Multiply by 2 You want accuracy to 1 in 100000, or 2^17 (131,072) so I believe 17 digits after decimal should do it. It may very well be an infinite non-repeating series, so I'd quit after either X iterations (the 17 I suggest) or until the a ...

1

By Hensel's lemma, you can show that the nonzero squares in the $2$-adics $\Bbb Z_{(2)}$ are exactly the numbers of the form $4^n(8k+1)$ : the numbers whose binary expansion ends with "001" and an even number of zeroes. The squares mod $2^j$ are again those numbers. Thus, the number of squares modulo $2^j$ is $1 + 2^{j-3} + 2^{j-5} + \ldots \approx ... 5 According to "Distribution of the figures 0 and 1 in the various orders of binary representation of kth powers of integers", W. Gross and R. Vacca (Mathematics of Computation, April 1968, 22, #102, 423–427), the answer is yes. On page 423 they define a function$N_k(h)$, which is the count of 1 bits in the$h$th position of the sequence$n^k$over one of ... 1 Set$X_i$to be the 0/1 random variable denoting whether two binary strings differ in position$i$. These$L$random variables are independent, and each 0/1 with equal probability. By linearity of expectation,$E(X_1+X_2+\cdots+X_L)=E(X_1)+E(X_2)+\cdots+E(X_L)=1/2+1/2+\cdots+1/2=L/2$. 1 A binary operation is any operation acting with two arguments, irrespective of the base, or indeed, whether they are numbers or not. Adding two decimal numbers is a binary operation:$15 + 13 = 28$. Here, the addition operation takes two numbers,$15$and$13$, and acts on them. In some notation systems, we can make this more clear by writing it as$(+\ 15\ ...

3

The answer is that "it depends". If your binary numbers are integers, then the first result is correct: $$630=48\cdot13+6,$$ so the integer part of the quotient is, indeed, 48 and the remainder is six. The link that you gave specifically states that it is doing polynomial division. What that means is that it interprets the individual bits as coefficients ...

1

Absolutely you should get the correct result. Note that both the first and second subtraction they subtract $1001_2-1101_2=100_2$ They must be working in the field of two elements, not in $\Bbb N$

1

The calculator you posted does not do operations in the usual sense, it does it in $GF(2)$, i.e. modulo 2, in each coordinate $1+1=0$, for example. Arithmetic should give the same answer when done in base 10 and base 2.

0

I have decided to add an answer in response to my comments above. There is an efficient algorithm, which is described here. I will outline the algorithm below in MATLAB format. function y = mylog (x,tol) % calculate log(x) in base 2 to tolerance tol y = 0; % initialise output b = 0.5; % initialise mantissa % arrange the input into a known ...

0

Each internal node (or vertex) of the tree will be labelled by one of the operators appearing in the expression, and each leaf by one of the operands. The algorithm is quite straightforward. Start with the operation that would be performed last if you were evaluating the expression. In the case of the expression \big((2 + ...

2

You are looking for a syntax tree, and that is part of what parsing is all about. This is more suited for http://cs.stackexchange.com or perhaps http://www.stackoverflow.com. The "compiler-compilers" (parser generators) are programs that given a grammar construct programs that (essentially) create such trees. There are plenty...

0

Hint: Look at the definitions and take note that being a group implies being a monoid which implies being a semigroup. Is the operation associative? If so then it is a semigroup. Is there an element $e$ such that $a \# e = e \# a = a$ for all $a$ in $\mathbb Z^+$? If so then it is a monoid(if it is also associative). Is there an inverse element for each ...

0

What you are proposing is essentially a "binary search" based on the Intermediate Value Theorem. You are looking for the solution to the equation $\log_2 11 - x = 0$, or what is equivalent, $2^x - 11 = 0$. Since exponential and logarithmic functions are continuous for all real numbers, it is safe to apply this Theorem. You know that $2^3 - 11 < 0$ ...

4

Normally, you'd assume that any leading bits are zero. Also, the bits should be aligned by least significant, not most significant. So what you really want is this: a b a^b ---------- 0 1 1 <- because a is less than 10000, pad it out 1 0 1 0 1 1 1 0 1 0 0 0 So your answer is 30.

Top 50 recent answers are included