(* wolframscript -file konishi_gluing.wls INPUT_DIRECTORY CUT The manuscript links the two author-supplied inputs. CUT is 6, 8 or 10. Each run starts from the perturbative data only. *) If[Length[$ScriptCommandLine] != 3, Print["Usage: wolframscript -file konishi_gluing.wls INPUT_DIRECTORY CUT"]; Exit[2] ]; inputDirectory = ExpandFileName[$ScriptCommandLine[[2]]]; settings = <|"6" -> {6, 10, 18}, "8" -> {8, 14, 24}, "10" -> {10, 18, 30}|>; If[!KeyExistsQ[settings, $ScriptCommandLine[[3]]], Print["CUT must be 6, 8 or 10."]; Exit[2]]; {cutP, cutQai, QaiShift} = settings[$ScriptCommandLine[[3]]]; notebookName = "Konishi_prototype.nb"; seedName = "perturbative_data_Delta02_b10_b20_f11_f21_f31_f41_a10_a20_sol1.mx"; inputHashes = <| notebookName -> "18055c2d667280cead473ed39ac0fb79b41662d557c0ea7d8431e7b700da97a0", seedName -> "abfe3a38f3182203d3707c3b440f56d61cea77daef80a46991918a54a290b97b" |>; KeyValueMap[ Function[{name, hash}, With[{path = FileNameJoin[{inputDirectory, name}]}, If[!FileExistsQ[path] || FileHash[path, "SHA256", "HexString"] =!= hash, Print["Missing or unexpected input: ", name]; Exit[2]] ] ], inputHashes ]; (* Convert this pinned notebook's input boxes to ordinary kernel expressions. The original GUI and parallel progress displays are unnecessary here. *) boxText[s_String] := StringReplace[s, "\[IndentingNewLine]" -> "\n"]; boxText[RowBox[pieces_]] := StringJoin[boxText /@ pieces]; boxText[pieces_List] := StringJoin[boxText /@ pieces]; boxText[SubscriptBox[a_, i_]] := "Subscript[" <> boxText[a] <> "," <> boxText[i] <> "]"; boxText[SuperscriptBox[a_, i_]] := "((" <> boxText[a] <> ")^(" <> boxText[i] <> "))"; notebook = Get[FileNameJoin[{inputDirectory, notebookName}]]; inputCells = Cases[notebook, Cell[BoxData[boxes_], "Input", ___] :> boxes, Infinity]; loadCell[number_] := Module[{stream, held}, stream = StringToStream[boxText[inputCells[[number]]]]; held = ReadList[stream, Hold[Expression]]; Close[stream]; Scan[ReleaseHold, held] ]; loadCell[4]; nPoints = cutP+2; WP = 120; \[Epsilon] = 10^-25; gloop = 1/10; PerturbativeDataPath = inputDirectory <> $PathnameSeparator; Scan[loadCell, Join[Range[8, 27], Range[29, 35]]]; DoPoints[nPoints]; parameters = FromPert[gloop]; Do[ equationsAtPoint = \[DoubleStruckCapitalF]fur[parameters]; Print[ "Newton step ", iteration, " spin-two dimension ", N[2+Re[parameters[[2]]], 18], " equation norm ", N[Norm[equationsAtPoint], 5], " remaining-mode norm ", N[Norm[extras], 5] ]; If[iteration == 5 || Norm[equationsAtPoint] < 10^-24, Break[]]; jacobian = Transpose[Table[ (\[Delta]\[DoubleStruckCapitalF]fur[index, parameters]-equationsAtPoint)/\[Epsilon], {index, nnns} ]]; newtonStep = LinearSolve[jacobian, -equationsAtPoint]; If[!VectorQ[newtonStep, NumericQ], Print["Newton solve failed."]; Exit[1]]; parameters = AddEps[parameters, newtonStep]; parameters[[1]] = gloop, {iteration, 0, 5} ];