Guide · 08 of 15
Magnetic fields
A scene magnet draws magnetic fields to scale and works the field out after every change, the way scene circuit works out currents. Wires, bar magnets and uniform fields are the sources; their fields add up as vectors, so two wires, or a wire in the earth's field, give the real combined picture, neutral point and all.
The scene is flat and drawn to scale like a circuit: no axes, x: and y: just frame it. unit: cm (the default) or unit: m says what one unit of the scene means, so a distance of 5 is 5 cm. lines: 8 is how many field lines each source draws (0 draws none, at most 24). mu: 4 * PI * 1e-7 is the permeability, the default. All of these are written on their own line in the scene, like probe is in a circuit.
A wire is the source you will use most. wire W = (x, y) { I: 3, flow: out } is a long straight wire going through the page, drawn as a circle with a dot (current out of the page) or a cross (into it). Its field is B = mu I / (2 pi d) in circles round it, counter-clockwise seen from the front for flow: out, the right-hand rule. wire W = (x1, y1) -> (x2, y2) { I: 3 } is a long wire lying in the page, current running from the first end to the second; its field points out of the page on its left, looking along the current, and into it on its right, drawn as a grid of dots and crosses that are bigger and closer near the wire. Name every wire. I: is in amps, and I, B, dir, strength and every coordinate can use params, so a slider can move a wire, change a current, or flip the earth's field. flow: can be the name of a choice whose options are "in" and "out", so a picker flips the wire.
Probes give readings you can use in labels, goals and ${} text: B_P is the size of the field at probe P in tesla (from wires and uniform fields, never from a magnet), Bx_P, By_P and Bz_P its components, and B_W_P the part wire W makes alone. They are 1e-7 to 1e-3, so write them with sci(B_P, 2). A goal like when: B_P < 1e-7 asks the student to find the neutral point. Readings are worked out, so they can be read but never set, and they cannot place a source.
Field lines are drawn for each wire through the page and each magnet, as <id>_lines, and traced through the whole field: a lone wire gives circles spaced wider and wider apart, a magnet loops from N to S, two wires wrap both or crowd between them. Every source, probe and <id>_lines works in a step's indicate, focus and surround. Field lines are part of the scene, so hide them with lines: 0, not show:. A scene plane beside the magnet scene can read its readings. Put the magnet scene first.
scene magnet#
Two wires with sliders for both currents and a probe the student drags to the neutral point between them, where B_P goes to zero. A wire is a cross-section (one point, with flow:) or a long wire lying in the page (two points). The same keyword wire is a circuit wire in scene circuit.
scene magnet { x: [min, max] y: [min, max] [unit: cm | m] [lines: <n>] [mu: <expr>] wire <id> = (x, y) { I: <expr>, flow: in | out } wire <id> = (x1, y1) -> (x2, y2) { I: <expr> } field <id> { ... } magnet <id> = (x1, y1) -> (x2, y2) probe <id> = (x, y) { [compass], [arrow] } }
| prop | type | description |
|---|---|---|
| unit | cm | m | what one unit of the scene means, default cm |
| lines | number | field lines per source, default 8, 0 for none |
| mu | expr | permeability, default 4 PI 1e-7 |
Example
field#
A uniform magnetic field of strength B tesla, like the earth's. dir: in or dir: out points it into or out of the page (drawn as a grid of x or dot marks); a number is an in-page direction in degrees counter-clockwise from the right, drawn as parallel arrows (0 is to the right, 90 is up). A choice with the options "in" and "out" lets a toggle flip it. Without region: it fills the whole scene; with it, only that rectangle. It adds to every wire's field, so a wire in the earth's field has a neutral point where the two cancel.
field <id> { B: <expr>, dir: in | out | <degrees> | <choice>, [region: (x0, y0) -> (x1, y1)] }
| prop | type | description |
|---|---|---|
| B* | expr | strength in tesla |
| dir* | in | out | degrees | choice | which way it points |
| region | (x0, y0) -> (x1, y1) | the rectangle it fills; the whole scene without it |
Example
magnet#
A bar magnet from (x1, y1) to (x2, y2), with its N pole at the first end. Its field is two point poles just inside the ends, so its lines leave the N face and loop round to the S face. strength: is the pole strength in A·m (default 1). A magnet is drawn and traced but adds nothing to the tesla readings: its strength is picked to make the picture look right, not taken from the book.
magnet <id> = (x1, y1) -> (x2, y2) { [strength: <expr>] }
| prop | type | description |
|---|---|---|
| strength | expr | pole strength in A·m, default 1 |
Example
probe#
A point where the field is measured. Its readings are B_<id> (the size, in tesla), Bx_<id>, By_<id> and Bz_<id>, and B_<wire>_<id> for the part of it that one wire makes. They can be used in labels, goals and ${} text. arrow draws the in-page direction as an arrow whose length follows the size on a log scale; compass draws a needle that points along it, N end red. Below 1e-9 tesla the arrow goes and the needle rests: that is the neutral point. Give the position params and a draggable point writing them, and the student can walk the probe around; write the point first so the compass is drawn on top of its handle, and give it r: 11 for a ring round the compass.
probe <id> = (x, y) { [compass], [arrow], [label: <string>] }
| prop | type | description |
|---|---|---|
| compass | flag | a compass needle along the in-page field |
| arrow | flag | an arrow along the in-page field |
| label | string | text beside it, ${} interpolates |
Example