Cadabra Q&A - Recent questions and answers in Feature requests
http://cadabra.science/qa/qa/feature-requests
Powered by Question2AnswerAnswered: Calling a cadabra note book in another one.
http://cadabra.science/qa/2046/calling-a-cadabra-note-book-in-another-one?show=2047#a2047
<p>Cadabra notebooks are treated as normal python modules when importing them into other notebooks. So you can have one notebook <code>one.cnb</code> and then from another one do</p>
<pre><code>import one
</code></pre>
<p>just like you would in Python. The standard rules for importing modules hold, in particular that you need to have the <code>one.cnb</code> somewhere in the <code>PYTHONPATH</code> (or <code>sys.path</code>).</p>
<p>For some more details see <a rel="nofollow" href="https://cadabra.science/notebooks/ref_import.html">https://cadabra.science/notebooks/ref_import.html</a></p>
Feature requestshttp://cadabra.science/qa/2046/calling-a-cadabra-note-book-in-another-one?show=2047#a2047Fri, 08 Oct 2021 07:25:46 +0000Getting list of arguments of functions
http://cadabra.science/qa/2029/getting-list-of-arguments-of-functions
<p>Hi,</p>
<p>The "evaluate" function has several arguments, like the parameter rhsonly that appears in different manuals I read. In the official documentation <br>
<a rel="nofollow" href="https://cadabra.science/manual/evaluate.html"></a><a rel="nofollow" href="https://cadabra.science/manual/evaluate.html">https://cadabra.science/manual/evaluate.html</a><br>
it isn't listed.<br>
I also went over the different pdf documents and didn't find a complete list of the arguments and their meaning.</p>
<p>Is there a document with a more thorough description of all the usable functions for Cadabra?</p>
<p>Alternatively, is there a way to get a list of arguments of an arbitrary function (like python's inspect)?</p>
<p>Thanks in advance,<br>
Amnon</p>
Feature requestshttp://cadabra.science/qa/2029/getting-list-of-arguments-of-functionsMon, 06 Sep 2021 10:39:31 +0000Answered: Support for plugin `Remote - WSL` in vscode
http://cadabra.science/qa/2015/support-for-plugin-remote-wsl-in-vscode?show=2016#a2016
<p>It's not something I will be implementing myself anytime soon (there simply isn't enough time in the day), but I'm happy to take patches if anyone figures out how to do this.</p>
Feature requestshttp://cadabra.science/qa/2015/support-for-plugin-remote-wsl-in-vscode?show=2016#a2016Thu, 08 Jul 2021 09:00:54 +0000Split free indices, and not just dummy indices.
http://cadabra.science/qa/1736/split-free-indices-and-not-just-dummy-indices
<p>It is possible to split sums based on dummy indices:</p>
<pre><code>{M,N,P,Q,R}::Indices(full).
{m,n,p,q,r}::Indices(space1, parent=full).
{a,b,c,d,e}::Indices(space2, parent=full).
ex:=A_{M d Q R} B_{M p Q R};
split_index(_, $M,m,a$);
</code></pre>
<p>Can something like this be used for free indices too?</p>
<p>For example, I want:</p>
<pre><code>ex := A_{m p} + A_{a p};
</code></pre>
<p>This should split the tensor into two tensors. Graphically, this would split the matrix into two smaller matrices based on their columns, and missing values will be set to zero.</p>
<p>This can be extended for more complicated splits. In this case, one would have to somehow specify splits based on subgroups of indices.</p>
<p>For example, one might want to split a tensor based on an arbitrary set of indices. I.e. given tensor A_{x1 x2 ... xN}, get some specific indices {x1 x2 ... xN} into one tensor, and the rest in another tensor.</p>
Feature requestshttp://cadabra.science/qa/1736/split-free-indices-and-not-just-dummy-indicesWed, 09 Sep 2020 20:31:14 +0000Answered: Trace of Gamma Matrices?
http://cadabra.science/qa/170/trace-of-gamma-matrices?show=1466#a1466
<p>You can do it with recent versions of Cadabra but it's a little awkward. For example,</p>
<pre><code>{\mu,\nu,\rho,\sigma}::Indices(vector);
{\mu,\nu,\rho,\sigma}::Integer(0..3);
{a,b,c,d}::Indices(spinor);
Tr{#}::Trace(indices=spinor);
\delta_{\mu \nu}::KroneckerDelta;
\Gamma^{#}::GammaMatrix(metric=\delta);
\Gamma^{\mu}::ImplicitIndex(\Gamma^{\mu}_{a b});
\Gamma^{\mu \nu}::ImplicitIndex(\Gamma^{\mu \nu}_{a b});
\Gamma^{\mu \nu \rho \sigma}::ImplicitIndex(\Gamma^{\mu \nu \rho \sigma}_{a b});
ex:=Tr(\Gamma^{\mu} \Gamma^{\nu \rho} \Gamma^{\sigma});
</code></pre>
<p>Then call "join_gamma", "distribute", "untrace" until you only see traces of single gamma matrices. Finally "canonicalise" will kill all of them except Tr(1).</p>
Feature requestshttp://cadabra.science/qa/170/trace-of-gamma-matrices?show=1466#a1466Wed, 04 Dec 2019 01:34:04 +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: 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: 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: `eliminate_vielbein` and the `KroneckerDelta`
http://cadabra.science/qa/1155/eliminate_vielbein-and-the-kroneckerdelta?show=1163#a1163
<p>The bonus question is already possible, just</p>
<pre><code>\delta{#}::KroneckerDelta;
</code></pre>
<p>works.</p>
<p>The other one is more tricky. I usually do</p>
<pre><code>E^{\mu}_{\nu}::KroneckerDelta;
E^{\mu}_{\nu}::LaTeXForm("\delta").
</code></pre>
<p>to get the display correct. In order to auto-convert to an actual <code>\delta</code> object, not just something that prints as $\delta$, <code>eliminate_vielbein</code> would need to know that you want to use the <code>\delta^{\mu}_{\nu}</code> as the Kronecker delta for the $\mu, \nu$ indices. That's possible (there is a way for algorithms to look up such properties) but I haven't implemented that yet. Have opened an issue on github to track this ( <a rel="nofollow" href="https://github.com/kpeeters/cadabra2/issues/153">https://github.com/kpeeters/cadabra2/issues/153</a> ).</p>
Feature requestshttp://cadabra.science/qa/1155/eliminate_vielbein-and-the-kroneckerdelta?show=1163#a1163Thu, 09 May 2019 14:52:53 +0000Answered: Vielbein, inverse and their elimination. Documentation
http://cadabra.science/qa/1153/vielbein-inverse-and-their-elimination-documentation?show=1154#a1154
<p>Have merged your initial docs and the actual algorithm now. There's room for improvement of course.</p>
Feature requestshttp://cadabra.science/qa/1153/vielbein-inverse-and-their-elimination-documentation?show=1154#a1154Fri, 03 May 2019 18:26:02 +0000Answered: Cadabra QA page: functionality
http://cadabra.science/qa/1148/cadabra-qa-page-functionality?show=1150#a1150
<p>I rely on the Q2A software for all of this; you may be better off making these suggestions on their support forum.</p>
Feature requestshttp://cadabra.science/qa/1148/cadabra-qa-page-functionality?show=1150#a1150Fri, 26 Apr 2019 11:48:41 +0000Answered: update Cadabra: reference guide and tutorial to 2.x
http://cadabra.science/qa/1039/update-cadabra-reference-guide-and-tutorial-to-2-x?show=1040#a1040
<p>See <a rel="nofollow" href="https://cadabra.science/help.html">https://cadabra.science/help.html</a> (not entirely complete but better than nothing).</p>
Feature requestshttp://cadabra.science/qa/1039/update-cadabra-reference-guide-and-tutorial-to-2-x?show=1040#a1040Sat, 02 Mar 2019 11:02:16 +0000Matrix exponential
http://cadabra.science/qa/1035/matrix-exponential
<p>It would be nicer if the future Cadabra would be able to deal with calculating the exponentials of (Gamma) matrices. </p>
Feature requestshttp://cadabra.science/qa/1035/matrix-exponentialSun, 17 Feb 2019 14:18:29 +0000Answered: Suggestions for tutorial notebooks
http://cadabra.science/qa/693/suggestions-for-tutorial-notebooks?show=705#a705
<p>Hi Kasper and Leo,</p>
<p>I'd also like to make a contribution.</p>
<p>As a physicist, from my point of view I think that </p>
<ul>
<li><p>a tutorial on voice 1. would be an excellent way to combine the experience of using the Cadabra manipulator with the opportunity to discover/learn the basic programming logics (seeing their direct projected application in the context of physics). Thanks to its Open Source nature, Cadabra is predisposed to be a valid tool also from this point of view.</p></li>
<li><p>for the other points, I am convinced that the extension of the code/examples provided to the user in a wide range of fields is always a good thing (the user can learn/use/modify according to the specific interests -> new extensions/ideas for the future).</p></li>
</ul>
<p>I am therefore in favor of all the points, specific or less than they are :)</p>
<p>Thanks and regards,</p>
<p>Mattia</p>
Feature requestshttp://cadabra.science/qa/693/suggestions-for-tutorial-notebooks?show=705#a705Mon, 30 Apr 2018 05:27:05 +0000Answered: Multiple Window in cadabra
http://cadabra.science/qa/520/multiple-window-in-cadabra?show=521#a521
<p>Start cadabra again. </p>
Feature requestshttp://cadabra.science/qa/520/multiple-window-in-cadabra?show=521#a521Sun, 26 Nov 2017 13:47:43 +0000Answered: Using anaconda sympy in ubuntu
http://cadabra.science/qa/514/using-anaconda-sympy-in-ubuntu?show=515#a515
<p>At the moment, you can't. The Anaconda people have made it seriously difficult to create large packages which are not pure Python (they simply haven't thought through how people want Anaconda to talk to system supplied tools). Your best bet is simply to install sympy for the system-supplied Python, e.g. by doing </p>
<pre><code>sudo apt install python3-sympy
</code></pre>
<p>(which may not get you the latest version, unfortunately) or by getting the latest version through a pip install, </p>
<pre><code>sudo pip3 install sympy
</code></pre>
Feature requestshttp://cadabra.science/qa/514/using-anaconda-sympy-in-ubuntu?show=515#a515Sat, 25 Nov 2017 20:39:03 +0000importing differential geometry package
http://cadabra.science/qa/448/importing-differential-geometry-package
<p>any chance of importing the package 1103.1608 <br>
I have no idea how such things are done so I can safely say why not....</p>
Feature requestshttp://cadabra.science/qa/448/importing-differential-geometry-packageWed, 11 Oct 2017 05:22:51 +0000Answered: usage of Vielbein
http://cadabra.science/qa/162/usage-of-vielbein?show=290#a290
<p>I would be very interested in using cadabra with vielbeins. Will that possibility be available?</p>
Feature requestshttp://cadabra.science/qa/162/usage-of-vielbein?show=290#a290Fri, 05 May 2017 09:55:32 +0000Define explicitly dependent objects
http://cadabra.science/qa/191/define-explicitly-dependent-objects
<p>Hi everyone,<br>
I'm trying to derive the equations of motion of a scalar field with a potential $V(\phi)$,<br>
$S:= -\int \sqrt{-g}(\frac{1}{2}g^{\mu \nu} \partial_{\mu}{\phi} \partial_{\nu}{\phi}+V )d^4x$; however when I compute the variational derivative of the action with respect to $\phi$ the potential does not appear (due to property <code>V::Depends::{x}</code>, only allow to make objects implicitly dependent on the coordinates). Is there any property in Cadabra which Makes an object explicitly dependent on other objects, like $V(\phi)$?</p>
<p>Thank you !!</p>
Feature requestshttp://cadabra.science/qa/191/define-explicitly-dependent-objectsMon, 10 Apr 2017 10:14:03 +0000Configure a default folder
http://cadabra.science/qa/210/configure-a-default-folder
<p>I'm not sure if it is my OS configuration (I use debian) , that within <code>cadabra</code> when I hit <code>C-o</code>, it shows me a list of <em>recent documents</em>... however, I would like to set a <code>cadabra2_programs</code> folder.</p>
<p>Is it possible to personalise the default folder?</p>
Feature requestshttp://cadabra.science/qa/210/configure-a-default-folderMon, 13 Feb 2017 13:46:14 +0000Answered: Substitute the "absolute" indices
http://cadabra.science/qa/126/substitute-the-absolute-indices?show=127#a127
<p>Instead of relying on index names, substitute like this:</p>
<pre><code>substitute(_,$ D_{a}{D_{b}{A_{c}}} -> 1/2 D_{b}{D_{a}{A_{c}}} + 1/2 D_{a}{D_{b}{A_{c}}} + 1/2 R_{a b c d} A^{d} $ );
</code></pre>
<p>Or in other words, decompose the double derivative into a symmetric bit and an anti-symmetric bit. The symmetric bits will then cancel in your original expression, leaving the Riemann tensor.</p>
Feature requestshttp://cadabra.science/qa/126/substitute-the-absolute-indices?show=127#a127Mon, 17 Oct 2016 11:55:59 +0000