Mathematica Simulation

From New IAC Wiki
Jump to navigation Jump to search

Setting up Mathematica for DC Theta-Phi Isotropic Cone

We can define the constraints of the plane the DC is in

right = ContourPlot[
   x2 == Cot[29.5 \[Degree]] y + .09156, {y, -1, 1}, {x2, 0, 1.8}, 
   Frame -> {True, True, False, False}, 
   PlotLabel -> "Right side limit of DC as a function of X and Y", 
   FrameLabel -> {"y (meters)", "x (meters)"}, ContourStyle -> Black, 
   PlotLegends -> Automatic];

left = ContourPlot[
   x2 == -Cot[29.5 \[Degree]] y + .09156, {y, -1, 1}, {x2, 0, 1.8}, 
   Frame -> {True, True, False, False}, 
   PlotLabel -> "Right side limit of DC as a function of X and Y", 
   FrameLabel -> {"y (meters)", "x (meters)"}, ContourStyle -> Black, 
   PlotLegends -> Automatic];


We can define the x coordinate of the wires as they cross the midpoint plane as shown earlier.

x0forWires[number_] := .23168 + .01337*(number);


We can define the point midway between two parallel lines as the point where one wire is recorded versus its next highest neighbor

x0forWireMiddles[
   number_] := ((.23168 + .01337*(number)) + (.23168 + .01337*(number \
+ 1)))/2;

All of the conditions dependent on \[Theta] and \[Phi]


\[CapitalDelta]a := 
  FullSimplify[(R Sin[\[Theta] \[Degree]])/
     2 (Csc[65 \[Degree] - \[Theta] \[Degree]] - 
      Csc[115 \[Degree] - \[Theta] \[Degree]]), \[Theta] > 0];
e := Sin[25 \[Degree]]/Cos[\[Theta] \[Degree]];
a := FullSimplify[(R Sin[\[Theta] \[Degree]])/
     2 (Csc[65 \[Degree] - \[Theta] \[Degree]] + 
      Csc[115 \[Degree] - \[Theta] \[Degree]]), \[Theta] > 0];
rD1 := Simplify[(a e - \[CapitalDelta]a) Tan[
     65 \[Degree]] Cos[\[Theta] \[Degree]], \[Theta] > 0];
rD2 := Simplify[(a e + \[CapitalDelta]a) Tan[
     65 \[Degree]] Cos[\[Theta] \[Degree]], \[Theta] > 0];
xD1 := Simplify[rD1 Cos[\[Phi] \[Degree]]];
yD1 := Simplify[rD1 Sin[\[Phi] \[Degree]]];
zD1 := Simplify[rD1 Cot[\[Theta] \[Degree]], \[Theta] > 0];
xD2 := Simplify[rD2 Cos[\[Phi] \[Degree]], \[Theta] > 0];
yD2 := Simplify[rD2 Sin[\[Phi] \[Degree]], \[Theta] > 0];
zD2 := Simplify[rD2 Cot[\[Theta] \[Degree]], \[Theta] > 0];
xP := Simplify[(R Cos[\[Phi] \[Degree]])/(Cot[\[Theta] \[Degree]] + 
      Cos[\[Phi] \[Degree]] Cot[65 \[Degree]]), \[Theta] > 0];
yP := Simplify[(R Sin[\[Phi] \[Degree]])/(Cot[\[Theta] \[Degree]] + 
      Cos[\[Phi] \[Degree]] Cot[65 \[Degree]]), \[Theta] > 0];
zP := Simplify[(R Cot[\[Theta] \[Degree]])/(Cot[\[Theta] \[Degree]] + 
      Cos[\[Phi] \[Degree]] Cot[65 \[Degree]]), \[Theta] > 0];
x1 := Simplify[(rD2^2 - rD1^2 + 
       Cot[\[Theta] \[Degree]]^2 (rD2^2 - rD1^2) - 2 xP (xD2 - xD1) - 
       2 yP (yD2 - yD1) - 2 zP (zD2 - zD1))/(4 a e) - a e, \[Theta] > 
    0];
x := Simplify[x1 - \[CapitalDelta]a + a e, \[Theta] > 0];
xCenter := x + \[CapitalDelta]a;
n := -957.412/(Tan[\[Theta] \[Degree]] + 2.14437) + 430.626;
D2P := Simplify[((xD2 - xP)^2 + (yD2 - yP)^2 + (zD2 - 
       zP )^2)^.5, \[Theta] > 0] // N
D1P := Simplify[((xP - xD1)^2 + (yP - yD1)^2 + (zP - 
        zD1)^2)^.5, \[Theta] > 0] // N;
y := Simplify[(D1P^2 - x1^2)^.5, \[Theta] > 0] // N;
b := Simplify[a Sqrt[1 - e^2], \[Theta] > 0] // N;
R = 2.52934271645;