Copyright | (c) Fabricio Olivetti 2021 - 2024 |
---|---|
License | BSD3 |
Maintainer | fabricio.olivetti@gmail.com |
Stability | experimental |
Portability | |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Data.SRTree.Print
Description
Conversion functions to display the expression trees in different formats.
Synopsis
- showExpr :: Fix SRTree -> String
- showExprWithVars :: [String] -> Fix SRTree -> String
- printExpr :: Fix SRTree -> IO ()
- printExprWithVars :: [String] -> Fix SRTree -> IO ()
- showTikz :: Fix SRTree -> String
- printTikz :: Fix SRTree -> IO ()
- showPython :: Fix SRTree -> String
- printPython :: Fix SRTree -> IO ()
- showLatex :: Fix SRTree -> String
- printLatex :: Fix SRTree -> IO ()
- showOp :: Op -> String
Documentation
showExpr :: Fix SRTree -> String Source #
convert a tree into a string in math notation
>>>
showExpr $ "x0" + sin ( tanh ("t0" + 2) )
"(x0 + Sin(Tanh((t0 + 2.0))))"
showExprWithVars :: [String] -> Fix SRTree -> String Source #
convert a tree into a string in math notation given named vars.
>>>
showExprWithVar ["mu", "eps"] $ "x0" + sin ( "x1" * tanh ("t0" + 2) )
"(mu + Sin(Tanh(eps * (t0 + 2.0))))"
showPython :: Fix SRTree -> String Source #
Displays a tree as a numpy compatible expression.
>>>
showPython $ "x0" + sin ( tanh ("t0" + 2) )
"(x[:, 0] + np.sin(np.tanh((t[:, 0] + 2.0))))"