-
Notifications
You must be signed in to change notification settings - Fork 1
/
Result.hs
62 lines (48 loc) · 1.6 KB
/
Result.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
module Result where
import Data.List
import Diagram
import Graph
import Theory.Phi3
import LinComb
import Angles
printDiagram (Diagram d) = do
putStr $ show d
putStrLn ""
printLC lc f = mapM_ printOne lc where
printOne (e,c) = do
putStrLn $ show c
f e
printLCD lc = printLC lc printDiagram
expandD th str = printLCD $ runLC ds where
ds = diagramPutDots th d >>= diagramExpandADiffs th
d = buildDiagramStr str
printAS (a,s) = do
putStrLn $ show a
putStrLn $ s
printLCAS lc = printLC lc printAS
expandS th str =
printLCAS $ runLC $ fmap (\d -> (diagramAOps th d,diagramSymbolize d n pairs)) ds where
ds = diagramPutDots th d >>= diagramExpandADiffs th
d = buildDiagramStr str
n = nrLoops d
pairs = diagramAllMomentPairs d'
Diagram d' = fst $ head $ runLC ds
printJacobian th str = stringifyJ $ jacobian n pairs where
n = nrLoops d
pairs = diagramAllMomentPairs d'
d = buildDiagramStr str
d' = diagramAddMoments th d
expandS' th str =
map (addAOps . addCoeff) $ runLC $ fmap (\d -> (diagramAOps th d,diagramSymbolize d n pairs)) ds where
ds = diagramPutDots th d >>= diagramExpandADiffs th
d = buildDiagramStr str
n = nrLoops d
pairs = diagramAllMomentPairs d'
Diagram d' = fst $ head $ runLC ds
addCoeff ((x,s),c) = (x,show (fromRational c) ++ "*" ++ s)
strAOps ops = intercalate "*" $ filter (not . null) $ map strOneOp ops where
strOneOp (_,0) = ""
strOneOp (n,k) = "(1-a_" ++ show n ++ ")**" ++ show k
addAOps (ops,str) | null strOps = str
| otherwise = strOps ++ "*" ++ str where
strOps = strAOps ops