Magnetic Field Calculator
for Stern-Gerlach

Button["Open Field Calculator",MagnetDialog]

?B

Bplot

Initialization Code

This data comes from the original chart

data={{0,0.08},{0.5,0.575},{1.,0.9},{1.5,1.075},{2.,1.17},{2.5,1.23},{3.,1.27}};

Fit a cubic spline to the data

Needs["Splines`"]

spline=SplineFit[data,Cubic];

Define a function which, given I, calculates B

B[x_?NumberQ]:=spline[2 x][[2]]/;0≤x&&x≤3
B::usage="B[I] calculates the magnetic field (in Tesla) for magnet current I (amps)."

Bplot=Plot[{B[x]},{x,0,3},AspectRatio->1,Frame->True,PlotLabel->Style["Magnet Calibration",Larger],GridLines->Automatic,GridLinesStyle->GrayLevel[.85],PlotStyle->Thick,FrameLabel->{Style["I (amps)",Larger,Italic],Style["B (Tesla, ±10%)",Larger,Italic]},ImageSize->450];

Here is a dynamic calculator of B vs. I in a dialog window

MagnetFieldNotebook=Notebook[{}];

MagnetDialog :=If[MagnetFieldNotebook===Notebook[{}],
MagnetFieldNotebook=CreateDialog[
{Manipulate[
Block[{b},
b=B[x];
Grid[{
{Tooltip[Style["Magnet Field (Tesla): ",FontFamily->"Helvetica"],"The magnetic field estimate from the calibration data"],Tooltip[Style[ToString[ Round[b,.001]],FontFamily->"Helvetica"],"The magnetic field estimate from the calibration data"]},{},{Style["Calibration has a ±10% systematic scale uncertainty",FontFamily->"Helvetica"],SpanFromLeft}
},Alignment->{Left,Baseline}](* Grid *)
](* Block *),
Style["Enter Magnet Current (Amps):",Larger],"",
{{x,1.0,
"Magnet Current (Amps)"}
,ControlType->InputField},
AppearanceElements->None](* Manipulate *)
},
Magnification->1.5,
Deployed->True,ShowCellBracket->False,Saveable->False,
WindowSize->All (*,WindowFrame->"Normal",WindowElements->"MagnificationPopUp" *),WindowFloating->False,
WindowTitle->"Magnet Calculator - Physics 7 Stern-Gerlach",
NotebookEventActions->{"WindowClose":>(MagnetFieldNotebook=Notebook[{}];)}
];,SetSelectedNotebook[MagnetFieldNotebook]];