(***********************************************************************
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 Initialiation 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.
***********************************************************************)

FactorType[f_,p_]:=
  Module[{degs},
    degs=(Exponent[#1,x]&)/@
        Transpose[FactorList[f,Modulus\[Rule]p]]\[LeftDoubleBracket]1
          \[RightDoubleBracket];Return[(Select[#1-1,Positive]+1&)[degs]]]






galois2[f_] := Module[{ff, clff, clf,g,h,h1, hroots, theta, clg, p,q,r},
		clf = CoefficientList[f,x];
		If[Length[clf] !=5, (*Print[" Polynomial is not quartic."];*)
			Return[0]];
	If[Not[IrreducibleQ[f]], 
			(*Print[ "Polynomial is not irreducible."];*)
		Return[0]
	];
			ff = Expand[(1/clf[[5]])*f];
		clff = CoefficientList[ff,x];
	 g = Expand[ff /.x -> x-clf[[4]]/4];
	
			clg = CoefficientList[g,x];
		p = clg[[3]];
		q = clg[[2]];
		r = clg[[1]];
		h = Together[resolvantCubic[g]];
		h1 = h*Denominator[h];
		disc = Discriminant[f];
	If[
	IntegerQ[Sqrt[disc]],
		If[
			IrreducibleQ[h1],
				(* Print ["Galois group is A_4"];*) 
				Return[1],
			(*Print ["Galois group is V"]; *)
				Return[2]
			] (*endif*),

			If[
					IrreducibleQ[h1], (*Print[ "Galois group is S_4"]; *)
				Return[3],
				(*Print ["Galois group is Z_4 or D_4"]*)
			     ] (*endif*)
	
	] (*endif*);

		If[disc < 0,
			(* Print["Negative Discriminant implies Galois group is D_4."];*)
				Return[4]
			];
For[n = 1, n<=2000, n++,
			pp = Prime[n];
			If[(FactorType[f,Prime[n]] == {2} &&
						Mod[disc,pp]!=0),
				(*Print[
            "f has positive discriminant,not a square. Galois group has a \
2-cycle. Hence Galois group is D_4."];*) Return[4]
			] (*endif*)
];
	(*	Print["Galois group is Z_4."];*)
					Return[5]
		]


























































































