<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Cadabra Q&amp;A - Recent questions</title>
<link>https://cadabra.science/qa/questions</link>
<description>Powered by Question2Answer</description>
<item>
<title>declare a mapping with previous expression</title>
<link>https://cadabra.science/qa/3077/declare-a-mapping-with-previous-expression</link>
<description>&lt;p&gt;I have some expression reached after a long list of manipulations with some free indices, and I want to create a mapping (I think documentation prefers calling them &quot;substitution rules&quot;) like:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;M_{\mu} -&amp;gt; &amp;lt;previous expression with only \mu as free indice&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I tried doing:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;M_mapping := M_{\mu} -&amp;gt; $(_);&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;but this gives:&lt;br&gt;
`\begin{verbatim}RuntimeError: Python object '' does not exist.&lt;/p&gt;
&lt;p&gt;At:
Notebook Cell (Line 1): M&lt;em&gt;mapping = Ex(' M&lt;/em&gt;{\mu} -&amp;gt; @(_)')
\end{verbatim}`&lt;/p&gt;
&lt;p&gt;I tried doing:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;M_expr = _;   &amp;lt;--- this succeeds
M_mapping := M_{\mu} -&amp;gt; @(M_expr); &amp;lt;--- this gives an error:&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;`\begin{verbatim}RuntimeError: Python object '\prod' does not exist.&lt;/p&gt;
&lt;p&gt;At:
Notebook Cell (Line 1): M&lt;em&gt;mapping = Ex(' M&lt;/em&gt;{\mu} -&amp;gt; @(M_expr)')
\end{verbatim}`&lt;/p&gt;
&lt;p&gt;What's the correct syntax to create a mapping with the previous expression?&lt;/p&gt;</description>
<category>General questions</category>
<guid isPermaLink="true">https://cadabra.science/qa/3077/declare-a-mapping-with-previous-expression</guid>
<pubDate>Fri, 23 Jan 2026 16:12:30 +0000</pubDate>
</item>
<item>
<title>canonicalise gets stuck on swapped indices</title>
<link>https://cadabra.science/qa/3069/canonicalise-gets-stuck-on-swapped-indices</link>
<description>&lt;p&gt;The following snippet shows the issue I'm having right now:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;expr_test := \nabla_{\mu}{ A_{\alpha } } * \nabla^{\mu}{ A_{\beta} } + \nabla^{\mu}{ A_{\alpha } } * \nabla_{\mu}{ A_{\beta} };
sort_product(_);
sort_sum(_);
canonicalise(_);&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;At the end I still get:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;\nabla_{\mu}{A_{\alpha}} \nabla^{\mu}{A_{\beta}}\discretionary{}{}{}
+
\nabla_{\mu}{A_{\beta}} \nabla^{\mu}{A_{\alpha}}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;all indices are &lt;code&gt;position=independent&lt;/code&gt;, but I tried switching to &lt;code&gt;fixed&lt;/code&gt; and didn't help this particular issue.&lt;/p&gt;
&lt;p&gt;Also, nabla is declared as:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;\nabla{#}::Derivative.&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;But AFAIU the non-commutativity of &lt;code&gt;Derivative&lt;/code&gt; should only affect order of indices, not the resulting object.&lt;/p&gt;</description>
<category>General questions</category>
<guid isPermaLink="true">https://cadabra.science/qa/3069/canonicalise-gets-stuck-on-swapped-indices</guid>
<pubDate>Wed, 21 Jan 2026 19:22:39 +0000</pubDate>
</item>
<item>
<title>Rename specific dummy indices in expressions</title>
<link>https://cadabra.science/qa/3063/rename-specific-dummy-indices-in-expressions</link>
<description>&lt;p&gt;In some cases, it would be useful to rename a specific subset of indices (dummy or not). In my particular case I am doing Hilbert metric variations of a matter Lagrangian and trying to reach a final expression that factors out a single metric variation coefficient.&lt;/p&gt;
&lt;p&gt;What is happening is that I have many terms with metric variation factors, but each having different dummy indices. Even &lt;code&gt;rename_dummies&lt;/code&gt; doesn't really help as it's a global action and I don't see a way to rename only the dummies of the \delta{g} terms.&lt;/p&gt;
&lt;p&gt;What other strategy could be useful here? I'm thinking into a pseudo-code doing this:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;for each \delta{g}^{?a ?b} term matching with a \delta{g} factor:&lt;/li&gt;
&lt;li&gt;rename indices ?a to something unused or reserved in entire term&lt;/li&gt;
&lt;li&gt;rename indices ?b to something unused or reserved in entire term&lt;/li&gt;
&lt;/ul&gt;</description>
<category>General questions</category>
<guid isPermaLink="true">https://cadabra.science/qa/3063/rename-specific-dummy-indices-in-expressions</guid>
<pubDate>Mon, 19 Jan 2026 19:20:52 +0000</pubDate>
</item>
<item>
<title>Issue with split_index and dummy index</title>
<link>https://cadabra.science/qa/3062/issue-with-split_index-and-dummy-index</link>
<description>&lt;p&gt;I am new to Cadabra and have a couple of beginner questions that I haven’t been able to resolve on my own. I would greatly appreciate any help or clarification you can offer. I have the following Cadabra Code:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{M,N,P,Q,R#}::Indices(full, position=fixed).
{a,b,c,d,e#}::Indices(space1, position=fixed).
{a,b,c,d,e}::Integer(1..2).
{m,n,p,q,r#}::Indices(space2, position=fixed).&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;\partial{#}::PartialDerivative.
g_{M N}::Metric.
g^{M N}::InverseMetric.
g_{M?N?}::Symmetric.
g^{M?N?}::Symmetric.&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;Gtog:=\Gamma^{P?}_{M? N?}-&amp;gt;(1/2)*g^{P? Q}(\partial_{N?}{g_{Q M?}}
+\partial_{M?}{g_{Q N?}}-\partial_{Q}{g_{M? N?}});&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;ex:=\Gamma^{2}_{1 2};
substitute(_, Gtog);
split_index(_, $M, a, m$);&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;todo:=\Gamma^{R}_{q m}\Gamma^{p}_{n R};
substitute(_, Gtog);&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Question1: I tried using split index to split an index in my expression, but it doesn’t seem to do anything -- it simply returns the answer without performing the split. What might be the issue?&lt;/p&gt;
&lt;p&gt;Question2: For the expression \Gamma^{R}&lt;em&gt;{q m}\Gamma^{p}&lt;/em&gt;{n R} I am getting the same index Q repeated four times in the output. How can I prevent this and get the correct index contractions without the same dummy index appearing too many times?&lt;/p&gt;</description>
<category>General questions</category>
<guid isPermaLink="true">https://cadabra.science/qa/3062/issue-with-split_index-and-dummy-index</guid>
<pubDate>Tue, 13 Jan 2026 11:06:33 +0000</pubDate>
</item>
<item>
<title>absolute value in Cadabra expression</title>
<link>https://cadabra.science/qa/3058/absolute-value-in-cadabra-expression</link>
<description>&lt;p&gt;Hi,
Sorry for the simplistic question, but what is the proper way to generate a Cadabra expression with absolute value?&lt;/p&gt;
&lt;p&gt;I tried&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ex := \sqrt{g} -&amp;gt; \abs(Z) \sqrt{h}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;but I get an error, also using sympy.Abs doesn't seem to generate an output with 
|Z|&lt;/p&gt;</description>
<category>General questions</category>
<guid isPermaLink="true">https://cadabra.science/qa/3058/absolute-value-in-cadabra-expression</guid>
<pubDate>Fri, 19 Dec 2025 12:15:46 +0000</pubDate>
</item>
<item>
<title>The mystery of meld</title>
<link>https://cadabra.science/qa/3056/the-mystery-of-meld</link>
<description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Thanks a lot for Cadabra. This is very useful! 
But I found strange behavior of the algorithm meld.&lt;/p&gt;
&lt;p&gt;First, a bug related to prefactor. 
Consider:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ex:= B^{i} B^{j} S^{m n} D_{i j} D_{m n} + B^{i} B^{j} S^{m n} D_{m n} D_{i j};
S^{i j}::Symmetric;
D_{i j}::Symmetric;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And then if I evaluate meld for the ex, I get prefactor 3/2 instead of 2. &lt;/p&gt;
&lt;p&gt;Moreover, if I do not specify the symmetries of S^{i j} and D_{i j} separately, then the algorithm works correctly.&lt;/p&gt;
&lt;p&gt;Second, an incorrect interpretation of an index convolution:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;\partial{#}::PartialDerivative.
ex1:=  G^{m j} \partial_{i}{A} \partial_{m}{F_{j}} +  G^{m j} \partial_{m}{A} \partial_{i}{F_{j}};
ex2:= D^{m n} \partial_{i}{C} \partial_{m}{Q_{n j}} + D^{m n} \partial_{m}{C} \partial_{i}{Q_{n j}};
meld(ex1);
meld(ex2);&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Meld interprets expressions as two identical terms in both cases, although I did not specify any symmetries of objects.&lt;/p&gt;
&lt;p&gt;Thanks,
Maksim&lt;/p&gt;</description>
<category>Bug reports</category>
<guid isPermaLink="true">https://cadabra.science/qa/3056/the-mystery-of-meld</guid>
<pubDate>Wed, 19 Nov 2025 15:20:16 +0000</pubDate>
</item>
<item>
<title>Strange behavior young_project_product with zoom</title>
<link>https://cadabra.science/qa/3055/strange-behavior-young_project_product-with-zoom</link>
<description>&lt;p&gt;Hello, I found a peculiar effect of Young's projection when applied to part of an expression after using zoom. For example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{a,b,c,d,f,e, m,n,k,l,q,r,s,t,u,v,w,x,y,z,m#, n#}::Indices(values={0..3}, position=independent);

\nabla{#}::Derivative.
h_{m? n?}::Metric.
h^{m? n?}::InverseMetric.
h_{m? n?}::Symmetric.
h^{m? n?}::Symmetric.
F_{a? b?}::AntiSymmetric.
F^{a? b?}::AntiSymmetric.
\nabla_{a}{F_{b c}}::TableauSymmetry(shape={2,1}, indices={0,1,2});
\nabla_{a}{\nabla_{b}{p}}::Symmetric;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and I have some long expression:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;expr := 1/2 F_{a b} F_{c d} R \nabla_{e}(p) \nabla_{f}(p) h^{a c} h^{b e} h^{d f}
-F_{a b} F_{c d} \nabla_{e}(\nabla_{f}(p)) \nabla_{m}(\nabla_{n}(p)) h^{a c} h^{b e} h^{d f} h^{m n} 
+ F_{a b} F_{c d} \nabla_{e}(\nabla_{f}(p)) \nabla_{m}(\nabla_{n}(p)) h^{a c} h^{b e} h^{d m} h^{f n}
-F_{a b} F_{c d} R_{e f} \nabla_{m}(p) \nabla_{n}(p) h^{a e} h^{b m} h^{c f} h^{d n}
-2F_{a b} \nabla_{c}(F_{d e}) \nabla_{f}(\nabla_{m}(p)) \nabla_{n}(p) h^{a f} h^{b n} h^{c d} h^{e m} 
+ F_{a b} F_{c d} \nabla_{e}(\nabla_{f}(p)) \nabla_{m}(\nabla_{n}(p)) h^{a e} h^{b m} h^{c f} h^{d n} 
+ F_{a b} \nabla_{c}(F_{d e}) \nabla_{f}(\nabla_{m}(p)) \nabla_{n}(p) h^{a c} h^{b d} h^{e f} h^{m n};&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And I want to simplify terms with \nabla&lt;em&gt;{a}{F&lt;/em&gt;{b c}}:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;zoom(expr, $Q?? \nabla_{a}{F_{b c}}$);
expr2 = take_match($@[expr2]$, $Q?? \nabla_{a}{F_{b c}}$);
canonicalise(young_project_product(expr2));&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For expr I get 
&lt;code&gt;-  4/3 F_{a b} \nabla_{c}(F_{d e}) \nabla_{f}(\nabla_{m}(p)) \nabla_{n}(p) h^{a f} h^{b n} h^{c d} h^{e m}&lt;/code&gt;
but for expr2 I get &lt;/p&gt;
&lt;p&gt;&lt;code&gt;-  8/9 F_{a b} \nabla_{c}(F_{d e}) \nabla_{f}(\nabla_{m}(p)) \nabla_{n}(p) h^{a f} h^{b n} h^{c d} h^{e m}&lt;/code&gt;&lt;/p&gt;</description>
<category>Bug reports</category>
<guid isPermaLink="true">https://cadabra.science/qa/3055/strange-behavior-young_project_product-with-zoom</guid>
<pubDate>Wed, 22 Oct 2025 16:56:49 +0000</pubDate>
</item>
<item>
<title>vary behaves in an odd way</title>
<link>https://cadabra.science/qa/3053/vary-behaves-in-an-odd-way</link>
<description>&lt;p&gt;Here is a short example of what I found weird:&lt;/p&gt;
&lt;p&gt;ex:= 2(r)**(-2) - B(r);
vary(_, $B(r) -&amp;gt; \delta{B}$);&lt;/p&gt;
&lt;p&gt;from which I get&lt;/p&gt;
&lt;p&gt;2 {r}^{-2} - \delta\left(B\left(r\right)\right)&lt;/p&gt;
&lt;p&gt;I tought that it was due to my older version of cadabra, but I just installed the latest version and the answer is the same. If I had in the first term just r, without an exponent, the answer woud be correct.&lt;/p&gt;
&lt;p&gt;Thanks,
Andrei&lt;/p&gt;</description>
<category>Bug reports</category>
<guid isPermaLink="true">https://cadabra.science/qa/3053/vary-behaves-in-an-odd-way</guid>
<pubDate>Mon, 06 Oct 2025 10:29:17 +0000</pubDate>
</item>
<item>
<title>plot example on p. 51 of The Cadabra Book require range</title>
<link>https://cadabra.science/qa/3048/plot-example-on-p-51-of-the-cadabra-book-require-range</link>
<description>&lt;p&gt;A note on p. 52 tell the range is optional. But the example don't work without it.&lt;/p&gt;
&lt;p&gt;Also, increasing the number of samples have no effect.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;plot(sol, range_=($tau$, 0, 10),samples=5000, title=&quot;Damped coupled oscillators&quot;);&lt;/code&gt;&lt;/p&gt;</description>
<category>Bug reports</category>
<guid isPermaLink="true">https://cadabra.science/qa/3048/plot-example-on-p-51-of-the-cadabra-book-require-range</guid>
<pubDate>Mon, 21 Jul 2025 15:05:29 +0000</pubDate>
</item>
<item>
<title>\dot command not displayed correctly</title>
<link>https://cadabra.science/qa/3043/dot-command-not-displayed-correctly</link>
<description>&lt;p&gt;I'm trying to reproduce the first example on page 37 of The Cadabra Book.&lt;/p&gt;
&lt;p&gt;I tried in cadabra2-gtk and jupyter kernel but I got a strange result. Instead of a dot in between I got a comma and a dot over.&lt;/p&gt;
&lt;p&gt;In cadabra2-cli this is the output : \dot(A , D) \dot(B , C) which when entered in notebook give me the same wrong result.&lt;/p&gt;
&lt;p&gt;Here is the code I'm running :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
&amp;gt; {\mu, \nu, \rho, \sigma}::Indices(vector);

&amp;gt; ex:= A\\_\\{\mu\\} B\\_\\{\nu\\} C\\_\\{\nu\\} D\\_\\{\mu\\};

&amp;gt; substitute\(\_\, $A?\_\{\rho\} B?\_\{\rho\} \-\&amp;gt; \dot\{A?\}\{B?\}$\, repeat=True\);&lt;/code&gt;&lt;/pre&gt;</description>
<category>Bug reports</category>
<guid isPermaLink="true">https://cadabra.science/qa/3043/dot-command-not-displayed-correctly</guid>
<pubDate>Mon, 14 Jul 2025 23:37:35 +0000</pubDate>
</item>
<item>
<title>Regex not working</title>
<link>https://cadabra.science/qa/3035/regex-not-working</link>
<description>&lt;p&gt;I tried the example on page 37 of the Cadabra Book&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ex:= A + B3 + C7;
substitute(_, $A + M? + N? | \regex{M?}{&quot;[A-Z]7&quot;} -&amp;gt; \sin(M? N?\)/N?$);&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In jupyter I got this error :&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Traceback (most recent call last):
  File &quot;/usr/local/lib/python3.12/dist-packages/cadabra2_jupyter/kernel.py&quot;, line 57, in do_execute
    self._execute_python(pycode)
  File &quot;/usr/local/lib/python3.12/dist-packages/cadabra2_jupyter/kernel.py&quot;, line 111, in _execute_python
    self._sandbox_context(pycode)
  File &quot;/usr/local/lib/python3.12/dist-packages/cadabra2_jupyter/context.py&quot;, line 51, in __call__
    exec(code, self._sandbox)
  File &quot;&amp;lt;string&amp;gt;&quot;, line 2
    substitute(_, &quot;&quot;Ex(r'''A + M? + N? | \regex{M?}{&quot;[A-Z]7&quot;} -&amp;gt; \sin(M? N?)/N?''', False)); display(_)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: invalid syntax. Perhaps you forgot a comma?&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The command line simply crash :&lt;/p&gt;
&lt;p&gt;&amp;gt; ex:= A + B3 + C7;
A + B3 + C7
&amp;gt; substitute(_\, $A + M? + N? | \regex{M?}{&quot;[A-Z]7&quot;} -&amp;gt; \sin(M? N?)/N?$);&lt;/p&gt;
&lt;p&gt;Terminated by user interrupt.&lt;/p&gt;
&lt;p&gt;&lt;br&gt;
I'm using Cadabra 2.5.12&lt;/p&gt;</description>
<category>Bug reports</category>
<guid isPermaLink="true">https://cadabra.science/qa/3035/regex-not-working</guid>
<pubDate>Sat, 12 Jul 2025 21:06:37 +0000</pubDate>
</item>
<item>
<title>How to remove/unset properties</title>
<link>https://cadabra.science/qa/3034/how-to-remove-unset-properties</link>
<description>&lt;p&gt;I'm reading The Cadabra Book and try every example in the same cadabra session. I tried command line and Jupyter kernel and same result.&lt;/p&gt;
&lt;p&gt;I got the following error because in the same session the first two lines interfere with the others :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;gt; {m#, n#}::Indices(vector);
Property Indices(position=free) attached to {m#, n#}.
&amp;gt; {n, m, p, q}::Integer(1..d);
Property Integer attached to {n, m, p, q}.
&amp;gt; A_{m n p}::TableauSymmetry(shape={1,1}, indices={1,2});
Property TableauSymmetry attached to A_{m n p}.
&amp;gt; p = TableauSymmetry.get($A_{m n p}$)
&amp;gt; p.attach($B_{m n p}$)
&amp;gt; ex:= B_{m n p} - B_{m p n};
B_{m n p}-B_{m p n}
&amp;gt; canonicalise(_);
Traceback (most recent call last):
  File &quot;&amp;lt;stdin&amp;gt;&quot;, line 1, in &amp;lt;module&amp;gt;
RuntimeError: Indicex has integer property, but explicit range needed.&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Is there a way to remove properties ?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;</description>
<category>General questions</category>
<guid isPermaLink="true">https://cadabra.science/qa/3034/how-to-remove-unset-properties</guid>
<pubDate>Sat, 12 Jul 2025 17:26:32 +0000</pubDate>
</item>
<item>
<title>execution problems</title>
<link>https://cadabra.science/qa/3015/execution-problems</link>
<description>&lt;p&gt;Hi Kasper,
Thanks for the quick update. I've tried to run the latest version of cadabra2 but I get this run time error&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Cadabra 2.5.11 (build 3796.22211b1d23 dated 2025-04-08)
Copyright (C) 2001-2025  Kasper Peeters &amp;lt;info@cadabra.science&amp;gt;
Traceback (most recent call last):
  File &quot;&amp;lt;input&amp;gt;&quot;, line 1, in &amp;lt;module&amp;gt;
FileNotFoundError: [Errno 2] No such file or directory: '/Users/leo/tmp2//opt/homebrew/opt/python@3.13/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/cadabra2_defaults.py'&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I had no problems compiling the code. Here is what I did&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;git clone https://github.com/kpeeters/cadabra2
cd cadabra2/
git checkout devel
cmake -DENABLE_MATHEMATICA=OFF -DCMAKE_INSTALL_PREFIX:PATH=/Users/leo/tmp2/ ..
mkdir build
make install

export PATH=/Users/leo/tmp2/bin/:$PATH&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I chose to install to ~/tmp2 just for testing. I've done this mant times before and b=nvere had this problem.
Any thoughts?
Cheers,
Leo
ps. Santa was very busy over Xmas so no surprise that a few gremlins got into the system :)&lt;/p&gt;</description>
<category>Bug reports</category>
<guid isPermaLink="true">https://cadabra.science/qa/3015/execution-problems</guid>
<pubDate>Tue, 08 Apr 2025 09:22:21 +0000</pubDate>
</item>
<item>
<title>cadabra2python seg fault</title>
<link>https://cadabra.science/qa/3012/cadabra2python-seg-fault</link>
<description>&lt;p&gt;Hi Kasper,&lt;/p&gt;
&lt;p&gt;Just a short note. Running &lt;code&gt;cadabra2python&lt;/code&gt; on any non-empty file produces a seg fault.&lt;/p&gt;
&lt;p&gt;Cheers,
Leo&lt;/p&gt;</description>
<category>Bug reports</category>
<guid isPermaLink="true">https://cadabra.science/qa/3012/cadabra2python-seg-fault</guid>
<pubDate>Mon, 07 Apr 2025 04:21:01 +0000</pubDate>
</item>
<item>
<title>simple substitute hits wrong target</title>
<link>https://cadabra.science/qa/3011/simple-substitute-hits-wrong-target</link>
<description>&lt;p&gt;Greetings,&lt;/p&gt;
&lt;p&gt;Here is an interesting case.&lt;/p&gt;
&lt;p&gt;This short code&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;tmp := 2 A B + 3 B C + 4 C D.
substitute (tmp, $A? -&amp;gt; \theta A?$)
collect_factors (tmp)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;returns&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;tmp := 2 \theta^2 A B + 3 \theta^2 B C + 4 \theta^2 C D&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;while&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;tmp := 2 A B C + 3 B C D + 4 C D E.
substitute (tmp, $A? -&amp;gt; \theta A?$)
collect_factors (tmp)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;returns&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;tmp := 2 \theta^3 A B C + 3 \theta^3 B C D + 4 \theta^3 C D E&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Okay, so far , so good.&lt;/p&gt;
&lt;p&gt;However, this code&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;tmp := 2 A + 3 B + 4 C.
substitute (tmp, $A? -&amp;gt; \theta A?$)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;returns&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;tmp := 4 \theta A + 9 \theta B + 16 \theta C&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Notice that the integer coefficients have been squared! That's not correct.&lt;/p&gt;
&lt;p&gt;Quite interesting, n'est pas?&lt;/p&gt;
&lt;p&gt;Cheers,
Leo&lt;/p&gt;</description>
<category>Bug reports</category>
<guid isPermaLink="true">https://cadabra.science/qa/3011/simple-substitute-hits-wrong-target</guid>
<pubDate>Mon, 07 Apr 2025 04:09:04 +0000</pubDate>
</item>
<item>
<title>curly-braces and lost indices</title>
<link>https://cadabra.science/qa/3010/curly-braces-and-lost-indices</link>
<description>&lt;p&gt;Greetings,&lt;/p&gt;
&lt;p&gt;This short example&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{a,b,c,d,e,f#}::Indices.

foo := A^{a} A^{b} g_{a b}.
substitute (foo,$A^{a}-&amp;gt;B^{a}$)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;does what you'd expect. It returns&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;foo := B^{a} B^{b} g_{a b}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But the following code&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;foo := A^{a} A^{b} g_{a b}.
substitute (foo,$A^{a}-&amp;gt;{B}^{a}$)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;returns&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;foo := B B g_{a b}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now that seems wrong to me.&lt;/p&gt;
&lt;p&gt;Any thoughts?&lt;/p&gt;
&lt;p&gt;My guess is that the curly-braces around B in the second assignment disconnects B from the following indices. Those indices are orphaned and are thus lost in the substitution.&lt;/p&gt;
&lt;p&gt;The simple answer is -- Don't use unnecessary curly-braces.&lt;/p&gt;
&lt;p&gt;Cheers,
Leo&lt;/p&gt;</description>
<category>Bug reports</category>
<guid isPermaLink="true">https://cadabra.science/qa/3010/curly-braces-and-lost-indices</guid>
<pubDate>Mon, 07 Apr 2025 04:06:29 +0000</pubDate>
</item>
<item>
<title>Evaluate does not respect NonCommuting</title>
<link>https://cadabra.science/qa/2996/evaluate-does-not-respect-noncommuting</link>
<description>&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&gt;Thanks for Cadabra! I just started playing around. I'm using the Fedora 40 package of Version 2.5.10 (build private dated 2024-12-24).&lt;/p&gt;
&lt;p&gt;I'm trying the following:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;\partial{#}::PartialDerivative;
t::Coordinate;
O::Depends(t);
{H,O_0}::NonCommuting;

ex := O = \exp(i*H*t) O_0 \exp(-i*H*t);
ex2 := \partial_t{O};

substitute(ex2, ex);&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So far so good. However&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;evaluate(_);&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;yiels 0 which should not be because &lt;code&gt;H&lt;/code&gt; and &lt;code&gt;O_0&lt;/code&gt; are not commuting.&lt;/p&gt;
&lt;p&gt;I've read that &lt;code&gt;simplify&lt;/code&gt; should not be used (&lt;a rel=&quot;nofollow&quot; href=&quot;https://cadabra.science/qa/798/simple-commutator-in-quantum-mechanics?show=798#q798&quot;&gt;https://cadabra.science/qa/798/simple-commutator-in-quantum-mechanics?show=798#q798&lt;/a&gt;) but is this true for &lt;code&gt;evaluate&lt;/code&gt; as well?&lt;/p&gt;
&lt;p&gt;Thanks in advance,&lt;/p&gt;
&lt;p&gt;Sebastian&lt;/p&gt;</description>
<category>General questions</category>
<guid isPermaLink="true">https://cadabra.science/qa/2996/evaluate-does-not-respect-noncommuting</guid>
<pubDate>Fri, 14 Mar 2025 07:08:52 +0000</pubDate>
</item>
<item>
<title>How to manage two projects in their own folders which import .cnb's with the same names</title>
<link>https://cadabra.science/qa/2994/manage-projects-their-folders-which-import-cnbs-with-names</link>
<description>&lt;p&gt;I have two separate folders for different projects with some notebook (.cnb) files. In both folders I use the names methods.cnb, latex_macros.cnb, properties.cnb to split up the code, then import them into a main file to do work.&lt;/p&gt;
&lt;p&gt;I noticed that, when importing from a .cnb, cadabra will convert it to a .py file and store it in the /home/user/cadabra_packages folder (on Ubuntu).&lt;/p&gt;
&lt;p&gt;At the moment, I need to manually delete these cached files in cadabra_packages before I can swap between my projects.&lt;/p&gt;
&lt;p&gt;I was wondering if there are any suggestions on how to make this better? I am very amateurish, but would appreciate a pointer in the right direction so that I can manage my files better. The only thing I would like is for it to be operating system agnostic, so I can also do it on mac.&lt;/p&gt;
&lt;p&gt;Some ideas I thought of:&lt;/p&gt;
&lt;p&gt;(1) Directly use .py files in the project folders so no .cnbs need to be cached.&lt;/p&gt;
&lt;p&gt;(2) Rename the files e.g. methods1.cnb in the first folder, methods2.cnb in the second.&lt;/p&gt;
&lt;p&gt;I am not keen on (2) because it would be nice to have the same layout in folders for different projects. I could compromise with (1), but I do enjoy editing the files using the notebook interface.&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;</description>
<category>General questions</category>
<guid isPermaLink="true">https://cadabra.science/qa/2994/manage-projects-their-folders-which-import-cnbs-with-names</guid>
<pubDate>Mon, 17 Feb 2025 07:24:51 +0000</pubDate>
</item>
<item>
<title>No GUI after compiling from the source (manjaro)</title>
<link>https://cadabra.science/qa/2989/no-gui-after-compiling-from-the-source-manjaro</link>
<description>&lt;p&gt;Happy New Year community!&lt;/p&gt;
&lt;p&gt;I've been using manjaro linux as my main OS for four year now (perhaps even more than that), and I compile &lt;code&gt;cadabra2&lt;/code&gt; every few months. The standard process is:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;cd ~/Software/git.src/cadabra2
git fetch
git pull
rm -Rf build/ &amp;amp;&amp;amp; mkdir build &amp;amp;&amp;amp; cd build &amp;amp;&amp;amp; cmake ../ 
make -j6
sudo make install&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;After that, I can execute &lt;code&gt;cadabra2-gtk&lt;/code&gt; without problems (most of the times, hehehe).&lt;/p&gt;
&lt;p&gt;Lately, I haven't been able of using the cadabra notebook... The source is compiled, but when I call &lt;code&gt;cadabra2-gtk&lt;/code&gt; I get the following:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(cadabra2-gtk:984345): Gtk-WARNING **: 11:47:21.946: Theme parsing error: gtk.css:68:35: The style property GtkButton:child-displacement-x is deprecated and shouldn't be used anymore. It will be removed in a future version

(cadabra2-gtk:984345): Gtk-WARNING **: 11:47:21.946: Theme parsing error: gtk.css:69:35: The style property GtkButton:child-displacement-y is deprecated and shouldn't be used anymore. It will be removed in a future version

(cadabra2-gtk:984345): Gtk-WARNING **: 11:47:21.946: Theme parsing error: gtk.css:70:34: The style property GtkCheckButton:indicator-size is deprecated and shouldn't be used anymore. It will be removed in a future version

(cadabra2-gtk:984345): Gtk-WARNING **: 11:47:21.946: Theme parsing error: gtk.css:71:36: The style property GtkCheckMenuItem:indicator-size is deprecated and shouldn't be used anymore. It will be removed in a future version

(cadabra2-gtk:984345): Gtk-WARNING **: 11:47:21.946: Theme parsing error: gtk.css:73:46: The style property GtkScrolledWindow:scrollbars-within-bevel is deprecated and shouldn't be used anymore. It will be removed in a future version

(cadabra2-gtk:984345): Gtk-WARNING **: 11:47:21.946: Theme parsing error: gtk.css:76:30: The style property GtkExpander:expander-size is deprecated and shouldn't be used anymore. It will be removed in a future version

(cadabra2-gtk:984345): Gtk-WARNING **: 11:47:21.949: Theme parsing error: gtk.css:83:29: The style property GtkStatusbar:shadow-type is deprecated and shouldn't be used anymore. It will be removed in a future version&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;which seems harmless... but also this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;cadabra-server: Symbol `PyInstanceMethod_Type' has different size in shared object, consider re-linking
cadabra-server: Symbol `PyCapsule_Type' has different size in shared object, consider re-linking
cadabra-server: Symbol `PyModule_Type' has different size in shared object, consider re-linking
cadabra-server: Symbol `PyType_Type' has different size in shared object, consider re-linking
cadabra-server: Symbol `PyByteArray_Type' has different size in shared object, consider re-linking
cadabra-server: Symbol `PyCFunction_Type' has different size in shared object, consider re-linking
cadabra-server: Symbol `PyProperty_Type' has different size in shared object, consider re-linking
cadabra-server: Symbol `PyBaseObject_Type' has different size in shared object, consider re-linking
cadabra-server: Symbol `PyFloat_Type' has different size in shared object, consider re-linking
*** stack smashing detected ***: terminated
terminate called after throwing an instance of 'std::logic_error'
  what():  Failed to read port from server.&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;At first the notebook opens, but after a couple of seconds it closes.&lt;/p&gt;
&lt;h1&gt;Question&lt;/h1&gt;
&lt;p&gt;What is happening to my cadabra installation?&lt;/p&gt;</description>
<category>Installation trouble</category>
<guid isPermaLink="true">https://cadabra.science/qa/2989/no-gui-after-compiling-from-the-source-manjaro</guid>
<pubDate>Thu, 02 Jan 2025 14:59:46 +0000</pubDate>
</item>
<item>
<title>derivatives are not evaluated in evaluation of components</title>
<link>https://cadabra.science/qa/2978/derivatives-are-not-evaluated-in-evaluation-of-components</link>
<description>&lt;p&gt;Hi,
I wanted to compute the metric of AdS&lt;em&gt;{d+1} through its embedding in \mathbb{R}^{d+2}.
When evaluating the components of the induced metric as below, it ends up with components that still contain derivatives, i.e. things like \partial&lt;/em&gt;{\phi}{\cos{\phi}}, whereas if I compute the derivative directly, e.g.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ll :=\partial_{\phi}{\cos{\phi}}
evaluate(ll);&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;it evaluates it correctly. So how do I evaluate these derivative if I have all the component together in an expression?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{t,\rho,\phi}::Coordinate;
{A,B}::Indices(higher,values={0,1,2,3}, position=fixed);
{\mu, \nu, \sigma, \kappa,\alpha,\beta,\gamma}::Indices(lower,values={t,\rho,\phi}, position=fixed);
X^{A}::Depends(t,\rho,\phi);

\partial{#}::PartialDerivative;

X^{A}::Depends(t,\rho,\phi,\partial_{\nu}{#});
g_{A B}::Metric(higher).
g^{A B}::InverseMetric(higher).

G_{\mu \nu}::Metric(lower).
G^{\mu \nu}::InverseMetric(lower).


metricRdp2 := [
g_{0 2} = 0, g_{0 3} = 0, g_{0 4} = 0,
g_{0 1} = 0, g_{1 2} = 0, g_{1 3} = 0,g_{1 4} = 0,
g_{2 3} = 0,g_{2 4} = 0,g_{3 4}= 0,  g_{4 4} = -1, g_{0 0} = -1, 
g_{1 1} = 1, g_{2 2} = 1, g_{3 3} = -1];

global2 := [ X^{0} = R \cosh{\rho} \cos{t}, 
X^{3} = R \cosh{\rho} \sin{t}, 
X^{1} = R \sinh{\rho} \sin{\phi},
X^{2} = R \sinh{\rho} \cos{\phi}];

cc := G_{\mu \nu} = \partial_{\mu}{X^{A}}\partial_{\nu}{X^{B}}g_{A B};

ex2 := G_{\mu \nu}:
substitute(ex2,cc);

evaluate(ex2)
canonicalise(ex2)
substitute(ex2,metricRdp2)
substitute(ex2,global2)
unwrap(ex2)
collect_factors(ex2);&lt;/code&gt;&lt;/pre&gt;</description>
<category>General questions</category>
<guid isPermaLink="true">https://cadabra.science/qa/2978/derivatives-are-not-evaluated-in-evaluation-of-components</guid>
<pubDate>Fri, 20 Dec 2024 13:12:42 +0000</pubDate>
</item>
<item>
<title>compile failed using boost 1.87</title>
<link>https://cadabra.science/qa/2975/compile-failed-using-boost-1-87</link>
<description>&lt;p&gt;Greetings good folk,&lt;/p&gt;
&lt;p&gt;I just updated/upgraded HomeBrew on my Mac Silicon and now Cadabra fails to compile. I did a bit of digging and it seems that in moving from version 1.85 to 1.87 Boost has removed the asio::io_service stuff. It seems that this was marked as deprcated for some time but now they've pulled the pin.&lt;/p&gt;
&lt;p&gt;I know next to nothing about C++ so I'm afraid I can't offer any fix. I did find a short discussion on stackoverflow here&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://stackoverflow.com/questions/59753391/boost-asio-io-service-vs-io-context&quot;&gt;https://stackoverflow.com/questions/59753391/boost-asio-io-service-vs-io-context&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The errors pop up mostly in this file&lt;/p&gt;
&lt;p&gt;&lt;code&gt;cadabra2/libs/websocketpp/websocketpp/transport/asio/connection.hpp&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Sorry to be the bearer of bad news in this festive season (:&lt;/p&gt;
&lt;p&gt;Cheers, Leo&lt;/p&gt;</description>
<category>Installation trouble</category>
<guid isPermaLink="true">https://cadabra.science/qa/2975/compile-failed-using-boost-1-87</guid>
<pubDate>Thu, 19 Dec 2024 23:01:07 +0000</pubDate>
</item>
<item>
<title>c++lib fails to compile</title>
<link>https://cadabra.science/qa/2970/c-lib-fails-to-compile</link>
<description>&lt;p&gt;On my system, &lt;code&gt;c++lib&lt;/code&gt; fails to compile properly. I needed to add the line
&lt;code&gt;${CMAKE_CURRENT_SOURCE_DIR}/../core/properties/DerivativeOp.cc&lt;/code&gt;
and also explicitly add the python include path, i.e.
&lt;code&gt;include_directories(/usr/include/python3.10)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;I'm not sending a fix because my Python include is obviously system-dependent; probably there is a correct way to do this.&lt;/p&gt;</description>
<category>Bug reports</category>
<guid isPermaLink="true">https://cadabra.science/qa/2970/c-lib-fails-to-compile</guid>
<pubDate>Tue, 10 Dec 2024 16:24:56 +0000</pubDate>
</item>
<item>
<title>Kronecker delta wrong output in 2D</title>
<link>https://cadabra.science/qa/2969/kronecker-delta-wrong-output-in-2d</link>
<description>&lt;p&gt;I'm basically following the &lt;a rel=&quot;nofollow&quot; href=&quot;https://cadabra.science/manual/eliminate_metric.html&quot;&gt;eliminate_metric example&lt;/a&gt; from the website:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{m, n, p, q, r}::Indices(vector, position=fixed).
{m, n, p, q, r}::Integer(0..9).
g_{m n}::Metric.
g^{m n}::InverseMetric.
g_{m}^{n}::KroneckerDelta.
g^{m}_{n}::KroneckerDelta.
ex:=g_{m p} g^{p m};
eliminate_metric(_);
eliminate_kronecker(_);&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;but I'm working with doubled coordinates, meaning that my coordinates go from 0 to 2D-1. Therefore, if I change the corresponding part to&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{m, n, p, q, r}::Integer(0..2*D-1).&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;the output is, against all odds and common sense, &lt;strong&gt;D&lt;/strong&gt;. You may be thinking that it won't work with such terms, but I've stumbled upon a bizzare bug; here are some examples of different inputs and outputs:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{m, n, p, q, r}::Integer(0..D).

D+1&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;{m, n, p, q, r}::Integer(0..2 D + 1).

2D+2&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;{m, n, p, q, r}::Integer(0..3D-1).

D&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;{m, n, p, q, r}::Integer(0..2*(D-1)).

2D-1&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It seems that when the dimensionality of Kronecker is a multiple of &lt;strong&gt;D&lt;/strong&gt;, it stops working properly. Any ideas on why this is happening? What can be done to fix it? &lt;/p&gt;</description>
<category>Bug reports</category>
<guid isPermaLink="true">https://cadabra.science/qa/2969/kronecker-delta-wrong-output-in-2d</guid>
<pubDate>Tue, 10 Dec 2024 15:45:07 +0000</pubDate>
</item>
<item>
<title>How to handle metric on submanifold?</title>
<link>https://cadabra.science/qa/2963/how-to-handle-metric-on-submanifold</link>
<description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I was trying to play with cadabra to study Einsteins equations at future null infinity.
I have the coordinates $u,r,\phi,\theta$, for which I use lowercase greek indices ($\mu,\nu,...$) and I want to use the coordinate $\phi, \theta$ just to label points on the sphere, which I would like to label with uppercase latin indices (A,B,C,..)&lt;/p&gt;
&lt;p&gt;Now I would like to define a metric just on the sphere, so I used in its definition only the indices A,B, hoping that it makes it an object only of those indices. Apparently this is not the case, since if I just evaluate the metric, I still get components written out for the u and r directions and if I try to complete the rule ssid, I get the error that the metric has zero determinant. Is there a way to make \gamma_{A B} an object only of the intrinsic coordinates \phi \theta such that e.g. complete works?&lt;/p&gt;
&lt;p&gt;Here my minimal example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{u,r,\phi,\theta}::Coordinate;

{\mu,\nu,\rho,\sigma}::Indices(higher,values={u,r,\phi,\theta}, position=fixed);
{A,B}::Indices(lower,values={\phi,\theta}, position=fixed,parent=higher);

\gamma_{A B}::Metric(lower, signature = 2);
\gamma^{A B}::InverseMetric(lower, signature = 2);
#\gamma_{A B}::Depends(r,\phi,\theta);

ssid:= {\gamma_{\phi \phi} = r**2*\sin(\theta)**2,   
       \gamma_{\theta \theta} = r**2
       };

ex1 := \gamma_{B A};
evaluate(ex1);
complete(ssid, $\gamma^{A B}$);&lt;/code&gt;&lt;/pre&gt;</description>
<category>General questions</category>
<guid isPermaLink="true">https://cadabra.science/qa/2963/how-to-handle-metric-on-submanifold</guid>
<pubDate>Sat, 07 Dec 2024 10:52:01 +0000</pubDate>
</item>
<item>
<title>Canonicalise Kernel crash</title>
<link>https://cadabra.science/qa/2962/canonicalise-kernel-crash</link>
<description>&lt;p&gt;Hello everyone.&lt;/p&gt;
&lt;p&gt;I am currently calculating a large expression in coordinates and using the canonicalise function to order partial derivatives without using sympy bridge. And I found that an expression of this kind causes the kernel to crash when executing the canonicalise function.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{t, x, y, z, u}::Coordinate.
{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,v,w#}::Indices(full, values={t,x,y,z,u}, position=independent).
\partial{#}::PartialDerivative.

p::Depends(t).
W_{m?}::Depends(t,x,y,z).

test := Dh \partial_{x}(W_{x}) \partial_{y}(W_{y}) (\partial_{t}(p))**2 (\partial_{t t}(p))**2 (a)**(-4) a2X;

canonicalise(test);&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I'm using Cadabra 2.5.8 (build 3421.a815a66da2 dated 2024-10-25) on Ubuntu 22.04.5&lt;/p&gt;
&lt;p&gt;update:&lt;/p&gt;
&lt;p&gt;I also noticed that if I write &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;canonicalise($\partial_{x}{W_{x}} \partial_{y}{W_{y} (\partial_{t}{p})**2 (\partial_{t t}{p})$);&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I get the following error:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Traceback (most recent call last): File &quot;/usr/local/lib/python3.10/dist-packages/cadabra2_jupyter/kernel.py&quot;, line 56, in do_execute self._execute_python(pycode) File &quot;/usr/local/lib/python3.10/dist-packages/cadabra2_jupyter/kernel.py&quot;, line 110, in _execute_python self._sandbox_context(pycode) File &quot;/usr/local/lib/python3.10/dist-packages/cadabra2_jupyter/context.py&quot;, line 51, in __call__ exec(code, self._sandbox) File &quot;&amp;lt;string&amp;gt;&quot;, line 1, in &amp;lt;module&amp;gt; IndexError: vector::_M_range_check: __n (which is 3) &amp;gt;= this-&amp;gt;size() (which is 3)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;and If if I replace &lt;code&gt;\partial_{t t}{p}&lt;/code&gt; with &lt;code&gt;(\partial_{t t}{p})**2&lt;/code&gt; , the kernel dies&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;canonicalise($\partial_{x}{W_{x}} \partial_{y}{W_{y} (\partial_{t}{p})**2 (\partial_{t t}{p})**2$);&lt;/code&gt;&lt;/pre&gt;</description>
<category>Bug reports</category>
<guid isPermaLink="true">https://cadabra.science/qa/2962/canonicalise-kernel-crash</guid>
<pubDate>Mon, 02 Dec 2024 19:13:19 +0000</pubDate>
</item>
<item>
<title>collect_factors / simplify with AntiCommuting objects</title>
<link>https://cadabra.science/qa/2958/collect_factors-simplify-with-anticommuting-objects</link>
<description>&lt;p&gt;This is a weird case and perhaps unlikely to be encountered in normal use, but I'm noting it here.&lt;/p&gt;
&lt;p&gt;Consider:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{A,X}::AntiCommuting.
ex := X A X;
sort_product(ex)
collect_factors(ex);&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The above produces a negative sign as one might suspect. However:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{A,X}::AntiCommuting.
ex := X A X;
collect_factors(ex);&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The above does not. Nor does this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{A,X}::AntiCommuting.
ex := X A X;
simplify(ex);&lt;/code&gt;&lt;/pre&gt;</description>
<category>Bug reports</category>
<guid isPermaLink="true">https://cadabra.science/qa/2958/collect_factors-simplify-with-anticommuting-objects</guid>
<pubDate>Thu, 21 Nov 2024 20:35:21 +0000</pubDate>
</item>
<item>
<title>Cadabra in Jupyter notebook - how to store?</title>
<link>https://cadabra.science/qa/2956/cadabra-in-jupyter-notebook-how-to-store</link>
<description>&lt;p&gt;Hello,
I'm working with Cadabra on Jupyter notebooks, specifically via JupyterHub running on a linux system.
I save my work and shuts down the computer until my next session, but then when I open the notbook again I see that the results are fonw, only the code is saved.
I think only once I managed to somehow save a notebook with all of the results still showing when I re-open it. I don't know how I did it.&lt;/p&gt;
&lt;p&gt;So my questio nis how to save a Cadabra-notebook (on a jupyterhub) with all the data still in the cache, and saved even after the computer is shut down?&lt;/p&gt;</description>
<category>General questions</category>
<guid isPermaLink="true">https://cadabra.science/qa/2956/cadabra-in-jupyter-notebook-how-to-store</guid>
<pubDate>Sun, 20 Oct 2024 12:59:00 +0000</pubDate>
</item>
<item>
<title>sympy(?) errors parsing nested derivatives?</title>
<link>https://cadabra.science/qa/2949/sympy-errors-parsing-nested-derivatives</link>
<description>&lt;p&gt;As a warmup exercise before what I &lt;em&gt;really&lt;/em&gt; want to do, I'm trying to compute the Laplacian operator in 2D plane polar coordinates. I do this by expressing &lt;code&gt;\partial_{x}&lt;/code&gt; and &lt;code&gt;\partial_{y}&lt;/code&gt; in terms of &lt;code&gt;\partial_{r}&lt;/code&gt; and &lt;code&gt;\partial_{\theta}&lt;/code&gt;, and then compute the sum of the squares of these operators.&lt;/p&gt;
&lt;p&gt;Of course, operator expressions like &lt;code&gt;\partial_x^2&lt;/code&gt; are quickly regurgitated, so I'm trying the following alternative:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Px:= { px = \cos{\phi} \partial_{r}{f} 
     - \frac{\sin\phi}{r} \partial_{\phi}{f} } ;

Pxx:= { pxx = \cos{\phi} \partial_{r}{px} 
     - \frac{\sin\phi}{r} \partial_{\phi}{px}};

substitute(Pxx,Px);

evaluate(Pxx);&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Cadabra gets the substitution correct, but evaluate() gives what looks like a sympy error:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{\color{red}{\begin{verbatim}TypeError: bad operand type for unary -: 'FunctionClass'

{\color{red}{\begin{verbatim}TypeError: bad operand type for unary -: 'FunctionClass'

TypeError: bad operand type for unary -: 'FunctionClass'
At:
  Notebook Cell (Line 0): 
  /tmp/.mount_CadabrIqWtS3/usr/lib/python3.8/dist-packages/sympy/parsing/sympy_parser.py(909): eval_expr
  /tmp/.mount_CadabrIqWtS3/usr/lib/python3.8/dist-packages/sympy/parsing/sympy_parser.py(1090): parse_expr
  Notebook Cell (Line 0): &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Btw, I was unable to copy and paste these red error messages out of cadabra easily by the usual highlight-and-click methods. I had to click Edit-&amp;gt;Copy and then paste it over here, but it still omitted the first line above (which I ended up typing in by hand).&lt;/p&gt;</description>
<category>Bug reports</category>
<guid isPermaLink="true">https://cadabra.science/qa/2949/sympy-errors-parsing-nested-derivatives</guid>
<pubDate>Tue, 01 Oct 2024 06:47:52 +0000</pubDate>
</item>
<item>
<title>\partial_\theta causes infinite loop(?) in server</title>
<link>https://cadabra.science/qa/2945/partial_-theta-causes-infinite-loop-in-server</link>
<description>&lt;p&gt;As in my previous questions, I have&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;f::Depends(r,\theta,\phi, vr, vtheta, vphi);&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The following works ok:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;exfr:= { fr = \partial_r{f} };&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;but&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;exfth:= { fth = \partial_\theta{f} };&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;makes the server go into some kind of infinite loop (i.e., consumes ~ 99% CPU). So I have to restart the kernel.&lt;/p&gt;
&lt;p&gt;Similarly,&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;exfvth:= { fvth = \partial_vtheta{f} };&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;causes infinite looping in server.&lt;/p&gt;
&lt;p&gt;Enclosing the \theta or vtheta in braces works ok, i.e.,&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;exfth:= { fth = \partial_{\theta}{f} };&lt;/code&gt;&lt;/pre&gt;</description>
<category>Bug reports</category>
<guid isPermaLink="true">https://cadabra.science/qa/2945/partial_-theta-causes-infinite-loop-in-server</guid>
<pubDate>Mon, 30 Sep 2024 08:53:35 +0000</pubDate>
</item>
<item>
<title>Gtk error messages on startup.</title>
<link>https://cadabra.science/qa/2941/gtk-error-messages-on-startup</link>
<description>&lt;p&gt;When I run Cadabra_2.5.6_x86_64.AppImage from a terminal I get the following error messages:&lt;/p&gt;
&lt;p&gt;Gtk-Message: 12:54:41.239: Failed to load module &quot;canberra-gtk-module&quot;
Gtk-Message: 12:54:41.264: Failed to load module &quot;window-decorations-gtk-module&quot;
Gtk-Message: 12:54:41.264: Failed to load module &quot;colorreload-gtk-module&quot;&lt;/p&gt;
&lt;p&gt;but it seems to keep running, although with fonts that are not my usual choice.&lt;/p&gt;
&lt;p&gt;Also, (not necessarily at startup) I get messages on the terminal saying&lt;/p&gt;
&lt;p&gt;cadabra-client: connection to server on port 33555 failed&lt;/p&gt;</description>
<category>Bug reports</category>
<guid isPermaLink="true">https://cadabra.science/qa/2941/gtk-error-messages-on-startup</guid>
<pubDate>Mon, 30 Sep 2024 03:02:33 +0000</pubDate>
</item>
<item>
<title>Custom display symbols for variables?</title>
<link>https://cadabra.science/qa/2940/custom-display-symbols-for-variables</link>
<description>&lt;p&gt;As well as the usual spherical polar coordinates r,\theta,\phi, I also want to use their velocites as coordinates, which I'm currently representing as vr, vtheta, vphi. 
I'd prefer to display the latter as (latex) \dot r, \dot\theta, \dot\phi.&lt;/p&gt;
&lt;p&gt;I vaguely recall cadabra1 had a way of doing this. Can I do it somehow in cadabra2?&lt;/p&gt;</description>
<category>General questions</category>
<guid isPermaLink="true">https://cadabra.science/qa/2940/custom-display-symbols-for-variables</guid>
<pubDate>Mon, 30 Sep 2024 02:37:00 +0000</pubDate>
</item>
<item>
<title>Simple derivative evaluation not working for me.</title>
<link>https://cadabra.science/qa/2939/simple-derivative-evaluation-not-working-for-me</link>
<description>&lt;p&gt;So I copied and modified that start of schwarzschild.cnb to my own notebook which I'll call Laplacian.cnb&lt;/p&gt;
&lt;p&gt;I modified the first code block to add some more coordinates vr, vtheta, vphi (intended to represent velocities -- I'm working in velocity phase space).&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{t,r,\theta,\phi, vt, vr, vtheta, vphi}::Coordinate;
{\mu,\nu,\rho,\sigma,\lambda,\kappa,\chi,\gamma}::Indices(values={t,r,\phi,\theta}, position=fixed);
\partial{#}::PartialDerivative;
g_{\mu\nu}::Metric.
g^{\mu\nu}::InverseMetric.&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now I try to define a simple (scalar) function
f, which is just &lt;code&gt;f() = r + vtheta**2&lt;/code&gt;  and try to evaluate &lt;code&gt;\partial_r f&lt;/code&gt;. My code block is&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;f::Depends(r,\theta,\phi, vr, vtheta, vphi);
exf:= { f = r + vtheta**2 } ;
exfr:= { fr = \partial_r{f} };
evaluate(exfr,exf);&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The final line of output is just &lt;code&gt;\partial_r f&lt;/code&gt;.
I.e., it didn't perform the partial derivative.
(The answer should have been 1.)&lt;/p&gt;
&lt;p&gt;What am I doing wrong?&lt;/p&gt;</description>
<category>General questions</category>
<guid isPermaLink="true">https://cadabra.science/qa/2939/simple-derivative-evaluation-not-working-for-me</guid>
<pubDate>Mon, 30 Sep 2024 02:27:19 +0000</pubDate>
</item>
<item>
<title>Another &quot;No module named 'sympy' &quot; question.</title>
<link>https://cadabra.science/qa/2934/another-no-module-named-sympy-question</link>
<description>&lt;p&gt;After a long absence I've decided to try and restart using Cadabra again.&lt;/p&gt;
&lt;p&gt;I'm running OpenSUSE (Leap) for which there doesn't seem to be a recent build on github, so I
downloaded Cadabra_2.5.4_x86_64.AppImage instead.&lt;/p&gt;
&lt;p&gt;Then I tried to run the schwarzschild.cnb tutorial. At the 2nd code block it complains that it cannot find the sympy module.&lt;/p&gt;
&lt;p&gt;I reinstalled Anaconda, then used conda to install and update python3 and sympy. This didn't help. I also tried &quot;pip install sympy&quot;, but this didn't help either.&lt;/p&gt;
&lt;p&gt;What am I doing wrong?&lt;/p&gt;
&lt;p&gt;[BTW: if I run python3 standalone, it imports sympy without complaint.]&lt;/p&gt;</description>
<category>Installation trouble</category>
<guid isPermaLink="true">https://cadabra.science/qa/2934/another-no-module-named-sympy-question</guid>
<pubDate>Sun, 29 Sep 2024 08:23:23 +0000</pubDate>
</item>
<item>
<title>Cycle freeze</title>
<link>https://cadabra.science/qa/2929/cycle-freeze</link>
<description>&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&gt;I often use the following function with a converge loop to simplify expressions:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;def tidy (expr):
   converge(expr):
       distribute(expr)
       product_rule(expr)
       sort_product(expr)
       collect_factors(expr)
   return expr&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But after today's update of cadabra to the latest version, this loop became infinite. Not for all expressions, but, for example, for this one&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{a,b,c,d,f,g,m,n,k,q,r,s,t,u,v,w,x,y,z,m#}::Indices(subspace, position=independent, parent=full);
\partial{#}::PartialDerivative.


expr := ((\phi)**(-2) + A_{a} h^{a b} A_{b}) (\partial_{n}((\phi)**2 A_{m}) + \partial_{m}((\phi)**2 A_{n}));&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Also, the problem only occurs if I use this function from a external file&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import functions as fun&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;so, if I use &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;fun.tidy(expr)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Loop is infinite.&lt;/p&gt;</description>
<category>Bug reports</category>
<guid isPermaLink="true">https://cadabra.science/qa/2929/cycle-freeze</guid>
<pubDate>Thu, 26 Sep 2024 15:31:48 +0000</pubDate>
</item>
<item>
<title>Expanding sum into time and purely space components.</title>
<link>https://cadabra.science/qa/2927/expanding-sum-into-time-and-purely-space-components</link>
<description>&lt;p&gt;Greetings.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Ricci tensor perturbations involve sum over spacetime components (in FLRW -&amp;gt;{t, r, \theta \varphi} ). How to expand spacetime sum (greek indices) into time and purely space components (latin indices)?&lt;/li&gt;
&lt;li&gt;For each Gamma and \delta{\Gamma} there are subrules (see related image):
&lt;em&gt;Gamma^{t}_{t t}= ...
&lt;/em&gt;Gamma^{t}_ {t i}=...
How to setup and substitute this relations in master equations? &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The core of programm is&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import cdb.core.manip as mp
import cdb.core.component as cmp
{t,r, \theta, \varphi}::Coordinate.
a::Depends(t).
{\mu, \nu, \rho, \sigma, \alpha, \beta, \gamma, \lambda, \tau, \chi, \iota, \upsilon, \omega}::Indices(curved,position=fixed,values={t,r, \theta, \varphi}).
{a,b,c,d,e,f,g,i,j,k,l,m,n,p,s}::Indices(position=fixed,values={r, \theta, \varphi})
gb{#}::LaTeXForm(&quot;\bar{g}&quot;).
gb_{\mu \nu}::Symmetric.
gb::Diagonal;
{gb^{\mu}_{\nu}, gb_{\mu}^{\nu}}::KroneckerDelta.
back := gb\_\{t t\}=\-1\, gb\_\{r r\}=a**2/(1-k*r**2), gb_{\theta \theta}=a**2*r**2, gb_{\varphi \varphi}=a**2*r**2*\sin{\theta}**2, gb^{t t}=-1, gb^{r r}=(1-k*r**2)/(a**2), gb^{\theta \theta}=1/(r**2_a**2), gb^{\varphi \varphi}=1/(a**2_r\*\*2\*\sin\{\theta\}\*\*2\)\, gb\_\{t r\}=0\, gb\_\{t \theta\}=0\, gb\_\{t \varphi\}=0\, gb\_\{r \theta\}=0\, gb\_\{r \varphi\}=0\, gb\_\{\theta \varphi\}=0\, gb\_\{r t\}=0\, gb\_\{\theta t\}=0\, gb\_\{\varphi t\}=0\, gb\_\{\theta r\}=0\, gb\_\{\varphi r\}=0\, gb\_\{ \varphi \theta\}=0;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In the part we define components of ricci perturbations:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;gs{#}::LaTeXForm(&quot;\overline{\gamma}&quot;)
dGamma{#}::LaTeXForm(&quot;\delta\Gamma&quot;);

dRic{#}::LaTeXForm(&quot;\delta R&quot;).
perric := \delta{R_{\mu \nu}} = \partial_{\sigma}{dGamma^{\sigma}_{\mu \nu}} - \partial_{\nu}{dGamma^{\sigma}_{\mu \sigma}} + dGamma^{\rho}_{\mu \nu} \Gamma^{\sigma}_{\rho \sigma} + \Gamma^{\rho}_{\mu \nu} dGamma^{\sigma}_{\rho \sigma} - dGamma^{\rho}_{\mu \sigma} \Gamma^{\sigma}_{\nu \rho} - \Gamma^{\rho}_{\mu \sigma} dGamma^{\sigma}_{\nu \rho};

dr1 = cmp.get_component(perric, $t,t$);
dr2 = cmp.get_component(perric, $t,i$);
dr3 = cmp.get_component(perric, $j,k$);&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;How to expand sum?&lt;/p&gt;
&lt;p&gt;We try to define relation for non perturbed Gamma!:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;eq1 := {\Gamma}^{t}_{i j}=(a \partial_{t}{a} {gs}_{i j});&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But error appear:
&lt;code&gt;RuntimeError: Free indices on lhs and rhs do not match.&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Thank you in advance for your help.
&lt;img src=&quot;https://files.catbox.moe/lmxthe.png&quot; alt=&quot;Relations from Weinberg&amp;#39;s &amp;quot;Cosmology&amp;quot;&quot;&gt;&lt;/p&gt;</description>
<category>General questions</category>
<guid isPermaLink="true">https://cadabra.science/qa/2927/expanding-sum-into-time-and-purely-space-components</guid>
<pubDate>Sat, 10 Aug 2024 12:23:25 +0000</pubDate>
</item>
<item>
<title>question about eliminate_metric</title>
<link>https://cadabra.science/qa/2920/question-about-eliminate_metric</link>
<description>&lt;p&gt;For example,&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{\mu,\nu,\rho}::Indices(vector).
g_{\mu\nu}::Metric.
g^{\mu\nu}::InverseMetric.
g_\mu^\nu::KroneckerDelta.
g^\mu_\nu::KroneckerDelta.
\delta{#}::Accent.

ex:=\delta{g_{\mu\nu}} g^{\nu\rho};
eliminate_metric(_);&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I get an odd result.&lt;/p&gt;</description>
<category>General questions</category>
<guid isPermaLink="true">https://cadabra.science/qa/2920/question-about-eliminate_metric</guid>
<pubDate>Fri, 02 Aug 2024 14:27:21 +0000</pubDate>
</item>
<item>
<title>A bug of Accent</title>
<link>https://cadabra.science/qa/2912/a-bug-of-accent</link>
<description>&lt;p&gt;For example, &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{a,b}::Indices(vector).
\delta{#}::Accent.
ex:=\delta{A^{a b}+B^{a b}}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Result is not right.&lt;/p&gt;</description>
<category>Bug reports</category>
<guid isPermaLink="true">https://cadabra.science/qa/2912/a-bug-of-accent</guid>
<pubDate>Thu, 01 Aug 2024 04:36:53 +0000</pubDate>
</item>
<item>
<title>I'm trying to reproduce equation 4.6 from 4.5 in Carrolls Spacettime ;and Geometry</title>
<link>https://cadabra.science/qa/2901/trying-reproduce-equation-from-carrolls-spacettime-geometry</link>
<description>&lt;p&gt;The following is my code.  The last line has a partial with respect to nu and I want to use the chain rule to convert to d/dlamda.  &lt;/p&gt;
&lt;p&gt;I'm an newbie here so I may be doing something reallty dumb.  I did convert the partial declaration to have the Derivative property so I don't end up with a double partial derivative of \nu and \lambda.  Any suggestions would be appreciated.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
{t,x,y,z,\lambda}::Coordinate.
{t,x,y,z,}::Depends(\lambda);
{\mu,\nu,\sigma,\rho,\alpha}::Indices(values={t,x,y,z},position=independent);
\nabla{#}::Derivative.
#\partial{#}::PartialDerivative;
\partial{#}::Derivative;

#deriv := \nabla_{\mu}{v?^{\nu}} -&amp;gt; \partial_{\mu}{v?^{\nu}} + \Gamma^{\nu}_{\sigma \mu} v?^{\sigma};

deriv := \nabla_{\nu}{\partial_{\lambda}{x^{\mu}}} -&amp;gt; \partial_{\nu}{\partial_{\lambda}{x^{\mu}}} 
    + \Gamma^{\mu}_{\sigma \nu} \partial_{\lambda}{x^{\sigma}};

expr := \partial_{\lambda}{x^{\nu}} * \nabla_{\nu}{\partial_{\lambda}{x^{\mu}}};

substitute(expr,deriv);

distribute(expr);
sort_product(expr);
&lt;/code&gt;&lt;/pre&gt;</description>
<category>General questions</category>
<guid isPermaLink="true">https://cadabra.science/qa/2901/trying-reproduce-equation-from-carrolls-spacettime-geometry</guid>
<pubDate>Thu, 27 Jun 2024 22:01:26 +0000</pubDate>
</item>
<item>
<title>Factor out of numerical coefficient</title>
<link>https://cadabra.science/qa/2899/factor-out-of-numerical-coefficient</link>
<description>&lt;p&gt;Hi everyone! I'm using cadabra for a several years, but still can't understand how to factor out numerical coefficients, for example &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;factor_out($6 A B + 6 A C$, $A$);&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;factor_out($6 A B + 6 A C$, $A,6$);&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It would be much prettier if you could factor out the numerical coefficient too. it doesn't affect the functionality, but when exporting formulas to latex, a lot of time is spent on manual editing.&lt;/p&gt;</description>
<category>General questions</category>
<guid isPermaLink="true">https://cadabra.science/qa/2899/factor-out-of-numerical-coefficient</guid>
<pubDate>Mon, 24 Jun 2024 13:41:15 +0000</pubDate>
</item>
<item>
<title>how to deal with lovelock gravity?</title>
<link>https://cadabra.science/qa/2898/how-to-deal-with-lovelock-gravity</link>
<description>&lt;p&gt;For Lovelock gravity,&lt;/p&gt;
&lt;p&gt;$$
L=R_{a_{2}b_{2}}^{c_{2}d_{2}}\cdots R_{a_{m}b_{m}}^{c_{m}d_{m}}\delta_{c_{2}d_{2}\cdots c_{m}d_{m}}^{a_{2}b_{2}\cdots a_{m}b_{m}}
$$&lt;/p&gt;
&lt;p&gt;where&lt;/p&gt;
&lt;p&gt;$$
\delta_{{jc_{1}d_{1}...c_{m}d_{m}}}^{{ia_{1}b_{1}...a_{m}b_{m}}}=\det\left[\begin{array}{c|ccc}\delta_{j}^{i} &amp;amp; \delta_{{c_{1}}}^{i} &amp;amp; \cdots &amp;amp; \delta_{{d_{m}}}^{i}\\hline \\delta_{j}^{{a&lt;em&gt;{1}}}\\vdots &amp;amp;  &amp;amp; \delta_{{c_{1}d_{1}...c_{m}d_{m}}}^{{a_{1}b_{1}...a_{m}b_{m}}}\\delta_{j}^{{b\&lt;/em&gt;{m}}}\end{array}\right]
$$&lt;/p&gt;
&lt;p&gt;when $m=2$, we get Einstein gravity; when $m=3$, we get Gauss-Bonnet gravity. But how to deal with it more generally? More concretely, I don't know how to do it use &lt;code&gt;for&lt;/code&gt; loop.&lt;/p&gt;</description>
<category>General questions</category>
<guid isPermaLink="true">https://cadabra.science/qa/2898/how-to-deal-with-lovelock-gravity</guid>
<pubDate>Sun, 23 Jun 2024 03:15:45 +0000</pubDate>
</item>
<item>
<title>LaTeXForm fails in version 2.5.2</title>
<link>https://cadabra.science/qa/2893/latexform-fails-in-version-2-5-2</link>
<description>&lt;p&gt;Greetings,&lt;/p&gt;
&lt;p&gt;This simple statement&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Dx{#}::LaTeXForm{&quot;Dx&quot;}.&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;raises a syntax error&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;SyntaxError: '{' was never closed&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I'm running Cadabra version 2.5.2. build 3043.2a1d62739a.&lt;/p&gt;
&lt;p&gt;Also, this version of Cadabra compiles fine under MacOS Sonoma 14.5.&lt;/p&gt;
&lt;p&gt;Cheers, Leo&lt;/p&gt;</description>
<category>Bug reports</category>
<guid isPermaLink="true">https://cadabra.science/qa/2893/latexform-fails-in-version-2-5-2</guid>
<pubDate>Mon, 17 Jun 2024 22:50:17 +0000</pubDate>
</item>
<item>
<title>substitute gives incorrect value on scalar expression</title>
<link>https://cadabra.science/qa/2892/substitute-gives-incorrect-value-on-scalar-expression</link>
<description>&lt;p&gt;Greetings,
I'm trying to use the &lt;code&gt;substitute&lt;/code&gt; algorithm to set the value of a scalar expression but I'm getting some very odd results. In the following examples I set a variable &lt;code&gt;s&lt;/code&gt; to be 1 and the expected result should be zero. But in the first case I get 2. This problem only seems to arise for the single choice of &lt;code&gt;s=1&lt;/code&gt;. 
Cheers, Leo&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# ----------------------------------------------------
# fails, should return 0

foo := s - s**3;

substitute (foo, $s = 1$);

# ----------------------------------------------------
# success

foo := s - s*s*s;

substitute (foo, $s = 1$);

# ----------------------------------------------------
# success

foo := s**3 - s;

substitute (foo, $s = 1$);

# ----------------------------------------------------
# success

foo := s - s**3;

substitute (foo, $s = 2$);

# ----------------------------------------------------
# success

foo := s - s**3;

substitute (foo, $s = 1/2$);
&lt;/code&gt;&lt;/pre&gt;</description>
<category>Bug reports</category>
<guid isPermaLink="true">https://cadabra.science/qa/2892/substitute-gives-incorrect-value-on-scalar-expression</guid>
<pubDate>Mon, 17 Jun 2024 22:25:46 +0000</pubDate>
</item>
<item>
<title>Cadabra 2.5.x released</title>
<link>https://cadabra.science/qa/2887/cadabra-2-5-x-released</link>
<description>&lt;p&gt;I have today taken Cadabra 2.5.x out of experimental mode and made it the default. &lt;/p&gt;
&lt;p&gt;This version contains built-in code to handle LaTeX typesetting, making the notebook interface much faster and enabling things like dynamical cell updates (e.g. updating counters) as well as full UTF-8 support for non-English languages (and emojis...). In the process, I have also fixed a number of issues with the notebook, e.g. interrupting calculations.&lt;/p&gt;
&lt;p&gt;As a bonus, it is now possible to distribute Cadabra as an AppImage on Linux, which installs on any reasonably modern distribution. Hopefully this will help to reach a larger audience. I have also updated the homebrew package for macOS. Standard .deb packages for Ubuntu 22.04 are available as well.&lt;/p&gt;
&lt;p&gt;Any feedback is welcome; please try this one and let me know!&lt;/p&gt;</description>
<category>Announcements</category>
<guid isPermaLink="true">https://cadabra.science/qa/2887/cadabra-2-5-x-released</guid>
<pubDate>Sat, 15 Jun 2024 19:27:27 +0000</pubDate>
</item>
<item>
<title>location of bracket blocks distribute</title>
<link>https://cadabra.science/qa/2876/location-of-bracket-blocks-distribute</link>
<description>&lt;p&gt;Hi Folks,&lt;/p&gt;
&lt;p&gt;Here are two instances of the &lt;code&gt;distribute&lt;/code&gt; algorithm. Only the first gives the expected result. The only difference in the code is where the opening bracket is placed.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# ----------------------------------------------
# this works as expected

foo := A (
       B + C);

distribute (foo);

# ----------------------------------------------
# this fails to apply the &quot;distribute&quot; algorithm

bah := A
       (B + C);

distribute (bah);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Cheers,
Leo&lt;/p&gt;</description>
<category>Bug reports</category>
<guid isPermaLink="true">https://cadabra.science/qa/2876/location-of-bracket-blocks-distribute</guid>
<pubDate>Tue, 11 Jun 2024 05:46:21 +0000</pubDate>
</item>
<item>
<title>leading scalar expression blocks canonicalise</title>
<link>https://cadabra.science/qa/2875/leading-scalar-expression-blocks-canonicalise</link>
<description>&lt;p&gt;Hi Troops,&lt;/p&gt;
&lt;p&gt;Here is s short Cadabra code&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{a,b,c,d,e,f#}::Indices(position=independent).

R_{a b c d}::RiemannTensor.

# this should give zero
foo := (1+s) R_{a b c d} p^{a} p^{b} p^{c} p^{d}.
canonicalise (foo);

# this gives the expected result
bah := s R_{a b c d} p^{a} p^{b} p^{c} p^{d}.
canonicalise (bah);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;There are two ouputs &lt;code&gt;foo&lt;/code&gt; and &lt;code&gt;bah&lt;/code&gt;. Both should be zero (beacuse of the symmetries of the Riemann tensor). But only &lt;code&gt;bah&lt;/code&gt; is correctly given as zero. This seems like a bug to me.&lt;/p&gt;
&lt;p&gt;Cheers,
Leo&lt;/p&gt;</description>
<category>Bug reports</category>
<guid isPermaLink="true">https://cadabra.science/qa/2875/leading-scalar-expression-blocks-canonicalise</guid>
<pubDate>Tue, 11 Jun 2024 05:35:33 +0000</pubDate>
</item>
<item>
<title>How to copy output as tex format in jupyter notebook?</title>
<link>https://cadabra.science/qa/2871/how-to-copy-output-as-tex-format-in-jupyter-notebook</link>
<description>&lt;p&gt;Today, I try cadabra2 in jupyter, and it's very nice, but I don't know how to do copy output as tex format. &lt;/p&gt;
&lt;p&gt;Update: When I right-click the mouse, I can see &lt;code&gt;mathjax copy latex&lt;/code&gt;, but this just works when I run cell, and it just can copy the final result.&lt;/p&gt;</description>
<category>General questions</category>
<guid isPermaLink="true">https://cadabra.science/qa/2871/how-to-copy-output-as-tex-format-in-jupyter-notebook</guid>
<pubDate>Mon, 27 May 2024 16:38:47 +0000</pubDate>
</item>
<item>
<title>imp package was removed from python 3.12</title>
<link>https://cadabra.science/qa/2863/imp-package-was-removed-from-python-3-12</link>
<description>&lt;p&gt;Hi!
I've find out that imp package was removed from python 3.12, and I can't import cdb.core.manip any more because the following error appears:
&lt;code&gt;ModuleNotFoundError: No module named 'imp'&lt;/code&gt;
imp module is deprecated in favour of importlib. &lt;/p&gt;</description>
<category>Bug reports</category>
<guid isPermaLink="true">https://cadabra.science/qa/2863/imp-package-was-removed-from-python-3-12</guid>
<pubDate>Sat, 18 May 2024 18:30:19 +0000</pubDate>
</item>
<item>
<title>Why does evaluate of metric eating vector shows only non-zero components.</title>
<link>https://cadabra.science/qa/2855/does-evaluate-metric-eating-vector-shows-only-zero-components</link>
<description>&lt;p&gt;I do not understand why g(.,v) only shows non-zero components after evaluation.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{m,n,a,b,c,r,s}::Indices(values={0,1,2,3}).
#
g_{a b}::Metric.
g^{a b}::InverseMetric.
#
g:=[g_{0 0}=-1, g_{0 1}=0, g_{0 2}=1, g_{0 3}=0, g_{1 0}=0,  g_{1 1}=1, g_{1 2}=0, g_{1 3}=0, g_{2 0}=1, g_{2 1}=0, g_{2 2}=1, g_{2 3}=0, g_{3 0}=0, g_{3 1}=0, g_{3 2}=0, g_{3 3}=1].
v:=[v^{0}=1, v^{1}=1, v^{2}=1, v^{3}=1];
display(v)
ex:=g_{a b} v^{a};
evaluate(ex,join(g,v), rhsonly=True);&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;OUTPUT gives
□_{b}
    {1} = 1
    {2} = 2
    {3} = 1&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Setting g00=1 (tather than -1 above) gives &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;□_{b}
    {0} = 2
    {1} = 1
    {2} = 2
    {3} = 1&lt;/code&gt;&lt;/pre&gt;</description>
<category>General questions</category>
<guid isPermaLink="true">https://cadabra.science/qa/2855/does-evaluate-metric-eating-vector-shows-only-zero-components</guid>
<pubDate>Tue, 14 May 2024 20:17:56 +0000</pubDate>
</item>
<item>
<title>How can I store the result of evaluating g(.,v) as a co-vector?</title>
<link>https://cadabra.science/qa/2852/how-can-i-store-the-result-of-evaluating-g-v-as-a-co-vector</link>
<description>&lt;p&gt;Mathematically I expect &lt;code&gt;g(.,v)&lt;/code&gt; to be a co-vector. Now, given: &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import cdb.core.component as comp
{m,n,a,b,c,d,q,r,s}::Indices(values={0,1}).
g_{a b}::Metric.
g^{a b}::InverseMetric.
g:=[g_{0 0}=28, g_{0 1}=2, g_{1 0}=3, g_{1 1}=-1];
v:=[v^{0}=12, v^{1}=-11];
ex:=g_{a b} v^{a};
gv:=evaluate(ex,join(g,v), rhsonly=True)
w:=w_{a};&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I would like to loop through components of &lt;code&gt;gv&lt;/code&gt; and assign component values produce the desired co-vector &lt;code&gt;w&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;w_{b}=comp.get_component(w, b);&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I have tried many approaches which fail.&lt;/p&gt;</description>
<category>General questions</category>
<guid isPermaLink="true">https://cadabra.science/qa/2852/how-can-i-store-the-result-of-evaluating-g-v-as-a-co-vector</guid>
<pubDate>Tue, 14 May 2024 15:40:59 +0000</pubDate>
</item>
<item>
<title>Christoffel symbols computation in $d$ dimensions with split indices</title>
<link>https://cadabra.science/qa/2851/christoffel-symbols-computation-dimensions-split-indices</link>
<description>&lt;p&gt;I have a metric of the form,
g_{\mu \nu} =&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;0&lt;/th&gt;
&lt;th&gt;0&lt;/th&gt;
&lt;th&gt;1&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;b_{ij}&lt;/td&gt;
&lt;td&gt;u&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;u^T&lt;/td&gt;
&lt;td&gt;f&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;where $u$ and $b_{i j }$ do not depend on the first coordinate $s$.
The inverse metric is
g^{\mu \nu} =&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;b^{i j} u_i u_j - f&lt;/th&gt;
&lt;th&gt;- u_i b^{i j}&lt;/th&gt;
&lt;th&gt;1&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;-b^{i j}u_j&lt;/td&gt;
&lt;td&gt;b^{i j}&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;I would like to compute the Christoffel symbols I first try to followed section 2.5 in the paper,
&lt;a rel=&quot;nofollow&quot; href=&quot;https://arxiv.org/pdf/hep-th/0701238&quot;&gt;https://arxiv.org/pdf/hep-th/0701238&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;After the comments I have updated my code, here is the edited code and an explanation. &lt;/p&gt;
&lt;p&gt;I wanted to split the Greek indices (${ \mu, \nu ...}$) into three parts: first: a capital Latin index that runs from 2 to $d$, second: small latin letters that  run from 2 to $d-1$ and the last index $s1, s2,s3$ to the last coordinate $d$. To simplify the problem I tried first $d=4$ so for example, $\mu=1,2,3,4$, $A=2,3,4$, $i,j = 2, 3$ and $s1=4$. 
To do this splitting I used, &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{\mu,\nu,\rho,\sigma,\kappa,\lambda,\eta,\chi#}::Indices(full, position=fixed, values={1,2,3,4}).
{A,B,C,D}::Indices(subspace, position=fixed, parent=full, values={2,3,4}).
{i,j, m,n,p,q,r,v#}::Indices(subspace2, position=fixed, parent=subspace, values={2,3}).
{s1,s2,s3}::Indices(subspace1, position=fixed, parent=subspace, values={4}).&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;the updated code following the sugestions in the comments is,&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;\partial{#}::PartialDerivative.
g_{\mu\nu}::Metric.
g^{\mu\nu}::InverseMetric.
g_{\mu? \nu?}::Symmetric.
g^{\mu? \nu?}::Symmetric.

b_{i j}::Metric.
b^{i j}::InverseMetric.
\delta^{\mu?}_{\nu?}::KroneckerDelta.
\delta_{\mu?}^{\nu?}::KroneckerDelta.

Gtog:= \Gamma^{\lambda}_{\mu \nu} -&amp;gt; (1/2) * g^{\lambda \kappa} (\partial_{\nu}{ g_{\kappa\mu}} + \partial_{\mu}{g_{\kappa \nu}} + \partial_{\kappa}{g_{\mu\nu} } );

Gamma4ij := \Gamma^{4}_{i j};

substitute(Gamma4ij, Gtog);

split_index(Gamma4ij, $\mu, 1, A$, repeat=True);

split_index(Gamma4ij, $A, i, 4$, repeat=True);&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code class=&quot;language-substitute(_, $g_{1 1} -&amp;gt; 0$ )&quot;&gt;substitute(_, $g_{1 m} -&amp;gt; 0$ )
substitute(_, $g_{1 4} -&amp;gt; 1$ )
substitute(_, $g_{m 1} -&amp;gt; 0$ )
substitute(_, $g_{m n} -&amp;gt; b_{m n}$ )
substitute(_, $g_{m 4} -&amp;gt; U_{m}$ )
substitute(_, $g^{4 1} -&amp;gt; 1$ )
substitute(_, $g_{4 m} -&amp;gt; U_{m}$ )
substitute(_, $g_{4 4} -&amp;gt; f$ )&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;substitute(_, $g^{1 1} -&amp;gt; U_{m} b^{m n} U_{n} - f$ )
substitute(_, $g^{1 m} -&amp;gt; - U_{n} b^{n m}$ )
substitute(_, $g^{1 4} -&amp;gt; 1$ )
substitute(_, $g^{m 1} -&amp;gt; - U_{n} b^{n m}$ )
substitute(_, $g^{m n} -&amp;gt; b^{n m}$ )
substitute(_, $g^{m 4} -&amp;gt; 0$ )
substitute(_, $g^{4 1} -&amp;gt; 1$ )
substitute(_, $g^{4 m} -&amp;gt; 0$ )
substitute(_, $g^{4 4} -&amp;gt; 0$ )&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;substitute(_, $\partial_{1}{U??} -&amp;gt; 0$, repeat=True)
substitute(_, $\partial_{1 \mu?}{U??} -&amp;gt; 0$, repeat=True)
substitute(_, $\partial_{\mu? 1}{U??} -&amp;gt; 0$, repeat=True)
substitute(_, $\partial_{\mu? 1}{b???} -&amp;gt; 0$, repeat=True)

canonicalise(_);&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I obtained the output $\Gamma^{4}_{i j} $, while if I change the definition of the Christoffel symbols and include ?, &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Gtog:= \Gamma^{\lambda?}_{\mu?\nu?} -&amp;gt;
 (1/2) * g^{\lambda?\kappa} (
 \partial_{\nu?}{ g_{\kappa\mu?} } + \partial_{\mu?}{g_{\kappa\nu?} }
- \partial_{\kappa}{ g_{\mu?\nu?} } ); &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I obtain 0, but I know $\Gamma^{4}$ is not 0 so I don't know where my code is wrong.
I would like to ask, how can I improve it and how can I generalise it to $d$ dimensions.&lt;/p&gt;</description>
<category>General questions</category>
<guid isPermaLink="true">https://cadabra.science/qa/2851/christoffel-symbols-computation-dimensions-split-indices</guid>
<pubDate>Tue, 14 May 2024 14:17:33 +0000</pubDate>
</item>
</channel>
</rss>