# Questions tagged [binary]

The tag has no usage guidance.

80 questions
Filter by
Sorted by
Tagged with
146 views

### updating matrix elements based on a condition

I am (still) fairly new to Mathematica and trying to perform some operation on the matrix elements, say for the matrix ...
41 views

### How can I apply a matrix 2*2 to binary digits? [closed]

I want to apply a matrix 2*2 to a binary digits. For example, D and E are two matrices that they apply to a 1 and 0. D --> 1 & E --> 0 binary digits: (1011) --> D.E.D.D
1k views

### How to do binary calculation？

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...
282 views

### BinaryWrite negative numbers [closed]

testList = {1, 2, 3, 4}; file = "test1"; BinaryWrite[file, testList]; BinaryReadList[file] Close[file]; Gives {1, 2, 3, 4} ...
895 views

### Faster binary Hamming weight for big integers?

While working on an answer to Count the sequences in an array I found that DigitCount was the bottleneck in my code when used as ...
101 views

### Recurrence relation for multivariate polynomials

I am trying to define a function which recursively computes a polynomial associated to every binary string: ComputePoly[s_]:=(** Recurse on the string s**) For ...
127 views

### Troubleshooting Program Meant to Swap Elements

I wrote a program that is supposed to take a list (of arbitrary length) of pairs of the digits of binary numbers (e.g. ...
857 views

### Binary file gymnastics

I have an unformatted binary file generated by fortran 77 and i want to import it in Mathematica. The file is formed by 5 data arrays with double precission float numbers. The problem is that seems ...
73 views

### How to force the writing of buffers onto disk?

Usually, buffering is good; except when you critically need to write data to disk. Is there a way to force the writing of buffers onto disk? (I'm using a binary file) I believe a ...
437 views

### Generating b/w bitmaps from a binary sequence

I would like to make a bitmap that visually represents a binary sequence, something like this: Where for example the 1's become a black pixel and the 0's a white one. I have never done something ...
209 views

### Built in function to convert list of numbers into list of binary numbers [closed]

Does Mathematica have a build in way to convert a list of numbers into a list of binary numbers? If not how can this be accomplished?
2k views

### All binary sequences with length n

I don't know if there is a built-in function for this, but I'm thinking about something like this Outer[List, Table[{0,1},{n}] ] But ...
715 views

### Simplify binary expressions

Is it possible for Mathematica to do simplifications for expressions where the variables are binary, such as: a + b = 1 + 2*c => a + b = 1 Here c must be 0 because if it is 1, the RHS is 3 but the ...
684 views

### Importing FITS file from HEALPix

I am trying to read FITS file created by HEALPix software. The file contains a spherical map of a scalar field. There is the online support on how to use the file in IDL, but not for Mathematica. I ...
273 views

### BitShiftRight produces incorrect results in Version 10

Bug introduced in 10.0.0 and fixed in 10.0.2 With Mathematica 10 for Mac, BitShiftRight works properly on lists of up to 100000 numbers, but appears to give ...
1k views

### Is there a function for nearest power of 2 in Mathematica like nextpow2 in MATLAB?

I am looking for something like nextpow2 in MATLAB like this: P = nextpow2(A) returns the exponents for the smallest powers ...
2k views

### Graph from binary matrix (not adjacency) respecting the original matrix positions

I have a binary matrix. My objective is to connect every close (without "jump") elements with value equal to 1, but I must keep the point positions, just like it's shown at the image. Can somebody ...
193 views

### Replacing High Densities of 1.s in Very Large Binary Arrays

I am working with very large binary arrays on the order of {100,100000}. It may look something like this. data = N[Table[RandomInteger[], {i, 100}, {j, 100000}]]; ...
2k views

### Doing arithmetic with binary numbers

How do I execute binary operations in Mathematica? I want to to multiply say 1010101011 (binary) to 1111101110 (binary) and getting the result 10100111101111111010? Then I want to add the result to ...
475 views

### How is the mysterious Raw function used?

I have never seen an example use for the mysterious Raw function: Raw[h, "hexstring"] constructs a raw data object with head h, and with contents ...
1k views

### Read a binary file to an image in memory then analyze it

Is it possible to read a whole file (~100 MBs) into memory, and then use BinaryRead[] function on the data loaded into memory to read/cast it to the types I need with a proper StreamPosition pointer? ...
242 views

### Conversion of binary matrix of mlf into multilinear function, any ready function for this?

I convert here only one term $x_1x_3x_7$ from the binary matrix by first getting the reversed binary 1010001 and then miggling with the data. I know I could convert the columns into binaries and then ...
94 views

### Command to change binary mlf terms into Subscripted mlf terms?

I express multilinear functions in the following format. Is there any ready command to convert them to multilinear functions easily? Input ...
993 views

### No builtin function for bitwise rotation?

There appears to be no builtin Mathematica function for bitwise rotation. Is that true? I suppose I can write my function: ...
1k views

### Hex Representation in Mathematica and Python

I want to convert a code from Mathematica to Python. I am using the following code to convert a code to hexadecimal, binary and so on: ...
2k views

### How to read 32-bit *IBM* (not IEEE) floating point values from a binary file?

I am trying to read a binary file. This file records seismic data. Basically its first 3600 bytes are for the general file information, following are for seismic traces, each begins with 240 bytes for ...
2k views

### Importing or reading data in binary format 212

I have a binary data file in format 212, and I want to import the file into Mathematica. How do I read or import binary format 212? I almost have no direct experience of working with any binary format....
3k views

### Reading periodic elements from a large file

I have a large binary data file (big endian) with 100+ million "rows" of 11 elements, combination of floats and integers. This is the format: ...
At school we learned that $\log_b(x)=\log(x)/\log(b)$, which is implemented in Mathematica as Log[b, x], but the results are different. ...