Cadabra Q&A - Recent questions and answers
http://cadabra.science/qa/qa
Powered by Question2AnswerAnswered: Why the partial derivative example gives wrong answer?
http://cadabra.science/qa/1373/why-the-partial-derivative-example-gives-wrong-answer?show=1374#a1374
<p>The above works fine with the current version on github. If it does not for you,<br>
either upgrade, or say explicitly that the derivative is with respect to $\tau$,</p>
<pre><code> ex:= \partial_{\tau}{ f g};
</code></pre>
<p>or make $f$ depend on <code>\partial</code>:</p>
<pre><code> f::Depends(\partial{#}).
</code></pre>
<p>Otherwise the 'old' version of Cadabra which you use does not know how to figure out that <code>\partial</code> is a $\tau$-derivative. </p>
Bug reportshttp://cadabra.science/qa/1373/why-the-partial-derivative-example-gives-wrong-answer?show=1374#a1374Sun, 13 Oct 2019 13:46:34 +0000Answered: usage of canonicalise
http://cadabra.science/qa/1368/usage-of-canonicalise?show=1371#a1371
<p>The <code>NonCommuting</code> property only relates <em>different</em> objects; your line says that $u^{\mu}$ does not commute with $f^{\mu\nu}$, but it says nothing about how $u^{\mu}$ commutes with $u^{\nu}$. To impose what you want, use <code>SelfNonCommuting</code>, as in:</p>
<pre><code>{\mu,\nu}::Indices(vector).
f^{\mu\nu}::AntiSymmetric.
h^{\mu\nu}::Symmetric.
u^{\mu}::SelfNonCommuting.
ex:=u^{\mu}u^{\nu}f^{\nu\mu}+f^{\mu\nu}h^{\mu\nu};
canonicalise(_);
</code></pre>
<p>which then gives $-u^{\mu} u^{\nu} f^{\mu\nu}$.</p>
<p>(I have taken the liberty of removing the question marks on the indices (you don't need them)).</p>
General questionshttp://cadabra.science/qa/1368/usage-of-canonicalise?show=1371#a1371Sat, 12 Oct 2019 10:15:52 +0000Answered: use of substitute
http://cadabra.science/qa/1354/use-of-substitute?show=1365#a1365
<p>\mu,\nu::Coordinate;<br>
a,b,c::Coordinate;<br>
F:=F(a,b,c);<br>
A:=A(\mu,\nu);<br>
B:=B(\mu,\nu);<br>
C:=C(\mu,\nu);<br>
Seems to work</p>
<p>substitute(F, $a -> A$);<br>
substitute(F, $b -> B$);<br>
substitute(F, $c -> C$);<br>
Also seems to work</p>
<p>I tried this example from the site:<br>
<a rel="nofollow" href="https://cadabra.science/manual/PartialDerivative.html">https://cadabra.science/manual/PartialDerivative.html</a></p>
<p>\tau::Coordinate;<br>
\partial{#}::Derivative(\tau);<br>
f::Depends(\tau);<br>
ex:= \partial{f g};<br>
unwrap(ex);</p>
<p>It returns 0 instead of g∂f</p>
General questionshttp://cadabra.science/qa/1354/use-of-substitute?show=1365#a1365Sun, 06 Oct 2019 10:57:39 +0000Answered: Canonicalise and dummy indices
http://cadabra.science/qa/1360/canonicalise-and-dummy-indices?show=1361#a1361
<p>Use the <code>position=independent</code> attribute to <code>Indices</code>, so </p>
<pre><code>{\mu, \nu}::Indices(vector, position=independent);
ex:= v^{\mu} G_{\mu \nu} v^{\nu};
canonicalise(_);
</code></pre>
General questionshttp://cadabra.science/qa/1360/canonicalise-and-dummy-indices?show=1361#a1361Fri, 04 Oct 2019 10:17:52 +0000is it possible to have two types of epsilon tensors?
http://cadabra.science/qa/1348/is-it-possible-to-have-two-types-of-epsilon-tensors
<p>Hi,</p>
<p>I would like to define two types (if I think properly even more) of epsilon tensors which would not interfere with each other when running "epsilon<em>to</em>delta". I thought that if I define each epsilon tensor with its own "delta" (like \delta and \bar{\delta} respectively) it will work, but that's actually not true. Is there a way to do this?</p>
<p>Thanks,<br>
Andrei</p>
<p>Here is the notebook I used</p>
<pre><code>\dalpha::LaTeXForm("\dot{\alpha}").
\dbeta::LaTeXForm("\dot{\beta}").
\bdelta{#}::LaTeXForm("\bar{\delta}").
{\dot{#}, \bar{#}}::Symbol;
{\alpha, \beta, \gamma}::Indices(chiral, position=fixed);
{\dalpha, \dbeta}::Indices(antichiral, position=fixed);
{\alpha, \beta, \gamma, \delta}::Integer(1..2);
{\dalpha, \dbeta}::Integer(1..2);
\delta{#}::KroneckerDelta(chiral);
\bdelta{#}::KroneckerDelta(antichiral);
\epsilon_{\alpha \beta}::EpsilonTensor(delta=\delta);
\epsilon^{\dalpha \dbeta}::EpsilonTensor(delta=\bdelta);
</code></pre>
<p>And now the epsilons</p>
<pre><code>ex:=\epsilon_{\alpha \beta} \epsilon^{\dalpha \dbeta};
epsilon_to_delta(_);
</code></pre>
<p>which yield a mixed index \delta.</p>
General questionshttp://cadabra.science/qa/1348/is-it-possible-to-have-two-types-of-epsilon-tensorsThu, 26 Sep 2019 13:43:03 +0000"Signature" of the epsilon tensor
http://cadabra.science/qa/1344/signature-of-the-epsilon-tensor
<p>Hi community.</p>
<p>It is (more or less) known that when defining a metric one can provide a parameter <code>signature</code>, e.g +1 for Riemannian metrics or -1 for Lorentzian metrics; and it is also known that one can parametrise the epsilon tensor with a metric.</p>
<p>I'm interested, however, in a generic epsilon tensor defined for a Lorentzian signature... without specifying a metric (because I want to consider spacetimes with diferent dimensionality). I tried the following, and it seems to work:</p>
<pre><code>\delta{#}::KroneckerDelta.
\epsilon{#}::EpsilonTensor(delta=-\delta).
</code></pre>
<h3>Question</h3>
<p>Is the above proposal equivalent to assigning a <code>signature = -1</code> to the epsilon?</p>
General questionshttp://cadabra.science/qa/1344/signature-of-the-epsilon-tensorMon, 23 Sep 2019 16:55:39 +0000Answered: How to obtain the geodesic equation from the action?
http://cadabra.science/qa/1331/how-to-obtain-the-geodesic-equation-from-the-action?show=1343#a1343
<p>So far there is no build-in command that <em>spits</em> the geodesic equations. </p>
<p>However, I'd like to clarify: the geodesic equation can be obtain by extremising (one half of) the <em>Riemannian</em> line element for a given metric, and it is given by the expression stated by @skyfold in the comments of the question.</p>
<p>It is, nonetheless, straightforward to obtain the differential equations for the geodesic---once one knows the metric---. The only <em>nontrivial</em> ingredient is to define the (Levi-Civita) connection in terms of the metric, and calculate the coefficients. This has been shown in the notebook about <a rel="nofollow" href="https://cadabra.science/notebooks/schwarzschild.html">Schwarzschild spacetime</a>.</p>
General questionshttp://cadabra.science/qa/1331/how-to-obtain-the-geodesic-equation-from-the-action?show=1343#a1343Mon, 23 Sep 2019 16:45:17 +0000Answered: Collecting scalar terms in expressions with `DifferentialForms`
http://cadabra.science/qa/1287/collecting-scalar-terms-expressions-with-differentialforms?show=1333#a1333
<p>Current github/master can now do</p>
<pre><code>{f,g}::DifferentialForm(degree=0).
{V, W}::DifferentialForm(degree=1).
foo := f V ^ g W;
unwrap(_);
</code></pre>
<p>producing $f g V \wedge W$. Enjoy (and let me know if things don't work properly).</p>
Feature requestshttp://cadabra.science/qa/1287/collecting-scalar-terms-expressions-with-differentialforms?show=1333#a1333Sun, 22 Sep 2019 13:18:21 +0000Answered: Dotted indices are not substituted correctly
http://cadabra.science/qa/1327/dotted-indices-are-not-substituted-correctly?show=1332#a1332
<p>A fix for this bug is now on the master branch on github. If you encounter related bugs with 'accented' indices (as you hinted at near the end of your post), please post more details. </p>
Bug reportshttp://cadabra.science/qa/1327/dotted-indices-are-not-substituted-correctly?show=1332#a1332Sat, 21 Sep 2019 19:51:39 +0000Answered: simplify expressions in Cadabra
http://cadabra.science/qa/1317/simplify-expressions-in-cadabra?show=1318#a1318
<p>Use <code>sort_product</code> to put all factors in all products in the same order, before you <code>canonicalise</code>. The latter only changes index labels, not factor positions.</p>
General questionshttp://cadabra.science/qa/1317/simplify-expressions-in-cadabra?show=1318#a1318Sat, 14 Sep 2019 18:03:00 +0000Answered: CLI convertion from cadabra2 to LaTeX
http://cadabra.science/qa/1309/cli-convertion-from-cadabra2-to-latex?show=1311#a1311
<p>There wasn't, but there is now ;-) Check out the latest commit on github/master, build/install, and you will have a <code>cadabra2latex</code> command, which does</p>
<pre><code>cadabra2latex in.cnb out.tex
</code></pre>
<p>This will create <code>out.tex</code> from your notebook <code>in.cnb</code>, plus any <code>outnnn.png</code> files if your notebook contains plots. You should then be able to do e.g.</p>
<pre><code>pdflatex out.tex
</code></pre>
<p>to build a PDF.</p>
General questionshttp://cadabra.science/qa/1309/cli-convertion-from-cadabra2-to-latex?show=1311#a1311Thu, 12 Sep 2019 09:05:27 +0000Is it possible to define assumptions?
http://cadabra.science/qa/1310/is-it-possible-to-define-assumptions
<p>It would be useful to be able of provide extra properties to the expressions, that allow <code>Cadabra</code>, <code>SymPy</code> or <code>Mathematica</code> to improve their simplification algorithms.</p>
<p>An existing example is the property <code>Integer</code>. It could be useful to include others like <code>Real</code>, <code>Positive</code>, <code>Negative</code>, or even a sort of <code>In([<list of values>])</code></p>
<h3>Question</h3>
<p>Is any of these properties currently defined?</p>
General questionshttp://cadabra.science/qa/1310/is-it-possible-to-define-assumptionsThu, 12 Sep 2019 07:33:25 +0000Answered: Copy/Paste output from notebook
http://cadabra.science/qa/257/copy-paste-output-from-notebook?show=1308#a1308
<p>The feature is available in v.2.x since January 2018.</p>
General questionshttp://cadabra.science/qa/257/copy-paste-output-from-notebook?show=1308#a1308Wed, 11 Sep 2019 18:14:08 +0000Windows 10 version still doesn't work
http://cadabra.science/qa/1305/windows-10-version-still-doesnt-work
<p>Hi,</p>
<p>When I installed cadabra 2.2.7 in win10, I met following errors:</p>
<pre><code>-- Downloading http://ftp.gnome.org/pub/GNOME/sources/atkmm/2.24/atkmm-
2.24.2.tar.xz...
CMake Error at scripts/cmake/vcpkg_download_distfile.cmake:96 (message):
File does not have expected hash:
File path: [ D:/ProgramData/Vcpkg/vcpkg/downloads/temp/atkmm-2.24.2.tar.xz ]
Expected hash: [ 427714cdf3b10e3f9bc36df09c4b05608d295f5895fb1e079
b9bd84afdf7bf1cfdec6794ced7f1e35bd430b76f87792
df4ee63c515071a2ea6e3e51e672cdbe2 ]
Actual hash: [ 2edac66538c334ec6957e2a518d0a714c60
7655f75c838dcbe4e5f5b30c2ea87a703bc11bf4125837cd
13d520071a8ec292c93550176218ab7e195a52078f888 ]
The file may have been corrupted in transit. This can be caused by
proxies. If you use a proxy, please set the HTTPS_PROXY and HTTP_PROXY
environment variables to
"https://user:password@your-proxy-ip-address:port/".
Call Stack (most recent call first):
scripts/cmake/vcpkg_download_distfile.cmake:179 (test_hash)
ports/atkmm/portfile.cmake:6 (vcpkg_download_distfile)
scripts/ports.cmake:85 (include)
Error: Building package atkmm:x64-windows failed with: BUILD_FAILED
Please ensure you're using the latest portfiles with `.\vcpkg update`, then
submit an issue at https://github.com/Microsoft/vcpkg/issues including:
Package: atkmm:x64-windows
Vcpkg version: 2019.08.27-nohash
Additionally, attach any relevant sections from the log files above.
</code></pre>
<p>When I downloaded it from <a rel="nofollow" href="http://ftp.gnome.org/pub/GNOME/sources/atkmm/2.24/atkmm-2.24.2.tar.xz">http://ftp.gnome.org/pub/GNOME/sources/atkmm/2.24/atkmm-2.24.2.tar.xz</a> and put it to folder "downloads", following errors come up</p>
<pre><code> Starting package 1/4: atkmm:x64-windows
Building package atkmm[core]:x64-windows...
-- Using cached D:/ProgramData/Vcpkg/vcpkg/downloads/atkmm-2.24.2.tar.xz
CMake Error at scripts/cmake/vcpkg_download_distfile.cmake:96 (message):
File does not have expected hash:
File path: [ D:/ProgramData/Vcpkg/vcpkg/downloads/atkmm-2.24.2.tar.xz ]
Expected hash: [ 427714cdf3b10e3f9bc36df09c4b05608d295f5895fb1e079b9bd84afdf7bf1cfdec6794ced7f1e35bd430b76f87792df4ee63c515071a2ea6e3e51e672cdbe2 ]
Actual hash: [ 9d59ccad0c4f1bfce55a30b9f56c2eb8c9333cb6548e35052169b1558db1eaada30831424edeed1d46968b40068348a3d7e91168f519513317b1f7b9e04a7fc9 ]
Please delete the file and retry if this file should be downloaded again.
Call Stack (most recent call first):
scripts/cmake/vcpkg_download_distfile.cmake:107 (test_hash)
ports/atkmm/portfile.cmake:6 (vcpkg_download_distfile)
scripts/ports.cmake:85 (include)
Error: Building package atkmm:x64-windows failed with: BUILD_FAILED
Please ensure you're using the latest portfiles with `.\vcpkg update`, then
submit an issue at https://github.com/Microsoft/vcpkg/issues including:
Package: atkmm:x64-windows
Vcpkg version: 2019.08.27-nohash
</code></pre>
<p>How to solve it?</p>
Installation troublehttp://cadabra.science/qa/1305/windows-10-version-still-doesnt-workTue, 10 Sep 2019 04:14:13 +0000Answered: meaning symbol action[1][0][0][2]
http://cadabra.science/qa/1293/meaning-symbol-action-1-0-0-2?show=1304#a1304
<p>Hi skyfold,</p>
<p>as explained by doxdrum, the </p>
<pre><code>action[1][0][0][2]
</code></pre>
<p>command selects the part of expression we are interested to. <br>
In particular, the command extracts the terms not represented by total derivatives.</p>
<p>I note that in general this approach is not very stable because it depends on the position [1][0][0][2] of the terms in the expression. If they had had a change of position or the expression had a different manipulation, the command would fail.</p>
<p>Mattia</p>
General questionshttp://cadabra.science/qa/1293/meaning-symbol-action-1-0-0-2?show=1304#a1304Sat, 07 Sep 2019 14:11:07 +0000Answered: Providing a `Weight` to a `Derivative`
http://cadabra.science/qa/1297/providing-a-weight-to-a-derivative?show=1302#a1302
<p>If you want a derivative to inherit a weight <em>and</em> have a weight of that same type itself, you need to use the <code>self</code> parameter to <code>WeightInherit</code>. So</p>
<pre><code>\nabla{#}::WeightInherit(label=order, self=1, type=multiplicative);
</code></pre>
<p>(and drop the <code>Weight</code> property). The type should be <code>multiplicative</code>, which is a confusing way to say that the weights of the child node of the derivative should be combined as if they had been sitting in a product, that is, they should be added up.</p>
<p>(<code>type=additive</code> means that the weights of the children are handled as if the children are sitting in a sum, that is, they should all be equal).</p>
Feature requestshttp://cadabra.science/qa/1297/providing-a-weight-to-a-derivative?show=1302#a1302Thu, 05 Sep 2019 20:59:33 +0000Fierz (Request)
http://cadabra.science/qa/1301/fierz-request
<p>Hi everyone,</p>
<p>Is there a way to perform a Fierz transformation on a product of <strong>two</strong> spinors?</p>
<p>Thanks.</p>
<p>Edit: </p>
<p>For example, if we have the majonara spinors $\chi^{\sigma} = \bar{\chi} = \bar{\lambda} P_{L}$ and $\varphi_{\alpha} = \varphi = P_{L} \chi$, where $P_{L} = \frac{1}{2} (1 + \gamma_{*}) $, the fierz identity for $\varphi \bar{\chi}$ is $ \varphi \bar{\chi} = -\frac{1}{2} P_{L} (\bar{\lambda} P_{L} \chi) + \frac{1}{8} P_{L} (\gamma_{\mu \nu} \bar{\lambda} \gamma^{\mu \nu} P_{L} \chi)$.</p>
Feature requestshttp://cadabra.science/qa/1301/fierz-requestWed, 04 Sep 2019 13:14:46 +0000Answered: Extending zoom() function
http://cadabra.science/qa/1284/extending-zoom-function?show=1300#a1300
<p>The fact that <code>zoom(smth,$ a Q?? $)</code> does not match a single term <code>a</code> is intended behaviour, but of course that does not help you. This should have been possible by using multiple patterns in the same zoom, but that does not work at the moment. I have opened an issue at <a rel="nofollow" href="https://github.com/kpeeters/cadabra2/issues/161.">https://github.com/kpeeters/cadabra2/issues/161.</a></p>
Feature requestshttp://cadabra.science/qa/1284/extending-zoom-function?show=1300#a1300Tue, 03 Sep 2019 13:36:13 +0000Answered: Cadabra on Raspberry Pi 3
http://cadabra.science/qa/1298/cadabra-on-raspberry-pi-3?show=1299#a1299
<p>The Raspberry Pi 3 has CPU architecture 'armv7l', while all the packages I distribute are built for 'amd64'. While it is possible to do a cross-compile, I have never attempted that with Cadabra's build system. I may give it a quick shot by playing with CPACK's parameters, but I don't have time to do much more.</p>
<p>If you have experience cross-compiling, you may want to give that a shot yourself. Or perhaps someone else here has attempted this?</p>
Installation troublehttp://cadabra.science/qa/1298/cadabra-on-raspberry-pi-3?show=1299#a1299Mon, 02 Sep 2019 17:39:49 +0000Answered: Replace a list of statements with a cycle
http://cadabra.science/qa/1274/replace-a-list-of-statements-with-a-cycle?show=1278#a1278
<p>You can't do this with a straightforward <code>eval</code>, because that function does not pre-parse the Cadabra input into Python input. But if you realise that the <code>::</code> notation gets translated into a simple function call, then it's a relatively simple thing to do yourself:</p>
<pre><code>for i in range(20):
LaTeXForm(Ex(r'\a'+str(i)+r'{#}'), Ex(r'"\alpha_{'+str(i)+r'}"') )
</code></pre>
<p>The only tricky thing here is the quotes in the 2nd <code>Ex</code>: oyu need the single quote to generate a string, and then the double quote inside that so that Cadabra's <code>LaTeXForm</code> property gets fed a string too, not a maths expression.</p>
<p>Granted, this would be nice to have in a cleaner notation, but it gets the job done.</p>
General questionshttp://cadabra.science/qa/1274/replace-a-list-of-statements-with-a-cycle?show=1278#a1278Wed, 28 Aug 2019 20:50:14 +0000Manipulating matrix valued differential forms
http://cadabra.science/qa/1276/manipulating-matrix-valued-differential-forms
<p>Dear community, I'm trying to manipulate matrix valued differential forms. By academic deformation, I'm used to work in models with extra dimensions (say five to analyse the simplest case).</p>
<p>The problem I'm having is with the order of indices and elements of the expressions.</p>
<p>Below the calculations:</p>
<h2>Example of notebook</h2>
<h3>Some initial definitions</h3>
<pre><code>{A,B,C,L,M,N,P,Q}::Indices(full,position=independent);
{\alpha,\beta,\mu,\nu,\lambda,\rho,\sigma}::Indices(position=independent, parent=full);
d{#}::ExteriorDerivative.
d{#}::LaTeXForm("\mathrm{d}").
\delta{#}::KroneckerDelta.
G_{M N}::Metric(signature=-1).
G^{M N}::InverseMetric.
\epsilon{#}::EpsilonTensor(metric=G);
</code></pre>
<h3>Notation and properties</h3>
<pre><code>eh{#}::LaTeXForm("\hat{e}").
oh{#}::LaTeXForm("\hat{\omega}").
Rh{#}::LaTeXForm("\hat{R}").
Th{#}::LaTeXForm("\hat{T}").
{eh^{A?}, oh^{A? B?}}::DifferentialForm(degree=1);
{Th^{A?}, Rh^{A? B?}}::DifferentialForm(degree=2);
{oh^{A? B?}, Rh^{A? B?}}::AntiSymmetric.
Rh^{A? B?}::SelfCommuting.
eh^{A?}::SelfAntiCommuting.
{\epsilon{#}, Rh^{4 B}, Rh^{A B}, eh^{m}, eh^{4}}::SortOrder;
</code></pre>
<h3>Working a term</h3>
<pre><code>Lambda := \epsilon_{A B C L M} eh^{A} ^ eh^{B} ^ eh^{C} ^ eh^{L} ^ eh^{M};
split_index(Lambda, $M, m, 4$, repeat = True)
sort_product(_)
canonicalise(_);
</code></pre>
<p>The result is shown in the <br>
<img src="https://imge.to/i/vv77H4" alt="image"></p>
<h2>Discussion</h2>
<p>As you can see, the wedge product is not sorted properly, nor the indices!<br>
the right result should be</p>
<p>$$\epsilon_{a b c l m} \hat{e}^{m}\wedge \hat{e}^{a}\wedge \hat{e}^{b}\wedge \hat{e}^{c}\wedge \hat{e}^{l} - 5\epsilon_{4 a b c l} \hat{e}^{l}\wedge \hat{e}^{a}\wedge \hat{e}^{b}\wedge \hat{e}^{c}\wedge \hat{e}^{4}.$$</p>
<p>Any suggestion on how to manipulate correctly these expressions?</p>
<hr>
<p><strong>Update:</strong> Looking at the source code I found that the algorithm <code>indexsort</code>is implemented, but the problem persists. It seems to be a "bug" with the <code>sort_product</code> and <code>canonicalise</code> algorithms on differential forms.</p>
General questionshttp://cadabra.science/qa/1276/manipulating-matrix-valued-differential-formsWed, 28 Aug 2019 20:09:48 +0000Answered: Improper handling of fractions
http://cadabra.science/qa/1273/improper-handling-of-fractions?show=1275#a1275
<p>Thanks for reporting this, and for doing the digging! Yes, this is caused by a bug in the ping-pong procedure between Cadabra's internal representation and Sympy. But in fact it goes deeper: it has to do with the fact that Cadabra would not always simplify rational expressions to canonical form.</p>
<p>I have pushed a partial fix for this to the <code>fix/collectcomponents</code> branch on github. Feel free to test (it does do the right thing for your example above, but I have had no time to do more testing and checking). </p>
Bug reportshttp://cadabra.science/qa/1273/improper-handling-of-fractions?show=1275#a1275Tue, 27 Aug 2019 21:58:14 +0000Differential forms --- on a subspace???
http://cadabra.science/qa/1271/differential-forms-on-a-subspace
<p>Dear developers and community in general.</p>
<p>So far, there is a tutorial about the use of differential forms within <code>cadabra</code>, but there is no manual for their related properties.</p>
<p>I've like to know whether it is possible to define forms on a space (or subspace).</p>
<h3>Example <em>of desired behaviour</em></h3>
<pre><code>{a,b,c}::Indices(space);
{e^{a}, \omega^{a}_{b}}::DifferentialForm(degree=1, space);
</code></pre>
<p>or possibly something like</p>
<pre><code>{a,b,c}::Indices.
{x,y}::Coordinate(space);
{e^{a}, \omega^{a}_{b}}::DifferentialForm(degree=1, space);
</code></pre>
<p>to denote that $$e^a = e^a<em>x dx + e^a</em>y dy,$$ despite the possible values of the indices.</p>
<h3>Question</h3>
<p>Is something like this implemented? </p>
General questionshttp://cadabra.science/qa/1271/differential-forms-on-a-subspaceThu, 22 Aug 2019 08:39:12 +0000Answered: Build fails on Ubuntu 19.04, unspecified reference to boost::system::generic_category().
http://cadabra.science/qa/1268/fails-ubuntu-unspecified-reference-system-generic_category?show=1269#a1269
<p>I have just pushed a change to github related to boost. Can you give that another shot and let me know?</p>
Installation troublehttp://cadabra.science/qa/1268/fails-ubuntu-unspecified-reference-system-generic_category?show=1269#a1269Tue, 20 Aug 2019 15:55:25 +0000Answered: Failure of running cadabra on windows.
http://cadabra.science/qa/1259/failure-of-running-cadabra-on-windows?show=1267#a1267
<p>We are aware of this issue. What <em>may</em> help is to make sure that your <code>PYTHONPATH</code> and <code>PYTHONHOME</code> environment variables are pointing to Anaconda's installation directory. So if you installed Anaconda in <code>C:\Users\Marie\Anaconda3</code>, then set both of these variables to that path. On Windows10, click 'start', search for and start 'Advanced System Settings', click the 'Environment Variables' somewhere near the bottom.</p>
<p>A future update will do this for you automatically, but at the moment an issue with Microsoft's packaging system 'vcpkg' prevents us from generating a new installer.</p>
Bug reportshttp://cadabra.science/qa/1259/failure-of-running-cadabra-on-windows?show=1267#a1267Tue, 20 Aug 2019 10:44:06 +0000Problems with combine(_)
http://cadabra.science/qa/1264/problems-with-combine-_
<p>I found two problems in the 'combine(_)' algorithm.</p>
<p>The first is that it does not take into account the commuting rules of the objects:</p>
<pre><code>{m,n,o,p}::Indices.
{x,y,w,z}::Indices.
a::ImplicitIndex(a^{m}).
b::ImplicitIndex(b_{m}).
{a{#},b{#}}::AntiCommuting.
ex:= a b;
explicit_indices(_);
combine(_);
</code></pre>
<p>The output for this code is the following.</p>
<blockquote>
<p>a b<br>
a^{m} b_{m}<br>
(b a)</p>
</blockquote>
<hr>
<p>The second problem is that it seems that it is not possibile to make some indices implicit, unless they are in the order lower-upper position, respectively. For example:</p>
<pre><code>{\alpha, \beta, \gamma, \delta}::Indices.
a::ImplicitIndex(a^{\alpha}).
M::ImplicitIndex(M_{\alpha \beta}).
ex:= a M a;
explicit_indices(_);
combine(_);
</code></pre>
<p>The output in this case is:</p>
<blockquote>
<p>a M a<br>
a^{\alpha} M<em>{\alpha \beta} a^{\beta}<br>
a^{\alpha} M</em>{\alpha \beta} a^{\beta}</p>
</blockquote>
<p>combine(_) does not do anything to the expression.</p>
<hr>
<p>Thanks for your help in advance.</p>
Bug reportshttp://cadabra.science/qa/1264/problems-with-combine-_Mon, 19 Aug 2019 13:09:30 +0000Answered: canonicalise with calagraphic font
http://cadabra.science/qa/1254/canonicalise-with-calagraphic-font?show=1255#a1255
<p>Cadabra has considerable flexibility in defining symbols, but <code>{\cal F}</code> goes a bit too far. What happens here is that this expression gets interpreted as the product of <code>\cal</code> and <code>F</code>, and then this gets indices added to it. Then all hell breaks loose... Granted, some kind of error message would probably have helped you here.</p>
<p>The easiest way around this is to do</p>
<pre><code>calF_{a b}::AntiSymmetric;
calF_{a b}::LaTeXForm("{\cal F}").
</code></pre>
<p>and then</p>
<pre><code>example2:= calF_{a b} calF_{c d} - calF_{a c} calF_{b d} ;
</code></pre>
<p>This will display the way you want because of the <code>LaTeXForm</code> property, and saves some typing as well.</p>
Bug reportshttp://cadabra.science/qa/1254/canonicalise-with-calagraphic-font?show=1255#a1255Fri, 16 Aug 2019 17:08:28 +0000Answered: Substitution of tensors - Einstein equations
http://cadabra.science/qa/1251/substitution-of-tensors-einstein-equations?show=1252#a1252
<p>That 'weird' equation does look ok, but it's perhaps a bit of an unusual notation. Can you run <code>collect_components</code> after that, and let me know if that makes more sense? </p>
<p>The logic behind all this is that Cadabra has the concept of an 'anonymous component tensor', which is what you get when you substitute values for components. Such a tensor is displayed as a 'box' with the indices of the original tensor, and then a list of all components following the large bracket. In this way you can have expressions which are 'half evaluated' (as you noticed in your first picture, where the metric has not yet been substituted).</p>
<p>We are working on making this somewhat less scary to look at, but until that work is done, it usually helps to 'collect all anonymous tensors in a sum', which is what <code>collect_components</code> does.</p>
General questionshttp://cadabra.science/qa/1251/substitution-of-tensors-einstein-equations?show=1252#a1252Fri, 16 Aug 2019 15:30:25 +0000Derivatives depend on index position
http://cadabra.science/qa/1250/derivatives-depend-on-index-position
<p>Hi,</p>
<p>I noticed recently that <br>
- the dependence of an object only includes the given position of the index<br>
and also that<br>
- objects with derivatives cannot change their index-position<br>
if the index position is given as fixed.</p>
<p>For example, the Exp in the following gives zero, because only A with an upper index depends on the derivative:</p>
<pre><code>{\mu,\nu}::Indices(position=fixed);
{\mu,\nu}::Integer(0..3);
\partial{#}::PartialDerivative;
A^\mu::Depends(\partial{#});
Exp:= \partial^{\mu}{A_\nu};
unwrap(_);
</code></pre>
<p>Of course I could just make A dependent on \partial for lowercase indices as well or just for every index position via </p>
<pre><code>A{#}::Depends(...);
</code></pre>
<p>but it still strikes me as odd.</p>
<p>Secondly, once I have defined objects with derivatives, the index position does not change through the use of canonicalise. So for example</p>
<pre><code>Exp:= \partial_{\mu}{A^\mu} - \partial^{\mu}{A_\mu};
canonicalise(_);
</code></pre>
<p>gives not zero as expected. And even if I derive a scalar, its index is fixed, so</p>
<pre><code>Exp:= A^\mu \partial_{\mu}{B} - A_\mu \partial^{\mu}{B};
canonicalise(_);
</code></pre>
<p>does not give zero.</p>
<p>I usually don't want to think about the position of dummy indices. So if it would be possible to give the index positions of derivatives a bit more freedom I would be very grateful!</p>
<p>Cheers,<br>
Karim</p>
Bug reportshttp://cadabra.science/qa/1250/derivatives-depend-on-index-positionFri, 16 Aug 2019 08:29:19 +0000Answered: How will I get the number of terms in an object in Cadabra 2?
http://cadabra.science/qa/1248/how-will-i-get-the-number-of-terms-in-an-object-in-cadabra-2?show=1249#a1249
<p>First of all, you cannot use <code>Ex</code> (with a capital <code>E</code>) as a name for an expression, because <code>Ex</code> is the name of the Cadabra expression object. Secondly, you cannot add pre-fix superscripts like this; the best you can do there is to use the <code>LaTeXForm</code> property. So you can do</p>
<pre><code>R1{#}::LaTeXForm("{}^{1}R").
ex:= R1_{\mu\nu};
</code></pre>
<p>Now what do you wan to do next? This expression clearly only contains one term. Did you want to compute it for a particular metric and then determine the number of non-zero components?</p>
General questionshttp://cadabra.science/qa/1248/how-will-i-get-the-number-of-terms-in-an-object-in-cadabra-2?show=1249#a1249Wed, 14 Aug 2019 10:50:46 +0000Answered: Assigning the result of `get_component`
http://cadabra.science/qa/1243/assigning-the-result-of-get_component?show=1244#a1244
<p>The <code>get_component</code> function returns a Python object, which you can directly assign to another symbol, e.g. <code>A00</code>. So a complete example would be</p>
<pre><code>from cdb.core.component import *
{t,x}::Coordinate;
{i,j}::Indices(values={t,x});
ex:= a_{i};
evaluate(ex, $a_{t}=1, a_{x}=2$);
A00=get_component(ex, $x$)
</code></pre>
<p>and then <code>A00</code> is a cadabra <code>Ex</code> object as usual.</p>
General questionshttp://cadabra.science/qa/1243/assigning-the-result-of-get_component?show=1244#a1244Tue, 13 Aug 2019 13:05:03 +0000A documentation bug
http://cadabra.science/qa/1242/a-documentation-bug
<p>In the documentation page <a rel="nofollow" href="https://cadabra.science/manual/cdb/core/component.html">component</a>, there is no mention to the fact that one have to import the function</p>
<pre><code>from cdb.core.component import get_component
</code></pre>
<p>At least I have to do it.</p>
Bug reportshttp://cadabra.science/qa/1242/a-documentation-bugTue, 13 Aug 2019 11:02:22 +0000Kronecker $\delta$ for Indices of different dimensions
http://cadabra.science/qa/1240/kronecker-%24-delta%24-for-indices-of-different-dimensions
<p>Hi,<br>
I have $\delta$-symbols involving a color index $a$ that runs from 1 to 3 and a Euclidian index $\mu$ from 1 to 4.</p>
<pre><code>{\mu,\nu}::Indices(Euklid, position=free).
{\mu,\nu}::Integer(1..4).
{a,b}::Indices(Color, position=independent).
{a,b}::Integer(1..3).
\delta_{#}::KroneckerDelta.
</code></pre>
<p>But when I try to contract them like in</p>
<pre><code>ex := \delta_{a \mu} \delta_{a \mu} ;
eliminate_kronecker(ex);
</code></pre>
<p>I get 4 but it should be 3. When I reverse the order of the indices I get the correct number:</p>
<pre><code>ex2 := \delta_{\mu a} \delta_{\mu a} ;
eliminate_kronecker(ex2);
</code></pre>
<p>This gives 3.</p>
<p>I suppose cadabra contracts the first two indices first so in the first case we get</p>
<p>$\delta<em>{a \mu} \delta^{a \mu} = \delta</em>{\mu}^{\mu} = 4$</p>
<p>and in the second it becomes </p>
<p>$\delta<em>{\mu a} \delta^{\mu a} = \delta</em>{a}^{a} = 3$.</p>
<p>Maybe this behavior could be avoided by always first contracting the indices of higher dimension? In the meantime, can somebody think of a workaround? </p>
<p>In the interest of completeness:</p>
<pre><code>ex3 := \delta_{\mu a} \delta_{a \mu} ;
eliminate_kronecker(ex3);
</code></pre>
<p>gives 4 and </p>
<pre><code>ex4 := \delta_{a \mu} \delta_{\mu a} ;
eliminate_kronecker(ex4);
</code></pre>
<p>returns 3.</p>
<p>Thank you</p>
<p>EDIT: Directly after asking I think I found a workaround by adding a substitution to the post_process function that sorts the indices such that the Euclidian one gets contracted first. </p>
<pre><code>def post_process(ex):
substitute( ex, $\delta_{a \mu} = \delta_{\mu a}$ )
</code></pre>
Bug reportshttp://cadabra.science/qa/1240/kronecker-%24-delta%24-for-indices-of-different-dimensionsMon, 12 Aug 2019 08:07:36 +0000Answered: Fierz identities with Majorana fermions in dim=4 and chirality
http://cadabra.science/qa/1211/fierz-identities-with-majorana-fermions-dim-and-chirality?show=1239#a1239
<p>The chiral matrix $\gamma^5$ can be defined using the epsilon tensor. See my answer to <a rel="nofollow" href="https://cadabra.science/qa/783/gamma_5-matrix">this post</a></p>
Feature requestshttp://cadabra.science/qa/1211/fierz-identities-with-majorana-fermions-dim-and-chirality?show=1239#a1239Fri, 09 Aug 2019 17:30:10 +0000Answered: the command asym does not work online.
http://cadabra.science/qa/1235/the-command-asym-does-not-work-online?show=1236#a1236
<p>It does if you write the product <code>A B C</code> with spaces, and add the required dollar signs, so</p>
<pre><code>ex:= A B C;
asym(_, $A, B, C$);
</code></pre>
<p>Ditto for indices; do not write <code>A_{ab}</code> but use <code>A_{a b}</code>:</p>
<pre><code>ex:= A_{a b} C_{d};
asym(_, $_{a}, _{b}, _{d}$);
</code></pre>
General questionshttp://cadabra.science/qa/1235/the-command-asym-does-not-work-online?show=1236#a1236Wed, 07 Aug 2019 20:53:04 +0000Variation of \sqrt terms (bug)
http://cadabra.science/qa/1234/variation-of-sqrt-terms-bug
<p>Hello, I think I have found a bug as shown below;</p>
<p><img src="https://cdn.mathpix.com/snip/images/0FVJQdDBXr-NmbkWn8GXJ59yaXLez_tJ3_K-raMqN2Y.original.fullsize.png" alt="enter image description here"></p>
<p>Have a nice day.</p>
Bug reportshttp://cadabra.science/qa/1234/variation-of-sqrt-terms-bugWed, 07 Aug 2019 09:20:47 +0000Answered: How can I define complex scalar field in Cadabra?
http://cadabra.science/qa/1225/how-can-i-define-complex-scalar-field-in-cadabra?show=1230#a1230
<p>I have solved the problem by taking \phi and \chi (for \phi*), varying the action wrt \phi and \chi. Thanks to my supervisor who suggested me this, which is working perfectly fine , please let me know if there is any other way. <br>
Thanks for your concern.</p>
General questionshttp://cadabra.science/qa/1225/how-can-i-define-complex-scalar-field-in-cadabra?show=1230#a1230Mon, 05 Aug 2019 08:52:35 +0000Supergravity calculation
http://cadabra.science/qa/1222/supergravity-calculation
<p>Hi everyone, here I tried to make some supergravity calculations for N=1, D=4. I needed to use the "substitute" command a lot. Any suggestions to make it more neat and tidy are very welcome. Also is there any other way than using the substitute command to make the cubic expressions vanish?</p>
<pre><code>D{#}::Derivative;
\bar{D{#}}::Derivative;
\bar{#}::DiracBar;
{m,n,p,q,r,s,t,u,m#}::Indices(flat);
{m,n,p,q,r,s,t,u,m#}::Integer(0..3);
{\mu,\nu,\rho,\sigma,\kappa,\lambda,\alpha,\beta}::Indices(curved,position=fixed);
{\mu,\nu,\rho,\sigma,\kappa,\lambda,\alpha,\beta}::Integer(0..3);
e^{m \mu}::Vielbein;
e^{m}_{\mu}::Vielbein;
e_{m \mu}::InverseVielbein;
e_{m}^{\mu}::InverseVielbein;
e::Determinant(e_{m \mu});
e::Determinant(e_{m}^{\mu});
e::Determinant(e^{m}_{\mu});
e::Determinant(e^{m \mu});
g^{\mu\nu}::InverseMetric;
g_{\mu\nu}::Metric;
R_{\mu \nu \rho \sigma}::RiemannTensor;
{ \epsilon,\psi_{\mu} }::Spinor(dimension=4, type=Majorana);
\Gamma_{#{m}}::GammaMatrix(metric=\delta);
{ \psi_{\mu},\epsilon }::AntiCommuting;
{ \psi_{\mu}}::SelfAntiCommuting;
{ \epsilon, \psi_{\mu}}::SortOrder;
\Gamma_{#}::Depends(\bar{#});
{ \psi_{\mu}, \epsilon ,\bar{\epsilon}}::Depends(D{#});
</code></pre>
<p>First, we write our action as two parts:</p>
<pre><code>S32:= \int{- 1/2 e \bar{\psi_\mu} \Gamma^{\mu\nu\rho} D_{\nu}{\psi_{\rho}}}{x};
</code></pre>
<p><img src="https://cdn.mathpix.com/snip/images/WBO0XVmZ957Ck23XshriFYPw8sk_IavaPRfTe6xjs_8.original.fullsize.png" alt="https://cdn.mathpix.com/snip/images/WBO0XVmZ957Ck23XshriFYPw8sk_IavaPRfTe6xjs_8.original.fullsize.png"></p>
<pre><code>S2:= \int{ 1/2 e e_{m}^{\mu} e_{n}^{\nu} R_{\mu \nu}^{ m n}}{x};
</code></pre>
<p><img src="https://cdn.mathpix.com/snip/images/h2dYl0E3jVqvItigciHp8umJUvShdq038IhN7YwrvXU.original.fullsize.png" alt="https://cdn.mathpix.com/snip/images/h2dYl0E3jVqvItigciHp8umJUvShdq038IhN7YwrvXU.original.fullsize.png"></p>
<p>Now we define our SUSY rules. (I did not include the variation of $e_{m}^{\mu}$, because it only leads to cubic expressions (for the action S32) and they vanish.) </p>
<pre><code>susy32:= {e -> 1/2 e {\bar{\epsilon} \Gamma^\sigma \psi_\sigma} , \psi_\mu -> D_{\mu}{\epsilon}};
</code></pre>
<p><img src="https://cdn.mathpix.com/snip/images/3ENSGl5lXEnFkG0CbxXkqF9jkBDdVHQapmZqSFW-Vik.original.fullsize.png" alt="https://cdn.mathpix.com/snip/images/3ENSGl5lXEnFkG0CbxXkqF9jkBDdVHQapmZqSFW-Vik.original.fullsize.png"></p>
<pre><code>susy2:= {e -> 1/2 e {\bar{\epsilon} \Gamma^\sigma \psi_\sigma}, e_{m}^{\mu} -> -1/2 {\bar{\epsilon}} \Gamma^{\mu} \psi_m };
</code></pre>
<p><img src="https://cdn.mathpix.com/snip/images/Pm5hCnqkWUHJ8Ot0ZuBwxa0dLr9R35F8YNUOm_YZ61M.original.fullsize.png" alt="https://cdn.mathpix.com/snip/images/Pm5hCnqkWUHJ8Ot0ZuBwxa0dLr9R35F8YNUOm_YZ61M.original.fullsize.png"></p>
<p>Let us start to our calculations with the S32 part. First we take the<br>
variation of it, according to the rules we defined above.</p>
<pre><code>vS32= vary(S32, susy32);
</code></pre>
<p><img src="https://cdn.mathpix.com/snip/images/IpcXrXB4kdonmOLFBnn2i-Fjmw7ErAjddfBdpB8YF0E.original.fullsize.png" alt="https://cdn.mathpix.com/snip/images/IpcXrXB4kdonmOLFBnn2i-Fjmw7ErAjddfBdpB8YF0E.original.fullsize.png"></p>
<p>Here, I need to erase the bar above the $D_{\mu}$ term because the<br>
integrate by parts command does not work properly with the bar.</p>
<pre><code>substitute(_,$\bar{D_{#??}{\epsilon}} -> D_{#??}{\bar{\epsilon}} $);
</code></pre>
<p><img src="https://cdn.mathpix.com/snip/images/7Fp8dBqCXObH5ycAe5MYH6eKEns8V7GdEcQejeteBy4.original.fullsize.png" alt="https://cdn.mathpix.com/snip/images/7Fp8dBqCXObH5ycAe5MYH6eKEns8V7GdEcQejeteBy4.original.fullsize.png"></p>
<p>The first term here, is a cubic expression therefore it must be<br>
vanish.</p>
<pre><code>substitute(_, $\bar{\epsilon}*A?? -> 0$);
</code></pre>
<p><img src="https://cdn.mathpix.com/snip/images/Eg3hn2L1mcsnQIy40RGuf63usfY1k1u9EwomtVAefAA.original.fullsize.png" alt="https://cdn.mathpix.com/snip/images/Eg3hn2L1mcsnQIy40RGuf63usfY1k1u9EwomtVAefAA.original.fullsize.png"></p>
<p>Manipulating the equations a little bit leads us to use "Clifford<br>
algebra".</p>
<pre><code>integrate_by_parts(_, $\bar{\epsilon}$);
</code></pre>
<p><img src="https://cdn.mathpix.com/snip/images/p0dif7ueLp5tvuVwcjpAxFWaXQp77FcvxAQfw9HRxX4.original.fullsize.png" alt="https://cdn.mathpix.com/snip/images/p0dif7ueLp5tvuVwcjpAxFWaXQp77FcvxAQfw9HRxX4.original.fullsize.png"></p>
<pre><code>product_rule(_);
</code></pre>
<p><img src="https://cdn.mathpix.com/snip/images/MUbbrVzWRRx8H51ZgdY4NghEezUL5G2yIh_DggPV2-s.original.fullsize.png" alt="https://cdn.mathpix.com/snip/images/MUbbrVzWRRx8H51ZgdY4NghEezUL5G2yIh_DggPV2-s.original.fullsize.png"></p>
<p>We know that <br>
$D<em>{\mu} e = 0$<br>
and $D</em>{\mu}{\Gamma^{\mu\nu\rho}} = 0$ so<br>
we substitute it by hand.</p>
<pre><code>substitute(_,$D_{#??}{e}*A?? -> 0$);
</code></pre>
<p><img src="https://cdn.mathpix.com/snip/images/53iGZQ0DOe8JtNoFyp2P8QfhRTPF1CSMBj24OYZLYZo.original.fullsize.png" alt="https://cdn.mathpix.com/snip/images/53iGZQ0DOe8JtNoFyp2P8QfhRTPF1CSMBj24OYZLYZo.original.fullsize.png"></p>
<pre><code>substitute(_, $ D_{#??}{\Gamma^{\mu\nu\rho}}*A?? -> 0 $);
</code></pre>
<p><img src="https://cdn.mathpix.com/snip/images/3nQr0LoTJwqJQGP3dg779Oytnvxx5I8GCd1k0etIk5A.original.fullsize.png" alt="https://cdn.mathpix.com/snip/images/3nQr0LoTJwqJQGP3dg779Oytnvxx5I8GCd1k0etIk5A.original.fullsize.png"></p>
<p>Using the Clifford algebra, we can substitute the equations below;</p>
<pre><code>substitute(_, $D_{\mu}{D_{\nu}{A??} } -> 1/8 R_{\mu \nu m n} \Gamma^{m n} A??$ )
sort_spinors(_)
rename_dummies(_);
</code></pre>
<p><img src="https://cdn.mathpix.com/snip/images/2eVwLOHgFvlpqdakNsXG9YUQEnpcxAotaPOmldpfFKc.original.fullsize.png" alt="https://cdn.mathpix.com/snip/images/2eVwLOHgFvlpqdakNsXG9YUQEnpcxAotaPOmldpfFKc.original.fullsize.png"></p>
<pre><code>substitute(_, $\Gamma^{\mu \nu \rho}R_{\mu \nu m n}\Gamma^{m n} -> 4 \Gamma^{\mu}R_{\mu \nu}^{\rho \nu} + 2 \Gamma^{\rho} R_{\mu \nu}^{\nu \mu}$);
</code></pre>
<p><img src="https://cdn.mathpix.com/snip/images/NF5k5oDX-GFkrvmIT78pojyFFBbi9dhm8AvqAZDlwdQ.original.fullsize.png" alt="https://cdn.mathpix.com/snip/images/NF5k5oDX-GFkrvmIT78pojyFFBbi9dhm8AvqAZDlwdQ.original.fullsize.png"></p>
<pre><code>substitute(_, $\Gamma^{\rho \mu \nu}R_{\mu \nu m n}\Gamma^{m n} -> 4 \Gamma^{\mu}R_{\mu \nu}^{\rho \nu} + 2 \Gamma^{\rho} R_{\mu \nu}^{\nu \mu}$);
</code></pre>
<p><img src="https://cdn.mathpix.com/snip/images/Em1EQFVpOJhXYOKHp3NNaQj1m5IrtGPfBZDO3TlAFwo.original.fullsize.png" alt="https://cdn.mathpix.com/snip/images/Em1EQFVpOJhXYOKHp3NNaQj1m5IrtGPfBZDO3TlAFwo.original.fullsize.png"></p>
<p>Now, we can start to play with the S2 part of the action. Here we will<br>
take the variation and re-organize the result as shown below:</p>
<pre><code>vS2= vary(S2, susy2);
</code></pre>
<p><img src="https://cdn.mathpix.com/snip/images/TeQtL3JlNZBTOHJcRYfzibPWxWb2TIOcxKDhPrLIZVI.original.fullsize.png" alt="https://cdn.mathpix.com/snip/images/TeQtL3JlNZBTOHJcRYfzibPWxWb2TIOcxKDhPrLIZVI.original.fullsize.png"></p>
<pre><code>eliminate_vielbein(_, repeat=True)
rename_dummies(_);
</code></pre>
<p><img src="https://cdn.mathpix.com/snip/images/MS_ZCKSF21-_l-lhkUYHlsLt-kubzPesvVDgE5Qj37g.original.fullsize.png" alt="https://cdn.mathpix.com/snip/images/MS_ZCKSF21-_l-lhkUYHlsLt-kubzPesvVDgE5Qj37g.original.fullsize.png"></p>
<p>We now need to use a property of the Riemann tensor such as below;</p>
<pre><code>substitute(_, $ R_{\mu \nu}^{\mu m} -> R_{\nu \mu}^{m \mu}$);
</code></pre>
<p><img src="https://cdn.mathpix.com/snip/images/L4kDSf8gsz48rFRVMWZwBBLEqZJiK-DWZZiiwNmxoFM.original.fullsize.png" alt="https://cdn.mathpix.com/snip/images/L4kDSf8gsz48rFRVMWZwBBLEqZJiK-DWZZiiwNmxoFM.original.fullsize.png"></p>
<pre><code>canonicalise(_);
</code></pre>
<p><img src="https://cdn.mathpix.com/snip/images/am8tG1GtbFxGBoGHcYwe92Lud2XuheAjk02n05Al--I.original.fullsize.png" alt="https://cdn.mathpix.com/snip/images/am8tG1GtbFxGBoGHcYwe92Lud2XuheAjk02n05Al--I.original.fullsize.png"></p>
<pre><code>Stotal=vS32+vS2;
</code></pre>
<p><img src="https://cdn.mathpix.com/snip/images/XaHuxqwvbLzRq0RkzNhr-IQ4XVeDCuX4vBPXoPEJja0.original.fullsize.png" alt="https://cdn.mathpix.com/snip/images/XaHuxqwvbLzRq0RkzNhr-IQ4XVeDCuX4vBPXoPEJja0.original.fullsize.png"></p>
<p>This final sum must be equal to $0$, yet I couldn't accomplish to sum<br>
the integrals to show it with cadabra.</p>
<p>Thanks.</p>
General questionshttp://cadabra.science/qa/1222/supergravity-calculationTue, 30 Jul 2019 10:57:16 +0000Answered: Sigma Matrix
http://cadabra.science/qa/1217/sigma-matrix?show=1220#a1220
<p>That property never really had much use, as none of the algorithms made use of it. In other words, you still had to write out manual substitution rules for sigma products and so on. You can do the same thing in 2.x; just declare <code>\sigma^{m}</code> to be SelfNonCommuting as a starting point, then use <code>substitute</code> to work out sigma products and the like. You may want to look at the ImplicitIndices property documentation to help you convert sigma expressions with and without spinor indices.</p>
<p>We are working on a revamped spinor functionality which will include a lot more in a special package, but it's not yet done and kinda tricky to get right given all the different things people want to do with it.</p>
<p>And as always, feel free to ask here with concrete questions about how to do certain manipulations.</p>
General questionshttp://cadabra.science/qa/1217/sigma-matrix?show=1220#a1220Fri, 26 Jul 2019 09:10:56 +0000Answered: Installing Cadabra on mint 18.3 does not work
http://cadabra.science/qa/1213/installing-cadabra-on-mint-18-3-does-not-work?show=1214#a1214
<p>A recent change uses some features of gtkmm-3.20 or higher. </p>
<p>I have pushed a fix which disables this change if your system is on a lower version of gtkmm. Can you pull again from github, try to build, and let me know the result?</p>
Installation troublehttp://cadabra.science/qa/1213/installing-cadabra-on-mint-18-3-does-not-work?show=1214#a1214Mon, 22 Jul 2019 14:35:54 +0000eliminate_kronecker() with index hierarchy
http://cadabra.science/qa/1212/eliminate_kronecker-with-index-hierarchy
<p>Hello,</p>
<p>I have a problem contracting Kronecker symbols where I have parent indices and child indices. A minimal example:</p>
<pre><code>{a,b,c,d,e}::Indices(fourD, position=independent)
{a,b,c,d,e}::Integer(0..4)
{\alpha,\beta,\gamma,\delta,\epsilon}::Indices(threeD, position=independent, parent=fourD)
{\alpha,\beta,\gamma,\delta,\epsilon}::Integer(1..3)
\delta{#}::KroneckerDelta()
> ex := \gamma^{\alpha \beta} \delta^{0}_{p} \delta^{p}_{\alpha};
γ^{α β} δ^{0}_{p} δ^{p}_{α}
> eliminate_kronecker(ex);
γ^{0 β}
</code></pre>
<p>The result should be zero -- well, it actually were, if I replaced the 0 \beta part of \gamma with zero, but I have many tensors and this would be quite tedious. Also I could define manual substitution rules for contractions of deltas with different indices an then substitute a delta with mixed indices with zero. Also very tedious. Is there anything I can do so that I can just work with eliminate_kronecker()?</p>
<p>Thanks a lot!</p>
General questionshttp://cadabra.science/qa/1212/eliminate_kronecker-with-index-hierarchySat, 20 Jul 2019 20:15:17 +0000Answered: Vanishing Self-Contracted Metric
http://cadabra.science/qa/1207/vanishing-self-contracted-metric?show=1208#a1208
<p>Be careful with index positions. If you want upper and lower indices to mean something different, declare your indices with the <code>position=fixed</code> attribute. So</p>
<pre><code>{\alpha,\beta,\mu,\nu}::Indices(position=fixed);
{\alpha,\beta,\mu,\nu}::Integer(0..3);
\eta^{\mu\nu}::Metric;
\eta_{\mu\nu}::InverseMetric;
\eta_\mu^\nu::KroneckerDelta;
\eta^\mu_\nu::KroneckerDelta;
Exp:= \eta^\mu_\mu \eta^\alpha_\beta A^\beta;
eliminate_metric(_);
eliminate_kronecker(_);
</code></pre>
<p>This gives the expected answer.</p>
Bug reportshttp://cadabra.science/qa/1207/vanishing-self-contracted-metric?show=1208#a1208Mon, 15 Jul 2019 08:45:38 +0000Answered: Define a post_process to apply an operator to an equation
http://cadabra.science/qa/1205/define-a-post_process-to-apply-an-operator-to-an-equation?show=1206#a1206
<p>First of all, don't call this <code>post_process</code>; that's a reserved function which Cadabra will call after every manipulation step. </p>
<p>To do this, you need to somehow indicate where you want the 'argument' of the operator to go, otherwise a <code>\partial_{\mu\nu}</code> not acting on anything will be replaced with zero before it even makes it to the function. Try something like the code below:</p>
<pre><code>import cdb.core.manip as manip
\partial{#}::PartialDerivative;
def appop(ex, op):
t1=manip.get_lhs(ex)
t2=manip.get_rhs(ex)
o1:= @(op);
o2:= @(op);
for arg in o1:
if arg.name=='#':
arg.replace(t1)
for arg in o2:
if arg.name=='#':
arg.replace(t2)
ex.top().replace( $@(o1) = @(o2)$ )
return ex
</code></pre>
<p>You can then do</p>
<pre><code>ex:= A = B;
appop(ex, $\partial_{\mu\nu}{#}$);
</code></pre>
<p>to get the result</p>
<p>$$\partial_{\mu\nu}{A} = \partial_{\mu\nu}{B}$$</p>
<p>You may want to add some error checking code for when you feed it a single expression, not an equation.</p>
General questionshttp://cadabra.science/qa/1205/define-a-post_process-to-apply-an-operator-to-an-equation?show=1206#a1206Sat, 06 Jul 2019 19:03:17 +0000Answered: Exchange indices
http://cadabra.science/qa/1198/exchange-indices?show=1199#a1199
<p>That won't work, you can't declare <code>{a,b,c}</code> to be index set 'one' and then declare that same index set to be also called 'two', but with indices re-ordered. The order of indices in a set does not mean anything.</p>
<p>It does work with</p>
<pre><code>{k,l,m}::Indices("two");
</code></pre>
<p>as the 2nd line, but I assume that that's not what you want.</p>
<p>If your computation relies on the explicit names of dummy indices, you are probably doing something 'wrong' (in the sense of: there is a much better way to do it with Cadabra). Can you say a little bit more about what you are aiming to do?</p>
General questionshttp://cadabra.science/qa/1198/exchange-indices?show=1199#a1199Fri, 28 Jun 2019 12:10:23 +0000Answered: Apply an operator to an equation
http://cadabra.science/qa/1195/apply-an-operator-to-an-equation?show=1196#a1196
<p>Cool one. There is a subtle bug in the parser which fails on these Python names with underscores. If you replace <code>lhs_scL</code> with <code>lhsscL</code> and ditto for the rhs version, things work. Will fix, hopefully the workaround above can keep you going in the meantime.</p>
General questionshttp://cadabra.science/qa/1195/apply-an-operator-to-an-equation?show=1196#a1196Wed, 26 Jun 2019 06:38:46 +0000Answered: Graded partial differential
http://cadabra.science/qa/1188/graded-partial-differential?show=1189#a1189
<p>Assign the <code>AntiCommuting</code> property to the indices, not to the derivatives. So</p>
<pre><code>{a, b, c, d, e, f, g, h, i, j, k, l, m, n ,o, r,s,t,u,v,w,x,y,z#}::Indices(T, position=free, parent=double);
D{#}::PartialDerivative;
\xi{#}::Depends(D{#});
{a, b, c, d, e, f, g, h, i, j, k, l, m, n ,o, r,s,t,u,v,w,x,y,z#}::AntiCommuting;
</code></pre>
<p>and then</p>
<pre><code>Exp:=D_{a}{D_{b}{\xi_{c}}*\xi_{d}};
product_rule(_);
</code></pre>
<p>produces</p>
<p>$$D_{a b}{\xi_{c}} \xi_{d} + D_{b}{\xi_{c}} D_{a}{\xi_{d}}$$</p>
General questionshttp://cadabra.science/qa/1188/graded-partial-differential?show=1189#a1189Thu, 20 Jun 2019 08:18:04 +0000Answered: Poincare example evaluated twice
http://cadabra.science/qa/1186/poincare-example-evaluated-twice?show=1187#a1187
<p>What happens here is that the <code>post_process</code> function converts the <code>\commutator{#}</code> argument in the line</p>
<pre><code>{J_{\mu\nu}, P_{\mu}, W_{\mu} }::Depends(\commutator{#}).
</code></pre>
<p>to a <code>0</code>, so that that line becomes</p>
<pre><code>{J_{\mu\nu}, P_{\mu}, W_{\mu} }::Depends(0).
</code></pre>
<p>This does not happen on first run, because in that case the function <code>post_process</code> is not defined yet when the above line is encountered.</p>
<p>The problem is that <code>unwrap</code> (which is used in <code>post_process</code>) should have left <code>\commutator{#}</code> untouched. </p>
<p>Thanks for reporting this; will fix in a future update.</p>
General questionshttp://cadabra.science/qa/1186/poincare-example-evaluated-twice?show=1187#a1187Wed, 12 Jun 2019 11:47:30 +0000Answered: Using multiple notebooks
http://cadabra.science/qa/1184/using-multiple-notebooks?show=1185#a1185
<p>Just stick it anywhere in your PYTHONPATH; the import works just like any regular Python import process.</p>
General questionshttp://cadabra.science/qa/1184/using-multiple-notebooks?show=1185#a1185Wed, 12 Jun 2019 08:56:06 +0000Answered: Kernel crashing
http://cadabra.science/qa/1170/kernel-crashing?show=1182#a1182
<p>You probably either did not terminate an expression line with <code>;</code> or <code>:</code>, or you tried to wrap a Cadabra expression over multiple lines by using <code>\</code>. If it's the latter, just remove that <code>\</code>; Cadabra expressions can wrap over multiple lines without Python's line continuation character.</p>
Bug reportshttp://cadabra.science/qa/1170/kernel-crashing?show=1182#a1182Mon, 10 Jun 2019 09:01:41 +0000definitions in cadabra
http://cadabra.science/qa/1176/definitions-in-cadabra
<p>can you combine letters with numbers to name definitions in cadabra? Like as follows</p>
General questionshttp://cadabra.science/qa/1176/definitions-in-cadabraFri, 07 Jun 2019 06:44:48 +0000