Generate C/C++ code from tensor expression and so on (using xAct)
-
Install free Wolfram Engine for Devolopers from https://www.wolfram.com/developer/. (If you are rich, you can install the totally worth-it Mathematica instead, versions that support 'wolframscript'.)
-
Download xAct from http://www.xact.es and install it properly.
-
clone repo:
git clone [email protected]:lwJi/Generato.git
-
set enviroment variable:
export GENERATO="/your/repo/path"
- Small toy
wolframscript -f test/unit/test.wl
- GHG formulation of Einstein's equations
Please take a look at the example script for GHG system: test/integration/GHG_rhs.ipynb. Or
wolframscript -f test/integration/GHG_rhs.wl
- Use lower case to name variables (to aviod conflict with say
Pi
)
-
Use
SetEQNDelayed
if your right-hand side (rhs) includes anIf
statement to handle different component cases. Otherwise,SetEQN
is preferred because it has an option,CheckRHS
, which checks if all the terms appearing in the rhs are well-defined. -
IsDefined[term]
is very useful for debugging.