(* ::Package:: *)

(************************************************************************)
(* This file was generated automatically by the Mathematica front end.  *)
(* It contains Initialization cells from a Notebook file, which         *)
(* typically will have the same name as this file except ending in      *)
(* ".nb" instead of ".m".                                               *)
(*                                                                      *)
(* This file is intended to be loaded into the Mathematica kernel using *)
(* the package loading commands Get or Needs.  Doing so is equivalent   *)
(* to using the Evaluate Initialization Cells menu command in the front *)
(* end.                                                                 *)
(*                                                                      *)
(* DO NOT EDIT THIS FILE.  This entire file is regenerated              *)
(* automatically each time the parent Notebook file is saved in the     *)
(* Mathematica front end.  Any changes you make to this file will be    *)
(* overwritten.                                                         *)
(************************************************************************)



SetDirectory["C:\\drorbn\\AcademicPensieve\\2015-04\\Commutators"];
PRoot[name_, a_, n_] := PRoot[name, n] = If[NumberQ[PRoot[name, n]],
MinimalBy[N[a^(1/n)]Table[E^(2\[Pi] I k/n), {k,n}],Abs[#-PRoot[name,n]]&][[1]],
a^(1/n)];
InputBackground=Graphics[{Pink, Disk[],Red, Point[{0,0}],
Table[{Line[{{t,-1},{t,1}}], Line[{{-1,t},{1,t}}]}, {t,-1,1,2/3}]}];
OutputBackground = {LightBlue, Disk[],Blue, Point[{0,0}],
Table[{Line[{{t,-1},{t,1}}], Line[{{-1,t},{1,t}}]}, {t,-1,1,2/3}],
Black};
Pt@c_ := {Re[c],Im[c]};


Import["Commutators-Handout_800.png"]


(* ::Input::Plain:: *)
Module[{\[Lambda]1,\[Lambda]2,x,a,b,c,\[CapitalDelta],\[Delta],r},
{\[Lambda]1,\[Lambda]2}={{1,1}/2, {1,-1}/2};
GraphicsGrid[Partition[#,3]& @ {
LocatorPane[Dynamic[{\[Lambda]1,\[Lambda]2}],InputBackground, Appearance -> {"\!\(\*SubscriptBox[\(\[Lambda]\), \(1\)]\)", "\!\(\*SubscriptBox[\(\[Lambda]\), \(2\)]\)"}],
Dynamic[Graphics[{OutputBackground,
{c,b,a}=CoefficientList[(x-{1,I}.\[Lambda]1)(x-{1,I}.\[Lambda]2), x];
Text["a", {Re[a],Im[a]}], Text["b", {Re[b],Im[b]}], Text["c",{Re[c],Im[c]}]
}, PlotRange->All, PlotLabel -> "(x-\!\(\*SubscriptBox[\(\[Lambda]\), \(1\)]\))(x-\!\(\*SubscriptBox[\(\[Lambda]\), \(2\)]\))=\!\(\*SuperscriptBox[\(ax\), \(2\)]\)+bx+c"]],
Dynamic[Graphics[{OutputBackground,
\[CapitalDelta]=b^2-4 a c; Text["\[CapitalDelta]",{Re[\[CapitalDelta]], Im[\[CapitalDelta]]}]
}, PlotRange->All, PlotLabel -> "\[CapitalDelta]=\!\(\*SuperscriptBox[\(b\), \(2\)]\)-4ac"]],
Dynamic[Graphics[{OutputBackground,
\[Delta]=PRoot["\[CapitalDelta][2]", \[CapitalDelta],2]; Text["\[Delta]", {Re[\[Delta]], Im[\[Delta]]}]
}, PlotRange->All, PlotLabel -> "\[Delta]=\!\(\*SqrtBox[\(\[CapitalDelta]\)]\)"]],
Dynamic[Graphics[{OutputBackground,
r=(-b+\[Delta])/(2a); Point[{Re[r], Im[r]}]
}, PlotRange->All, PlotLabel -> "r=(-b+\[Delta])/(2a)"]],
Null }] ]
