# An Illustrated Guide to Shape and Strides (Part 3)

In Part 1 and Part 2 we looked at key array attributes such as shape, strides and offset and how NumPy implements array operations by changing these attributes to traverse a contiguous region of memory in different ways.

...

# An Illustrated Guide to Shape and Strides (Part 2)

Part 2 follows on from the key concepts of strided arrays introduced in the previous post and examines how NumPy implements other fundamental array concepts using strides:

1. Transposing Arrays and Permuting Axes
2. C order vs. Fortran order
3. Ravelling...

# An Illustrated Guide to Shape and Strides (Part 1)

Welcome to the first part of a three-part illustrated guide examining shapes, strides and multidimensionality in NumPy.

The idea of strided arrays is simple, and is a basis for implementing arrays, matrices and tensors in many higher-level languages...

# J hooks make evaluating exotic expressions easy

You might see the approximation:

$\pi \approx 768{\sqrt {2-{\sqrt {2+{\sqrt {2+{\sqrt {2+{\sqrt {2+{\sqrt {2+{\sqrt {2+{\sqrt {2+{\sqrt {2+1}}}}}}}}}}}}}}}}}}$

and think:

Hmmm! How accurate...

# The fast way to count permutations with no repeated letters

There are 12 unique permutations of the word ‘food’. Of these, there are only six that satisfy the constraint that no adjacent...

# The intuition behind Expectation Maximisation

Expectation Maximisation is a fantastically useful algorithm used to estimate model parameters (e.g. the bias of a coin, or the mean of...

# The Fast Inverse Square Root method in Python

The inverse square root of a number x is x-1/2. For example, put in 25, you’ll get back 0.2: the square root of 25 is 5, the inverse of 5 is 1/5, or 0.2 in decimal notation. It’s a very...

# 100 pandas puzzles

I’ve started compiling a list of short pandas puzzles of varying difficulty. You can find it over on GitHub here.

There are already some great guides to pandas out there (not least in the official documents themselves) but nothing...

# Picking magic numbers for numpy.in1d

If you’ve played about with NumPy before, you’ll probably know that given two arrays of numbers, ar1 and ar2, the function in1d returns a boolean array indicating whether or not each number in...

# Three tactics to boost Stack Overflow upvotes

Stack Overflow, the hugely-popular programming Q&A website, has often been called an online game. To play, you post correct answers or ask interesting questions. Correct and interesting content is upvoted by other users, netting you precious green reputation points.

The...

# Python power towers

If you have a list of numbers, say [3, 2, 2, 2], what’s the best way to turn it into a power tower?

In other words, the aim is to take the list and calculate the answer to...

# A basic introduction to NumPy's einsum

The einsum function is one of NumPy’s jewels. It can often outperform familiar array functions in terms of speed and memory efficiency, thanks to its expressive power and smart loops. On the downside, it can take a little...

# The colour of the Internet

What colour is the Internet? Probably green or blue, judging by the colours that appear most often in domain names.

The graph below shows 12 colours and the number of times each one appears in .com and .net domain names....

# Words nobody wants for websites

There are over 130 million .com and .net domain names. Is every single English word being used?

Curious, I hatched a plan and found the answer: not at all.

By my reckoning, only around 64% of all recognisable English...