Jumping Across The Galaxy

I’ve recently been busy exploring the galaxy in Elite:Dangerous, which I’ve written about before. It’s an interesting game, and the in-game universe is beautiful and awesome, at least once you get away from “civilized” space (where other players and NPCs often shoot at you for no logical reason.)

However, as you quickly find out, the galaxy is a big place. It’s about 100,000 light years (ly) across. Even in a 34th-century starship with faster-than-light drive, that’s a long way. The FTL frame-shift drives in E:D work by jumping from star to star. The farther the destination star from your current location, the more fuel is consumed. Also, for each ship+engine combination, there is a maximum possible jump distance.

When out exploring (heading out to find the lucrative Neutron Star fields, for instance), it doesn’t take long to start thinking of distances in terms of jumps. Soon, those fancy ship accessories start looking more like boat anchors, and you start to think about offloading them to get that last bit of jump range.

But that begs the question — how important is that last little bit of jump range, really? If your ship can do 30.1ly at a jump, is it really worth downgrading to Class D thrusters to get that last little bit of range?

Sometimes, yes, it does matter. If your path goes through sparse patches of stars, gaps in star placement can look like bottomless chasms that cannot be crossed (since none of the stars on the other side are in range.) For want of that last light-year or two, you might have to go around the void, adding many jumps to your trip — or you might not be able to reach these stars at all.

At the other extreme, sometimes more range isn’t important. If you can get to a destination in fifteen jumps with a 30.6ly range, increasing your max range to 31.6ly might not matter, if the best path still has the same number of jumps.

How to calculate this? Well, without the actual data from the Stellar Forge engine, it’s all ultimately guesswork. However, we can take a stab at finding the conditions under which range increases matter, based on a random scattering of simulated stars.

This simulation code (written for FreeBasic for Windows) creates a 1000 x 100 x 100 block of space and populates it with a fixed number of stars. All of the stars except the first and last are placed at random locations within this block, and Dijkstra’s Algorithm is used to navigate from one side of the block to the other. For extremely small jump distances, the ship cannot reach the other side. However, once the available jump range passes a given mark (17.0ly, in one simulation), the destination star becomes reachable. Further increases in jump range often result in the destination being reachable in fewer jumps.

Based on a preliminary simulation of 100,000 stars in the 100 x 100 x 1000 light-year “box,” here are the results for how many jumps were needed to reach the destination. (The same star positions were used for each run, so as to give a fair comparison.) The percentage of stars reachable from the starting position is also given. (Some of these may be isolated along the edges of the box, and would be reachable in a more realistic simulation. Another item for the to-do list.)

Jump Range Jumps TMJ % Efficiency % reachable
15 67 0 35.9
15.5 65 0 40.8
16 63 0 42.69
16.5 61 0 46.87
17 94 59 62.76 52.71
17.5 86 58 67.44 53.84
18 78 56 71.79 60.63
18.5 74 55 74.32 67.35
19 71 53 74.64 68.51
19.5 67 52 77.61 71.05
20 66 50 75.75 72.36
20.5 63 49 77.77 76.79
21 61 48 78.68 77.53
21.5 58 47 81.03 79.69
22 57 46 80.7 84.37
22.5 55 45 81.81 84.72
23 53 44 83.01 84.89
23.5 52 43 82.69 86.41
24 51 42 82.35 86.7
24.5 48 41 85.41 86.8
25 47 40 85.1 86.9
25.5 46 40 86.95 90.51
26 45 39 86.66 90.85
26.5 44 38 86.36 91.34
27 43 38 88.37 91.44
27.5 42 37 88.09 91.6
28 42 36 85.71 91.64
28.5 41 36 87.8 92.36
29 40 35 87.5 92.43
29.5 39 34 87.17 92.44
30 38 34 89.47 92.53
30.5 37 33 89.18 94.02
31 37 33 89.18 94.09
31.5 36 32 88.88 94.14
32 35 32 91.42 94.34
32.5 35 31 88.57 94.63
33 34 31 91.17 94.69
33.5 34 30 88.23 94.72
34 33 30 90.9 96.26
34.5 33 29 87.87 96.28
35 32 29 90.62 96.53
35.5 32 29 90.62 96.57
36 31 28 90.32 96.9
36.5 31 28 90.32 96.96

I’m currently investigating the effects of star density on these calculations. I expect the results to scale according to the average distance between stars, which should intuitively go by the cube root of the number of stars (since a lattice of stars with half the distance would have 8x as many stars per unit volume, on average.)

Posted in BASIC, Coding, Current Events, Math, Science | Leave a comment

Amazon Dash

I’m starting to think Amazon is evil. They keep coming up with cool ways to make me spend money.

Recently, I tried Amazon Fresh — Amazon’s new grocery-delivery service. I’ve been very impressed so far: they give one-hour delivery windows, have been on-time so far with very professional service, and the convenience can’t be beat. Plus, frozen goods ship with little packets of dry ice, which is always fun to play with (as long as you’re careful to not get frostbitten.) More about that, later.

Now, Amazon has come up with Amazon Dash.

Amazon Dash. (Click for larger.)

The new Amazon Dash shopping-list gadget. (Click for larger.)

Setup involves taking the Dash out of the box, putting in the two supplied AA batteries (they even sprung for Energizers), holding down both buttons to turn it on, and running through the Dash Setup on your smartphone or tablet. (There ought to be a way to do this with a PC, too, but I’m not sure that’s supported.) All told, it took about a minute, including entering the WiFi access code into the app to finish configuration and get the Dash on the home network. They really went out of their way to make the process smooth.

Using the Dash is ridiculously easy. There are two options: Scan a UPC barcode (which works very well and is very fast), or press the microphone button to add a voice note to your list. Log in to Amazon Fresh, and the items you’ve scanned and voice notes you’ve recorded are shown and can easily be added to your shopping cart.

It’s the second-easiest way I’ve ever seen to shop, and the easiest that I’ve tried, so far. For ultimate convenience, though, there’s Amazon Dash Button. Buy one for $4.99 (and you get $4.99 credit for its use), configure it, and reordering commonly-used items (for instance, cat food or litter) is literally a single press of a button away.

Amazon Dash Button. Press this one, and detergent shows up in a day or two. Talk about convenient!

And, apparently, they’re hackable!

…although, if the Internet of Things translates into a separate button for everything, I’m gonna have to go with a Class A network and get a bigger router…

Posted in Current Events, Design, Networking, Reviews, Toys, User Interface Design | Tagged , , , | Leave a comment

Microcode

Every so often, you come across an idea that is truly brilliant. Such ideas can sometimes make complex, expensive problems seem trivial. The idea of microcode is one such idea.

In order to work its magic, the* Central Processing Unit(CPU) in a computer needs to move data around between various sub-units inside itself. Every clock cycle, a control logic circuit dictates what electronic gates must open and close to move, for example, a byte of information from the B accumulator into the adder, and then a byte from the A accumulator into the L register. The control bus and the logic behind it are the choreographers, dispatchers, and traffic cops of the CPU.

In the early days, designing a CPU involved not only deciding on the number and width of registers and choosing and implementing an instruction set, but designing and simplifying the Boolean logic required to distinguish between various opcodes, which may or may not have been numbered with regard to ease of coding.

Microcode, conceived in 1951 by Maurice Wilkes, makes all of this much easier. Instruction cycles are broken up into T-states. For each T-state of each instruction, the CPU architect decides which gates should be active and which should be off (tristated). These are collected into a matrix, which is simply implemented as a ROM array on the chip. Each bit of the ROM corresponds to the desired behavior of a particular gate (the bit number), at a particular time (T state) in a certain instruction (the opcode). There’s no need to employ complex Quine-McCluskey simplification methods — it’s just a question of connecting the ROM to the gates.

 

* okay, “the CPU”, or “one of the CPUs.” Sheesh.

Posted in Design, Digital | Leave a comment

Geomagnetism

Magnetic compasses work by sensing the direction of the Earth’s magnetic field. A small, magnetized piece of metal is allowed to rotate with very little friction (typically, it is balanced on a pin.) The Earth’s magnetic field then coerces the needle to point in the same direction as the field — towards magnetic North (or, equivalently, South).

Compasses normally don’t measure the magnitude of the field, however. If the Earth’s magnetic field were to double in strength but retain the same local direction, compasses would move more quickly, but would still ultimately indicate the same direction.

With a few simple additions, though, a magnetic compass can be used to deduce the strength as well as direction of the Earth’s magnetic field — at least in two dimensions.

2015-07-30 23.22.57_sm

A compass, deflected from N/S by a current. (Click for larger.)

By using a coil with a carefully-controlled current flowing through it, a second magnetic field can be set up at a 90-degree angle to the natural one created by the Earth. If the current in the coil is varied until the compass needle is deflected 45 degrees from its natural position, the two fields are of equal strength (since the tangent of 45 degrees is 1.0.)

Here is the procedure to set up the experiment and calculate the strength of the Earth’s magnetic field.

  • Find a flat, open space (a table or desktop, for example) away from metal objects and furniture.
  • Place a compass on the table and align it with North.
  • Run a wire across the face of the compass, from N to S, and extended straight out as far as practical in each direction.
  • Connect the ends of the wire to a power supply, running through an ammeter
  • Starting at zero, increase the current until the needle deflects 45 degrees from N/S.
  • Note the amount of current needed to cause the 45-degree deflection

Since the needle’s direction is now halfway between the direction of the Earth’s magnetic field and the direction of the magnetic field set up by the current in the wire, the relative strengths of the two fields must be equal. (The tangent of 45 degrees is 1.)

The amount of current in the wire can be used to calculate the expected strength of the magnetic field at the distance r between the wire and the compass needle.

At 1cm, for example, you get one Gauss (100 microTesla) for every five amps of current (the relationship is linear, so such a rule of thumb is a valid specific-case simplification here.) Since the Earth’s magnetic field has a strength of about 500 milliGauss at the surface, a perpendicular magnetic field of 500 milliGauss should cause a 45 degree deflection in the needle.

So, we can do the above experiment and measure the field strength indirectly. My results so far? It seems to take somewhere between 1 and 3 amps, so the observed effect agrees to within an order of magnitude of the expected result. A narrower confidence interval will have to wait until I can find a better compass.

Then there’s the whole question of the 3D magnitude and direction of the field…

Posted in Electronics, Fundamentals, Science | Leave a comment