Cadabra Q&A - Recent questions and answers
https://cadabra.science/qa/qa
Powered by Question2AnswerAnswered: The sign of the Tides tensor is incorrect
https://cadabra.science/qa/2330/the-sign-of-the-tides-tensor-is-incorrect?show=2333#a2333
<p>Just to be clear, I got the correct result. The problem was solved when I changed the indices that where summed over by the vierbeins, i.e</p>
<p><code>K^{a}_{b}=R^{\mu}_{\rho\nu\beta}ei^{a}_{\mu}i^{\rho}_{t}i^{\nu}_{b}i^{\beta}_{t} -> K^{a}_{b}=R^{\mu}_{\rho\nu\beta}ei^{a}_{\mu}i^{\rho}_{t}i^{\beta}_{b}i^{\nu}_{t}</code></p>General questionshttps://cadabra.science/qa/2330/the-sign-of-the-tides-tensor-is-incorrect?show=2333#a2333Wed, 28 Sep 2022 14:51:12 +0000How to add new properties: "Normal" and "Othogonal"
https://cadabra.science/qa/2327/how-to-add-new-properties-normal-and-othogonal
<p>Hi, I want to know how to code properly for Cadabra. I read the section on programming in "The Cadabra Book" pdf but I need a little more explanation on programming new properties (like "::Coordinate")</p>
<p>I want to generate two new properties</p>
<ul>
<li>"Normal" can be applied to a 1D tensor (vector or covector)</li>
<li>"Orthogonal" can be applied to any tensor (that is not a scalar)</li>
</ul>
<p>Then if I have an expression with contraction of two tensors then I will write a function such that</p>
<ol>
<li>if the two tensors are normal vectors then their contraction is -1</li>
<li>if one tensor is orthogonal and the other is a normal (co)vector then their contraction is 0</li>
</ol>General questionshttps://cadabra.science/qa/2327/how-to-add-new-properties-normal-and-othogonalFri, 23 Sep 2022 09:51:43 +0000Questions about KroneckerDelta
https://cadabra.science/qa/2326/questions-about-kroneckerdelta
<p>The following codes </p>
<p><code>{t,x,y,z,r}::Coordinate; \delta{#}::KroneckerDelta. {i,j,k,l,m,n,o,p,q,s#}::Indices(fourD,values={t,x,y,z},position=independent); {i,j,k,l,m,n,o,p,q,s#}::Integer(range=0..3) xx:=\delta^1_1^2_2; evaluate(_); </code></p>
<p>give me the ouput :
<code>0</code></p>
<p>But, in my opinion I should get the value <code>1/2</code>.</p>
<p>Further, I run </p>
<p><code>xx2:=\delta^1_1^2_2; expand_delta(_); eliminate_kronecker(_); evaluate(_); </code>
at last, I get</p>
<p><code>RuntimeError: evaluate: Index 1 does not have an Indices property. At: Notebook Cell (Line 1): _ = evaluate(_); display(_) </code></p>General questionshttps://cadabra.science/qa/2326/questions-about-kroneckerdeltaTue, 13 Sep 2022 06:31:33 +0000Issue in sort_product() with AntiCommuting indices.
https://cadabra.science/qa/2325/issue-in-sort_product-with-anticommuting-indices
<p>I have the need for anti-commuting derivatives and objects so am trying to use anti-commuting indices instead of making the objects/derivatives themselves anti-commuting. product_rule() works as expected\, but I've found issues in sort_product() with this approach.</p>
<p>For example see the following code where I try sorting with various combinations of anti-commuting spinor indices and commuting vector indices.</p>
<pre><code>{\alpha, \beta, \rho, \lambda}::Indices(spinor, position=independent).
{\alpha, \beta, \rho, \lambda}::AntiCommuting.
{a, b, c}::Indices(vector, position=free).
\nabla{#}::Derivative.
{X{#}}::Depends(\nabla{#}).
zeroDer := X^{\alpha} X^{\beta} + X^{\beta} X^{\alpha};
sort_product(_);
oneDerSpinor := \nabla_{\alpha}(X^{\beta}) X^{\rho} + X^{\rho}\nabla_{\alpha}(X^{\beta});
sort_product(_);
oneDerVector := \nabla_{a}(X^{\beta}) X^{\rho} + X^{\rho}\nabla_{a}(X^{\beta});
sort_product(_);
twoDerSpinor := \nabla_{\lambda}(\nabla_{\alpha}(X^{\beta})) X^{\rho} + X^{\rho}\nabla_{\lambda}(\nabla_{\alpha}(X^{\beta}));
sort_product(_);
twoDerVector:= \nabla_{a}(\nabla_{b}(X^{\beta})) X^{\rho} + X^{\rho}\nabla_{a}(\nabla_{b}(X^{\beta}));
sort_product(_);</code></pre>
<p>You'll find that some of these combine correctly while some do not. If I attach AntiCommuting to X, it fixes some while breaking others. If my approach is incorrect, I'd greatly appreciate any other suggestions on how to handle AntiCommuting derivatives. I'm on macOs using Cadabra 2.3.8.</p>
<p>Thank you!
Greg</p>Bug reportshttps://cadabra.science/qa/2325/issue-in-sort_product-with-anticommuting-indicesFri, 19 Aug 2022 08:16:23 +0000Answered: Adjoint Spinor subscript Labels
https://cadabra.science/qa/2305/adjoint-spinor-subscript-labels?show=2316#a2316
<p>This is now fixed in 2.3.9.5 available on github.</p>
<p>Just for the record, you don't have to give <code>LaTeXForm</code> properties for symbols with numbers at the end. The <code>\psi1</code> symbol will automatically typeset as $$\psi_{1}$$.</p>General questionshttps://cadabra.science/qa/2305/adjoint-spinor-subscript-labels?show=2316#a2316Tue, 09 Aug 2022 16:28:26 +0000Answered: Problem with changed behaviour of '+' for lists.
https://cadabra.science/qa/2296/problem-with-changed-behaviour-of-for-lists?show=2302#a2302
<p>Apart from the 'tie' operator, there is now also the 'join' function. So you can do either</p>
<pre><code>ex1:={A,B};
ex2:={C,D};
ex3:= @(ex1) ~ @(ex2);</code></pre>
<p>to get <code>{A,B,C,D}</code>, or you can do</p>
<pre><code>ex1:={A,B};
ex2:={C,D};
ex3 = join(ex1, ex2)</code></pre>
<p>Join on a single element and a list will just add that element to the list, and join on two single elements will create a two-element list.</p>
<p>This was a quick hack not really thought through very deeply, so please report issues with this if you find any.</p>
<p><strong>Added</strong>: Just to explain why this was all necessary: I am working on fast numerical evaluation of symbolic expressions. This frequently involves component-wise addition of lists or nested lists. Since both Numpy and Mathematica use '+' for component-wise list addition, I decided to follow that.</p>Bug reportshttps://cadabra.science/qa/2296/problem-with-changed-behaviour-of-for-lists?show=2302#a2302Fri, 05 Aug 2022 14:14:39 +0000Answered: Variable can be handled like values?
https://cadabra.science/qa/813/variable-can-be-handled-like-values?show=2299#a2299
<p>I'd like to provide the full answer using Kasper's suggestion (and adding a few changes of my own)</p>
<pre><code>z::Coordinate;
{a,b,c,d}::Indices(values={0,1,2, 3, z},position=fixed);
\Gamma{#}::GammaMatrix(metric=\eta);
\eta{a b}::KroneckerDelta;
C_{a b c}::AntiSymmetric;
D^{a b c}::AntiSymmetric;
ex1:= C_{a b c} \Gamma^{a b c};
ex2:= C_{a b c} D^{a b c};
rl:= { C_{0 1 2} = \alpha, C_{1 2 3} = \beta, C_{1 2 z} = \gamma, D^{1 2 3} = \theta, D^{1 2 z} = \tau};
evaluate(ex1, rl);
evaluate(ex2, rl);</code></pre>
<p>The result of the code is <a rel="nofollow" href="https://ibb.co/5kwmQ2K">here</a></p>General questionshttps://cadabra.science/qa/813/variable-can-be-handled-like-values?show=2299#a2299Fri, 05 Aug 2022 09:37:56 +0000Answered: Substitution $A \mapsto A + \delta_A$
https://cadabra.science/qa/2297/substitution-%24a-mapsto-a-delta_a%24?show=2298#a2298
<p>Hi <code>novice0516</code>.</p>
<p>I'm not sure what is your aim with your notebook, but I know that the capabilities of <code>cadabra2</code> with differential forms is far from optimal... you might note that not even all the properties and algorithms are documented! (btw, it would be great to help developing those missing capabilities).</p>
<p>From my ignorance, I'd suggest to follow a different approach.</p>
<h2>Some critics to your workflow:</h2>
<ul>
<li>Your are defining differential forms but you are not using the wedge product.</li>
<li>If you substitute an object with a derivative, What is the <em>scope</em> of the derivative?</li>
<li>I would argue that your substitution is changing the degree of the expression.</li>
</ul>
<h2>Suggestions</h2>
<p>Please take into account that my suggestions come from the ignorance of your purpose.</p>
<ul>
<li>I'd define my objects as non-commutative (if necessary). Your operetors <code>A</code>, <code>B</code>, <code>C</code> and <code>D</code> should commute but in the example below I defined as non-commuting just for fun!</li>
<li>If you define the variations as derivative, general derivatives do not commute! (I've included a commented line with the explicit declaration anyway).</li>
<li>Define the scope of the derivative operators</li>
</ul>
<h2>Code</h2>
<pre><code>{A,B,C,D}::NonCommuting;
{da{#},db{#}}::Derivative;
# {da{#},db{#}}::NonCommuting;
ex:= da{ B C D};
converge(ex):
distribute(_)
product_rule(_)
;</code></pre>
<p>I tried the second derivative</p>
<pre><code>ex:= db{da{ B C D }};
converge(ex):
distribute(_)
product_rule(_)
;</code></pre>
<p>And the commutator of derivatives</p>
<pre><code>ex:= db{da{ B C D }} - da{db{ B C D }};
converge(ex):
distribute(_)
product_rule(_)
;</code></pre>
<p>Let me know if my suggestions were useful, but remember that my intention is to give you a different way to try your programme.</p>
<p>Cheers.</p>General questionshttps://cadabra.science/qa/2297/substitution-%24a-mapsto-a-delta_a%24?show=2298#a2298Mon, 01 Aug 2022 10:17:16 +0000Answered: Similar terms are not collected
https://cadabra.science/qa/2292/similar-terms-are-not-collected?show=2294#a2294
<p>This issue is now hopefully fixed, in version 2.3.9.3 which is the current head of the github master branch. Please let me know.</p>Bug reportshttps://cadabra.science/qa/2292/similar-terms-are-not-collected?show=2294#a2294Wed, 22 Jun 2022 18:20:34 +0000Answered: sort_product bug with position=independent and identical variables
https://cadabra.science/qa/2291/sort_product-with-position-independent-identical-variables?show=2293#a2293
<p>Thanks for creating a minimal example! This issue should be fixed in 2.3.9.3, which is on the current github master branch.</p>Bug reportshttps://cadabra.science/qa/2291/sort_product-with-position-independent-identical-variables?show=2293#a2293Wed, 22 Jun 2022 18:18:33 +0000Answered: Using spherical harmonics in cadabra.
https://cadabra.science/qa/2289/using-spherical-harmonics-in-cadabra?show=2290#a2290
<p>Cadabra currently does not have any functionality for spherical harmonics. There is some support for that in sympy though, which may help. As long as you go from a Cadabra expression to a sympy expression all is fine; getting expressions from sympy back into Cadabra for further computations is not very well supported at the moment. </p>Feature requestshttps://cadabra.science/qa/2289/using-spherical-harmonics-in-cadabra?show=2290#a2290Thu, 02 Jun 2022 18:03:52 +0000Cadabra 2 notebooks and REPL more responsive than script interpreter
https://cadabra.science/qa/2288/cadabra-notebooks-repl-more-responsive-script-interpreter
<p>I am having some trouble using the <code>diff</code> command. If run Cadabra2 REPL with <code>cadabra2</code> it works just fine:</p>
<pre><code>> ex:= A*A + B + C;
A A + B + C
> diff(ex, $A$);
2*A</code></pre>
<p>Same with the GTK GUI. I would expect it to do the same if I put my commands into a <code>.cdb</code> file and ran <code>cadabra2 file.cdb</code>. File contents are</p>
<pre><code>ex:= A*A + B + C;
diff(ex, $A$);</code></pre>
<p>so exactly the same thing, but <code>diff</code> just spits the original expression back at me instead:</p>
<pre><code>$ cadabra2 file.cdb
A A + B + C
A A + B + C</code></pre>
<p>It seems to just echo the last expression before the diff command; if I put some other expression in between the two,</p>
<pre><code>ex:= A*A + B + C;
foo:= B;
diff(ex, $A$);</code></pre>
<p>the output is</p>
<pre><code>$ cadabra2 file.cdb
A A + B + C
B
B</code></pre>
<p>Surely this is not intentional?</p>Bug reportshttps://cadabra.science/qa/2288/cadabra-notebooks-repl-more-responsive-script-interpreterSun, 22 May 2022 21:11:05 +0000Answered: doubt about how to make assumptions in multiple files
https://cadabra.science/qa/2286/doubt-about-how-to-make-assumptions-in-multiple-files?show=2287#a2287
<p>Put these lines in a separate notebook, let's say <code>defs.cnb</code>. Then import that notebook into another one by doing <code>import defs</code>. </p>General questionshttps://cadabra.science/qa/2286/doubt-about-how-to-make-assumptions-in-multiple-files?show=2287#a2287Sat, 21 May 2022 10:29:43 +0000Answered: Generic TeX error bug
https://cadabra.science/qa/2184/generic-tex-error-bug?show=2185#a2185
<p>There are a few things going on here. Let me start with the right way to do this:</p>
<pre><code>test := e_{\mu}{}^{a};
for n in test:
display(n.ex())</code></pre>
<p>In order to display Cadabra expressions, it's almost always best to use <code>display</code>, as <code>print</code> lacks the logic to make the notebook display LaTeX expressions. The <code>display</code> function ensures that many things (mathematical expressions, plots, ...) show up in the best way in the notebook.</p>
<p>You also need <code>n.ex()</code>, not just <code>n</code>, because <code>display</code> does not (yet) understand the <code>ExNode</code> object (which <code>n</code> is). For everything it does not understand, it calls <code>str</code> on it, and then you are effectively back to what you wrote. By calling <code>n.ex()</code> you convert the <code>ExNode</code> object <code>n</code> to an <code>Ex</code> object, which <code>display</code> knows how to handle.</p>
<p>Finally: I agree it would have been useful if <code>str(n)</code> produced something printable in the notebook (so that your original code would display the three expressions in non-typeset LaTeX form). Unfortunately, by default <code>str</code> turns <code>\mu</code> into the Unicode symbol for that character, and LaTeX doesn't understand that. This is a bug, we should turn off Unicode printing in the notebook.</p>Bug reportshttps://cadabra.science/qa/2184/generic-tex-error-bug?show=2185#a2185Thu, 31 Mar 2022 08:09:30 +0000Answered: Substitution employing double overline accent?
https://cadabra.science/qa/2180/substitution-employing-double-overline-accent?show=2181#a2181
<p>That's because your first term contains</p>
<pre><code>\overline{ \overline{u_{i}} \overline{u_{j}} }</code></pre>
<p><em>not</em></p>
<pre><code>\overline{ \overline{ u_{i} u_{j} } }</code></pre>
<p>So your pattern in <code>rl2</code> does not match.</p>
<p>It's difficult to see in the LaTeX output as the two overlines merge, but if you print the tree-form
with <code>print(tree(conv))</code> you can see it.</p>General questionshttps://cadabra.science/qa/2180/substitution-employing-double-overline-accent?show=2181#a2181Thu, 03 Mar 2022 20:00:26 +0000Answered: Issue with eliminate metric
https://cadabra.science/qa/2176/issue-with-eliminate-metric?show=2177#a2177
<p>If you want to use metrics to raise/lower your indices, then you <em>cannot</em> declare them as <code>position=free</code>. The latter means that the position of indices (subscript/superscript) has no meaning and can be changed arbitrarily, without factors of the metric. But worse, it means that all your patterns collapse to a single one, because upper indices will match lower indices and vice versa.</p>
<p>If you change your first line to contain <code>position=fixed</code> then things work as expected. The <code>eliminate_metric</code> will then not do anything (since there is no metric in your expression), but <code>eliminate_kronecker</code> will replace the $g_{\mu}{}^{\mu}$ with $d$. A further <code>canonicalise</code> will remove the $\Gamma^{\mu}{}_{\mu}$.</p>Bug reportshttps://cadabra.science/qa/2176/issue-with-eliminate-metric?show=2177#a2177Sun, 27 Feb 2022 18:21:39 +0000Answered: issue installing on mac
https://cadabra.science/qa/2174/issue-installing-on-mac?show=2175#a2175
<p>A quick <code>brew search sigc++</code> brings up the <code>libsigc++</code> package. Try doing </p>
<pre><code>brew install libsigc++</code></pre>
<p>and then do the <code>cmake</code> stage again.</p>
<p>This used to be automatic when installing <code>gtkmm</code>, as the latter requires <code>sigc++</code>, but someone seems to have removed that dependency from the brew repository.</p>General questionshttps://cadabra.science/qa/2174/issue-installing-on-mac?show=2175#a2175Mon, 21 Feb 2022 09:16:44 +0000Answered: question regarding a rule involving partial derivative
https://cadabra.science/qa/2169/question-regarding-a-rule-involving-partial-derivative?show=2170#a2170
<p>Hi, I've got a similar problem before, and it is due (to my understanding) to the fact that cadabra uses the notation </p>
<p>$\partial_{ab}$ </p>
<p>to denote </p>
<p>$\partial<em>{a}\partial</em>{b}.$</p>
<p>I solved my problem by adding a <em>dummy</em> symbol that can be then set to one after the simplification (if it is still around), I used the symbol <strong>I</strong> in the <code>ex2</code> below</p>
<pre><code>{a,b,c}::Indices.
\partial{#}::PartialDerivative.
ex := \partial_{a}{ A^a } + A_a B^a + \partial_{a}{ \partial_{b}{ A^a }} B^b
+ \partial_{a}{ A^b } \partial_{b}{ B^a };
ex2 := \partial_{a}{ A^a } + A_a B^a + \partial_{a}{ I \partial_{b}{ A^a }} B^b
+ \partial_{a}{ A^b } \partial_{b}{ B^a };
rl := \partial_{a}{ A^{b} } -> 0;
substitute(ex, rl);
substitute(ex2, rl);</code></pre>
<p><a rel="nofollow" href="https://ibb.co/NyGKG9y">See the result here</a></p>
<p>Hope this can be useful.</p>
<hr>
<p><strong>Update:</strong></p>
<p>Another solution is that you could declare <code>\partial{#}::Derivative.</code> instead of like a partial derivative. The difference is that <code>Derivative</code> does not simplify the notation </p>
<p>$\partial<em>{a}\partial</em>{b}$ </p>
<p>to </p>
<p>$\partial_{ab},$</p>
<p>and the substitution works properly.</p>
<p><a rel="nofollow" href="https://ibb.co/nQ22VCG">See the updated code and result</a></p>Feature requestshttps://cadabra.science/qa/2169/question-regarding-a-rule-involving-partial-derivative?show=2170#a2170Mon, 14 Feb 2022 09:56:47 +0000Answered: converting partial derivative to covariant derivative
https://cadabra.science/qa/2167/converting-partial-derivative-to-covariant-derivative?show=2168#a2168
<p>If you want to prevent <code>canonicalise</code> from raising or lowering indices, declare those indices with the <code>position=independent</code> property (not <code>position=fixed</code>). That seems to work in your example. </p>
<p>You will still need some <code>eliminate_metric</code>, <code>eliminate_kronecker</code> and <code>sort_product</code> after that.</p>General questionshttps://cadabra.science/qa/2167/converting-partial-derivative-to-covariant-derivative?show=2168#a2168Fri, 11 Feb 2022 12:12:53 +0000Answered: Question about eliminate metric
https://cadabra.science/qa/2163/question-about-eliminate-metric?show=2164#a2164
<p>I can't reproduce that problem; the following returns the expression unchanged:</p>
<pre><code>{a,b,c,d}::Indices(position=fixed);
\partial{#}::PartialDerivative;
g{#}::Depends(\partial{#});
g^{a b}::InverseMetric;
g_{a b}::Metric;
ex:=g^{a b}\partial_{c}{g_{b d}};
eliminate_metric(ex);</code></pre>
<p>Can you post a self-contained example that shows the problem?</p>General questionshttps://cadabra.science/qa/2163/question-about-eliminate-metric?show=2164#a2164Fri, 04 Feb 2022 07:36:43 +0000Answered: copy the output and feed as another input
https://cadabra.science/qa/2092/copy-the-output-and-feed-as-another-input?show=2093#a2093
<p>Copy-paste is almost never the right solution for this kind of problem, as it means that for any change you make later, you have to go through that manual process again.</p>
<p>Instead, in those 6 files, write the final expression to disk as described in </p>
<p><a rel="nofollow" href="https://cadabra.science/notebooks/ref_import.html">https://cadabra.science/notebooks/ref_import.html</a></p>
<p>(see the "writing expressions to a file and reading them back" section) and then read them back into your main notebook. </p>General questionshttps://cadabra.science/qa/2092/copy-the-output-and-feed-as-another-input?show=2093#a2093Sun, 30 Jan 2022 12:31:38 +0000Answered: diffrentiation of an expression
https://cadabra.science/qa/2086/diffrentiation-of-an-expression?show=2090#a2090
<p>First an explanation of what happens here (feel free to skip): When you call <code>diff</code>, what you are actually doing is calling a Sympy function. In order for Sympy to act on your Cadabra expression, it will convert it to a Sympy object by calling <code>S._sympy_()</code>. However, that will produce a version of your expression in which tensor indices are replaced with <code>DN</code>+name or <code>UP</code>+name depending on the position. Once the <code>diff</code> function completes, it returns a Sympy expression, which then stays that way; it does not magically become a Cadabra <code>Ex</code> expression again.</p>
<p>So you need to define your own <code>diff</code>, which converts the Cadabra expression to Sympy form, applies the Sympy function, and then converts back to a Cadabra expression. That's easy,</p>
<pre><code>def diff(ex1, ex2):
ret = $@(ex1)$
sb = SympyBridge(ret)
sb.from_sympy( str(sympy.diff( sb.to_sympy(), ex2 ) ) )
return ret</code></pre>
<p>Then this works:</p>
<pre><code>ex := A_{a}(r) r;
diff( ex, $r$ )</code></pre>
<p>which produces a new Cadabra expression</p>
<p>$$r \partial_{r}( A_{a}(r) ) + A_{a}(r)$$</p>
<p>Final note: yes, functions like that really should be part of the <code>cdb.sympy</code> package. Lack of time...</p>General questionshttps://cadabra.science/qa/2086/diffrentiation-of-an-expression?show=2090#a2090Sat, 29 Jan 2022 21:39:58 +0000Answered: simplifying expression
https://cadabra.science/qa/2084/simplifying-expression?show=2089#a2089
<p>Hi,</p>
<p>I was able to resolve this issue. After the last command, I added <code>collect_factors()</code> which did the job.</p>General questionshttps://cadabra.science/qa/2084/simplifying-expression?show=2089#a2089Sat, 29 Jan 2022 09:12:57 +0000Answered: Bug in string_states example
https://cadabra.science/qa/2082/bug-in-string_states-example?show=2083#a2083
<p>Ouch, that's a brown paper bag one! What should happen is that a delta with different indices which have a <code>Coordinate</code> property becomes zero. Instead, it did it for every symbolic index. No idea how this slipped through the automatic tests...</p>
<p>Now fixed in github master. Since this wrong cleanup happened only for <code>Diagonal</code> objects, simply not using that property also avoids the problem (as you already observed). Thanks for reporting this.</p>Bug reportshttps://cadabra.science/qa/2082/bug-in-string_states-example?show=2083#a2083Mon, 24 Jan 2022 14:47:38 +0000Answered: Minus sign to index-dependent power
https://cadabra.science/qa/2079/minus-sign-to-index-dependent-power?show=2080#a2080
<p>It's doing the correct thing to the expression, but the result is not written in canonical form, and because of that displays incorrectly. What it's actually showing is</p>
<pre><code>- \alpha_{-1}^{\mu} { -1 }^{1}</code></pre>
<p>and because the curly brackets around the <code>-1</code> do not show, you get this weird looking result.</p>
<p>The quickest way to fix this is to add an</p>
<pre><code>expand_power(ex)</code></pre>
<p>inside your <code>bpz</code> function; that will turn <code>(-1)^1</code> into <code>(-1)</code> which then gets absorbed into product correctly. Using <code>simplify(ex)</code> will also work, but is much slower and requires a roundtrip through sympy's simplify function.</p>
<p>It's a bug of course, I have registered it as <a rel="nofollow" href="https://github.com/kpeeters/cadabra2/issues/247">https://github.com/kpeeters/cadabra2/issues/247</a>.</p>General questionshttps://cadabra.science/qa/2079/minus-sign-to-index-dependent-power?show=2080#a2080Sun, 23 Jan 2022 21:06:22 +0000Answered: Redefining a function
https://cadabra.science/qa/2063/redefining-a-function?show=2064#a2064
<p>Almost all Cadabra functions modify the expression in-place. So you first need to make a copy of the expression, and then apply the substitution.</p>
<p>There are a few other things not quite right in your example: <code>Ex</code> is a class name (so you cannot use it as the name of an expression; use <code>ex</code> with lowercase instead), and expressions must have valid Python names (so you cannot call them <code>T_{\mu\nu}^{1}</code>). </p>
<p>Here's something that works:</p>
<pre><code>ex:=Teff_{\mu \nu} = a^{0} T0_{\mu \nu}
+a^{1} T1_{\mu \nu}
+a^{2} T2_{\mu \nu}
+a^{3} T3_{\mu \nu};
T0 = rhs(ex)
substitute(T0, $a^{0}=1, a^{1}=0, a^{2}=0, a^{3}=0$);</code></pre>
<p>This sets the Python variable <code>T0</code> equal to the mathematical expression $T0_{\mu\nu}$.</p>General questionshttps://cadabra.science/qa/2063/redefining-a-function?show=2064#a2064Sun, 02 Jan 2022 22:20:43 +0000Answered: Why meld mixes different sets of variables?
https://cadabra.science/qa/2060/why-meld-mixes-different-sets-of-variables?show=2061#a2061
<p>This works as intended on my installation of Cadabra 2.3.8. Can you try that version please and let me know whether the problem persists?</p>General questionshttps://cadabra.science/qa/2060/why-meld-mixes-different-sets-of-variables?show=2061#a2061Tue, 07 Dec 2021 17:31:23 +0000Answered: Support for Apple Silicon(M1)
https://cadabra.science/qa/1981/support-for-apple-silicon-m1?show=2059#a2059
<p>The current version 2.3.8 builds from source on Apple silicon.</p>
<p>I have also updated the homebrew tap so you can install that way too.</p>Installation troublehttps://cadabra.science/qa/1981/support-for-apple-silicon-m1?show=2059#a2059Sun, 21 Nov 2021 15:28:46 +0000Answered: Expansion of covariant derivative
https://cadabra.science/qa/2041/expansion-of-covariant-derivative?show=2053#a2053
<p>I faced the same problem in my time, so I ended up writing a function like this. </p>
<pre><code>def select_index(used_indices):
indeces = r'w v u s r q o n m l k j i h g f e d c b a'.split()
for uind in indeces:
found = False
for qind in used_indices:
if qind == uind:
found = True
break
if not found:
used_indices.add(uind)
index = uind
break
return Ex(index), used_indices
def one_nabla(ex, used_indices):
t3, used_indices = select_index(used_indices)
free = dict()
free['sub'] = set()
free['up'] = set()
for nabla in ex[r'\nabla']:
nabla.name=r'\partial'
dindex = nabla.indices().__next__()
for arg in nabla.args():
ret:=0;
for index in arg.free_indices():
if index.parent_rel==sub:
free['sub'].add(str(index.ex()))
else:
free['up'].add(str(index.ex()))
for key in free.keys():
for index in free[key]:
ind = Ex(index)
if key == 'sub':
t1:= -\Gamma^{@[t3]}_{@(dindex) @[ind]};
else:
t1:= \Gamma^{@[ind]}_{@(dindex) @[t3]};
t2:= @[arg];
for term_index in arg.free_indices():
if str(term_index.ex()) == index:
if term_index.parent_rel==sub:
t2[term_index]:= _{@[t3]};
else:
t2[term_index]:= ^{@[t3]};
ret += Ex(str(nabla.multiplier)) * t1 * t2
nabla += ret #
break
break
return ex, used_indices
def nabla_calculation(ex, used_indices, count):
ex = ex.ex()
for element in ex.top().terms():
new:=1;
local_count = 0
for nabla in element[r'\nabla']:
local_count += 1
if local_count == 0:
continue
elif local_count == 1:
new, used_indices = (one_nabla(element, used_indices))
element.replace(new.ex())
count -= 1
else:
if element.ex().top().name == r'\prod':
i = 0
while i < 2:
for mult in element.ex().top().children():
local_count2 = 0
for nabla in mult[r'\nabla']:
local_count2 += 1
if local_count2 == 0:
new *= mult.ex()
elif local_count2 == 1:
for nabla in mult[r'\nabla']:
nabla1, used_indices = one_nabla(nabla, used_indices)
nabla.replace(nabla1.ex())
new *= nabla.ex()
else:
mult1, used_indices = nabla_calculation(mult, used_indices, local_count)
new *= mult1
i+=1
new *= Ex(str(element.multiplier))
element.replace(new)
else:
for nabla in element[r'\nabla']:
for arg1 in nabla.args():
arg2, used_indices = nabla_calculation(arg1, used_indices, count - 1)
index = nabla.indices().__next__()
t := \nabla_{@(index)}{@[arg2]};
new = t
nabla1, used_indices = one_nabla(new, used_indices)
new = Ex(str(nabla.multiplier)) * nabla1
nabla.replace(new)
return ex, used_indices
def expand_nabla(ex):
if ex.top().name == '\equals':
for child in ex.top().children():
ret:=0;
for element in child.ex().top().terms():
count = 0
used_indices = set()
for nabla in element.ex()[r'\nabla']:
count += 1
if count == 0:
ret += element.ex()
#new_ex += element.ex()
else:
for n in element.ex():
for index in n.indices():
used_indices.add(str(index))
#for nabla in element[r'\nabla']:
element1, used_indices = nabla_calculation(element, used_indices, count)
ret +=element1
child.replace(ret)
else:
for element in ex.top().terms():
count = 0
used_indices = set()
for nabla in element.ex()[r'\nabla']:
count += 1
if count == 0:
pass
else:
for n in element.ex():
for index in n.indices():
used_indices.add(str(index))
element1, used_indices = nabla_calculation(element, used_indices, count)
element.replace(element1)
return ex</code></pre>
<p>To use it, you need to call the main function expand_nabla(ex). It is suitable for large expressions, does not duplicate already occupied indexes, and also knows how to work with equalities.</p>General questionshttps://cadabra.science/qa/2041/expansion-of-covariant-derivative?show=2053#a2053Thu, 21 Oct 2021 19:24:52 +0000Answered: Run cadabra kernel in colab
https://cadabra.science/qa/2048/run-cadabra-kernel-in-colab?show=2050#a2050
<p>To add to my earlier answer: you can install Conda and then the Cadabra kernel with</p>
<pre><code>!pip install -q condacolab
import condacolab
condacolab.install()
conda install cadabra2-jupyter-kernel</code></pre>
<p>In principle it should then be possible to use that kernel from another notebook, as all your notebooks should be running inside the same VM. It didn't work for me, but maybe you have more luck.</p>General questionshttps://cadabra.science/qa/2048/run-cadabra-kernel-in-colab?show=2050#a2050Sun, 17 Oct 2021 15:23:56 +0000Answered: Calling a cadabra note book in another one.
https://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 requestshttps://cadabra.science/qa/2046/calling-a-cadabra-note-book-in-another-one?show=2047#a2047Fri, 08 Oct 2021 08:25:46 +0000Answered: Strange substitution behavior in Cadabra v1
https://cadabra.science/qa/2044/strange-substitution-behavior-in-cadabra-v1?show=2045#a2045
<p>A lot of fixes where made in <code>substitute</code> for v2, and I remember at least one issue in which the presence of <code>LaTeXForm</code> messed with the substitution. So I am not entirely surprised that it works in v2 now. I'll consider it closed for now, but if you find anything remotely similar in v2, please let me know.</p>Bug reportshttps://cadabra.science/qa/2044/strange-substitution-behavior-in-cadabra-v1?show=2045#a2045Fri, 01 Oct 2021 18:35:34 +0000Metric after coordinate transformation
https://cadabra.science/qa/2043/metric-after-coordinate-transformation
<p>Hi,
I'm trying to figure out how to use Cadabra for the following:
I defined a set of coordinate variables (e.g. {t,r,\theta,\phi}) and an explicit metric replacement statement, e.g. Schwarzschild metric:</p>
<blockquote>
<p>g<em>schw :={g</em>{t t}=-(1-R/r). g<em>{r r}=(1-R/r)**(-1), g</em>{\theta \theta}=...}
complete(g_schw, $g^{\mu \nu}$);</p>
</blockquote>
<p>I have a formula for transformation from said coordinates into <a rel="nofollow" href="https://en.wikipedia.org/wiki/Schwarzschild_metric#Alternative_coordinates">harmonic coordinates</a> (Y0,Y1,Y2,Y3)
(or Kruskal coordinates (T,X,\theta,\phi), or whatever...)
I want to calculate the metric in the new coordinates, say h_{m n} (0<=m,n<=3).</p>
<p>The best I have so far (code below) is </p>
<ol>
<li>make substitution rules for Y0(t,r,\theta,\phi)...Y3(t,r,\theta,\phi)</li>
<li>use the substitute and evaluate method to evaluate the inverse metric
h^{m n} = g^{\mu \nu} <em> partial_{mu}{Y^{m}} </em> partial_{nu}{Y^{n}}</li>
</ol>
<p>However</p>
<ul>
<li>
<p>Cadabra constructs the new expression for the tensor with the indices values of [t,r,\theta,\phi] instead of [0,1,2,3]</p>
</li>
<li>
<p>I can't use complete to calculate h_{m n} from h^{m n}. The complete method doesn't work.</p>
<p>{t,r,\theta,\phi}::Coordinate
{\mu,\nu,\rho,\sigma,\kappa,\xi,\zeta}::Indices(position=fixed,values=[t,r,\theta,\phi]);
{g<em>{\mu \nu},h</em>{\mu \nu}}::Metric;
{g^{\mu \nu},h^{\mu \nu}::InverseMetric;
{g<em>{\mu}^{\nu},h</em>{\mu}^{\nu}}::KroneckerDelta;
\partial{#}::PartialDerivative.
x_Y<em>schw := {X^{t}=t, X^{r}=r, X^{\theta}=\theta, X^{\phi}=\phi, Y^{t}=c t, Y^{r}=(r-R0/2) sin(\theta) cos(\phi), Y^{\theta}=(r-R0/2) sin(\theta) sin(\phi), Y^{\phi}=(r-R0/2) cos(\theta)};
{Y^{#}}::Depends(r,t,\theta,\phi);
evaluate($\partial</em>{\mu}{Y^{\nu}}$, x_Y_schw);
g<em>schw := {g</em>{t t}=-c<strong>2 * (1-R0/r), g<em>{r r}=(1-R0/r)**(-1), g</em>{\theta \theta}=r<strong>2, g_{\phi \phi}=r</strong>2 * (sin(\theta))</strong>2};
complete(g_schw, $g^{\mu \nu}$);
h<em>harm := h^{\rho \sigma} -> \partial</em>{\mu}{Y^{\rho}} \partial_{\nu}{Y^{\sigma}} g^{\mu \nu};
evaluate(h_harm, g_schw + x_Y_schw,rhsonly=True);
complete(h<em>harm, $h</em>{\rho \sigma}$);</p>
</li>
</ul>General questionshttps://cadabra.science/qa/2043/metric-after-coordinate-transformationSun, 26 Sep 2021 14:02:58 +0000Answered: Substitute Affected by Unrelated Expression Definition
https://cadabra.science/qa/2027/substitute-affected-by-unrelated-expression-definition?show=2042#a2042
<p>Hi Simon,</p>
<p>I'm not getting the behaviour you describe. Am I doing something wrong?</p>
<p><img src="https://ibb.co/sPTzKtT" alt="enter image description here"></p>Bug reportshttps://cadabra.science/qa/2027/substitute-affected-by-unrelated-expression-definition?show=2042#a2042Fri, 24 Sep 2021 11:11:51 +0000Matching expressions with variable index ranges
https://cadabra.science/qa/2038/matching-expressions-with-variable-index-ranges
<p>I am trying to write a substitution that does essentially the following:</p>
<pre><code>\gamma_{a}_{\alpha \beta} \gamma_{b}^{\beta \gamma} -> X_{a b}_{\alpha}^{\gamma}</code></pre>
<p>but with $a$ and $b$ allowed to be a range of vector indices, e.g. I want to also encompass</p>
<pre><code>\gamma_{a1 a2 a3}_{\alpha \beta} \gamma_{b}^{\beta \gamma} -> X_{a1 a2 a3 b}_{\alpha}^{\gamma}</code></pre>
<p>and so on. I can of course define this for all possible collective indices a_i and b_i, or introduce some intermediate kluge, but I suspect there ought to be a compact, elegant way of doing this. My initial instinct was to try</p>
<pre><code>\gamma_{A??}_{\alpha \beta} \gamma_{B??}^{\beta \gamma} -> X_{A?? B??}_{\alpha}^{\gamma}</code></pre>
<p>but this doesn't seem to work. Any ideas of a simple solution?</p>General questionshttps://cadabra.science/qa/2038/matching-expressions-with-variable-index-rangesMon, 20 Sep 2021 15:31:47 +0000Problems with substitute and kronecker
https://cadabra.science/qa/2034/problems-with-substitute-and-kronecker
<p>Hi,
i'm having some problems with the program. Currently, i'm using it to calculate one-loop diagrams in quantum gravity. The problems are that the kronecker delta does not completely disappear and that sometimes the algorithm "substitute" does not work. I have installed the software following the steps in the link "kpeeters/cadabra2" in the section "download" of the site. To be more precise, let $\Gamma_{\alpha\beta}$ be the 2-scalar-1 graviton vertex and $\Gamma_{\alpha\beta\mu\nu}$ be the 2 scalar- 2 graviton vertex. In the contraction $\Gamma_{\alpha\beta}\Gamma^{\alpha\beta\mu\nu}$, the substitution of $\Gamma_{\alpha\beta\mu\nu}$ occurs (sometimes) only after the distribute algorithm. I was thinking about the length of the components but I'm not sure. I have tried the combinations indices=free or fixed but it does not change. Kronecker delta still remains in every test.
I hope in your response and I thank you in advance</p>General questionshttps://cadabra.science/qa/2034/problems-with-substitute-and-kroneckerWed, 15 Sep 2021 09:16:11 +0000Answered: manipulating expressions: get_rhs and joining to an equation
https://cadabra.science/qa/2028/manipulating-expressions-get_rhs-and-joining-to-equation?show=2030#a2030
<p>You can multiply expressions like this:</p>
<pre><code> ex:= A+B+C;
ex:= (D+E) @(ex);</code></pre>
<p>I am not entirely sure what you mean with (2). Do you mean that you have two expressions and you want to turn them into an equation by setting one equal to the other? Something like</p>
<pre><code>lhs:= A+B;
rhs:= C+D;
ex:= @(lhs) = @(rhs);</code></pre>
<p>?</p>
<p>Finally, if you think <code>simplify</code> has a bug when acting on equations, please try to provide a minimal example and send that to me, so it can be fixed.</p>General questionshttps://cadabra.science/qa/2028/manipulating-expressions-get_rhs-and-joining-to-equation?show=2030#a2030Tue, 07 Sep 2021 09:23:53 +0000Getting list of arguments of functions
https://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
<a rel="nofollow" href="https://cadabra.science/manual/evaluate.html">https://cadabra.science/manual/evaluate.html</a>
it isn't listed.
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,
Amnon</p>Feature requestshttps://cadabra.science/qa/2029/getting-list-of-arguments-of-functionsMon, 06 Sep 2021 11:39:31 +0000Trouble with Dummy-Index Manipulation within Index Brackets and Partial Derivatives
https://cadabra.science/qa/2026/trouble-manipulation-within-brackets-partial-derivatives
<p>Hi,</p>
<p>I am having difficulties with canonicalizing dummy indices on expressions involving index brackets. In particular, I want to canonicalize indices in a term involving a factor with no symmetries but with dummy indices shared with a gamma matrix, particularly for the purpose of combining with other terms with indices already arranged in canonical order. This works perfectly when no index brackets are present, as in the code sample below,</p>
<pre><code>ex := \Gamma^{a b} \Psi_{b a} + \Gamma^{a b} \Psi_{a b};
canonicalise(ex);</code></pre>
<p>which gives</p>
<pre><code>Γ^{a b} Ψ_{b a} + Γ^{a b} Ψ_{a b}
0</code></pre>
<p>However, when index brackets are added, the expression is no longer canonicalized, and hence the terms are no longer combined, as in the code sample below,</p>
<pre><code>ex := (\Gamma^{a b})_{\alpha \beta} (\Psi_{b a})_{\gamma \eta} + (\Gamma^{a b})_{\alpha \beta} (\Psi_{a b})_{\gamma \eta};
canonicalise(ex);</code></pre>
<p>which gives</p>
<pre><code>\indexbracket(Γ^{a b})_{α β} \indexbracket(Ψ_{b a})_{γ η} + \indexbracket(Γ^{a b})_{α β} \indexbracket(Ψ_{a b})_{γ η}
\indexbracket(Γ^{a b})_{α β} \indexbracket(Ψ_{b a})_{γ η} + \indexbracket(Γ^{a b})_{α β} \indexbracket(Ψ_{a b})_{γ η}</code></pre>
<p>Is there any way to fix this? I have tried to tease out a solution using an index substitution, which I know is <a rel="nofollow" href="https://cadabra.science/qa/609/should-substitute-act-on-indices">generally counter-recommended</a> (rename_dummies() unfortunately does not help here), as in the code below,</p>
<pre><code>ex := (\Gamma^{a b})_{\alpha \beta} (\Psi_{b a})_{\gamma \eta};
substitute(ex, $_{a} -> _{b}, ^{a} -> ^{b}, _{b} -> _{a}, ^{b} -> ^{a}$);
canonicalise(ex);</code></pre>
<p>which successfully gives</p>
<pre><code>\indexbracket(Γ^{a b})_{α β} \indexbracket(Ψ_{b a})_{γ η}
\indexbracket(Γ^{b a})_{α β} \indexbracket(Ψ_{a b})_{γ η}
\indexbracket(-Γ^{a b})_{α β} \indexbracket(Ψ_{a b})_{γ η}</code></pre>
<p>However, applying this index substitution in the context of arithmetic is still a hurdle, and such an index substitution sometimes raises errors when partial derivatives are involved, as in the code below (I have removed the index brackets in order to isolate the feature that is triggering the error),</p>
<pre><code>ex := \Gamma_{b c} \Gamma^{b c d} \delta_{a}^{e} \partial_{e}(\Psi_{d});
substitute(ex, $_{e} -> _{b}, ^{e} -> ^{b}, _{b} -> _{c}, ^{b} -> ^{c}, _{c} -> _{d}, ^{c} -> ^{d}, _{d} -> _{e}, ^{d} -> ^{e}$);</code></pre>
<p>which raises a triple index error. Note that the same code works with the partial derivative factor replaced, as in the code below.</p>
<pre><code>ex := \Gamma_{b c} \Gamma^{b c d} \delta_{a}^{e} \Psi_{e d};
substitute(ex, $_{e} -> _{b}, ^{e} -> ^{b}, _{b} -> _{c}, ^{b} -> ^{c}, _{c} -> _{d}, ^{c} -> ^{d}, _{d} -> _{e}, ^{d} -> ^{e}$);</code></pre>
<p>Both the index-canonicalization issue with index brackets and the index-substitution issue with partial derivatives seem to have to do with recognizing vector indices and their symmetries within different branches of the ExNode tree structure of the expression. Am I making a mistake in my index handling? Is there any way to get around these issues?</p>
<p>The full code for the above tests is shown below.</p>
<pre><code>{a,b,c,d,e}::Indices(vector)
{a,b,c,d,e}::Integer(0..10)
{\alpha,\beta,\gamma,\eta}::Indices(spinor)
\partial{#}::PartialDerivative
\Psi{#}::Depends(\partial{#})
\Gamma_{#}::GammaMatrix(metric=\delta)
\delta{#}::KroneckerDelta
print('\ntest 1')
ex := \Gamma^{a b} \Psi_{b a} + \Gamma^{a b} \Psi_{a b};
canonicalise(ex);
print('\ntest 2')
ex := (\Gamma^{a b})_{\alpha \beta} (\Psi_{b a})_{\gamma \eta} + (\Gamma^{a b})_{\alpha \beta} (\Psi_{a b})_{\gamma \eta};
canonicalise(ex);
print('\ntest 3')
ex := (\Gamma^{a b})_{\alpha \beta} (\Psi_{b a})_{\gamma \eta};
substitute(ex, $_{a} -> _{b}, ^{a} -> ^{b}, _{b} -> _{a}, ^{b} -> ^{a}$);
canonicalise(ex);
print('\ntest 4')
ex := \Gamma_{b c} \Gamma^{b c d} \delta_{a}^{e} \Psi_{e d};
substitute(ex, $_{e} -> _{b}, ^{e} -> ^{b}, _{b} -> _{c}, ^{b} -> ^{c}, _{c} -> _{d}, ^{c} -> ^{d}, _{d} -> _{e}, ^{d} -> ^{e}$);
print('\ntest 5')
ex := \Gamma_{b c} \Gamma^{b c d} \delta_{a}^{e} \partial_{e}(\Psi_{d});
substitute(ex, $_{e} -> _{b}, ^{e} -> ^{b}, _{b} -> _{c}, ^{b} -> ^{c}, _{c} -> _{d}, ^{c} -> ^{d}, _{d} -> _{e}, ^{d} -> ^{e}$);</code></pre>
<p>Thanks in advance.</p>
<p>-Simon</p>General questionshttps://cadabra.science/qa/2026/trouble-manipulation-within-brackets-partial-derivativesTue, 24 Aug 2021 04:05:58 +0000Answered: Configuring jupyterhub with cadabra2
https://cadabra.science/qa/2023/configuring-jupyterhub-with-cadabra2?show=2024#a2024
<p>OK... I think I solved the issue by updating the jupyterhub.service configuration.
I had to locate the jupyterhub.service file. In my system it was in the folder
/etc/systemd/system/</p>
<p>i.e.</p>
<pre><code>sudo gedit /etc/systemd/system/jupyterhub.service</code></pre>
<p>Underneath the existing "Environment=" line, I added another line</p>
<blockquote>
<p>Environment=export PYTHONPATH=${PYTHONPATH}:/usr/local/lib/python3.9/site-packages</p>
</blockquote>
<p>After saving the file, I had to re-load the configuration into the system with</p>
<pre><code>sudo systemctl daemon-reload</code></pre>
<p>finally - restart the service:</p>
<pre><code>sudo systemctl restart jupyterhub.service</code></pre>
<p>Now I can run cadabra2 commands in jupyterhub from any computer in my LAN
(I configured a firewall rule to allow http traffic only from LAN IPs).</p>Installation troublehttps://cadabra.science/qa/2023/configuring-jupyterhub-with-cadabra2?show=2024#a2024Tue, 10 Aug 2021 21:49:22 +0000Answered: Coefficients Inconsistency with expand=False in join_gamma()
https://cadabra.science/qa/2020/coefficients-inconsistency-with-expand-false-join_gamma?show=2021#a2021
<blockquote>
<p>It seems as though the implicit (anti)symmetrization given with expand=False is not being recognized by the next loop of join_gamma().</p>
</blockquote>
<p>That's correct. There is no such thing as 'an expression with implicit anti-symmetrisation' in the sense that Cadabra still knows about it. I have had this on the todo list for a long time, and there has been some basic infrastructure for that internally, but it never really materialised. So in effect, you can only use <code>expand=False</code> at the very last step of a gamma join.</p>General questionshttps://cadabra.science/qa/2020/coefficients-inconsistency-with-expand-false-join_gamma?show=2021#a2021Sun, 08 Aug 2021 10:15:26 +0000How to Create an Antisymmetric Metric
https://cadabra.science/qa/2019/how-to-create-an-antisymmetric-metric
<p>Hi.</p>
<p>Is there any way to create an antisymmetric metric in Cadabra, like the spinor metric (charge conjugation matrix with spinor indices) in 11d? That is, I am looking for a way to create an antisymmetric object that can be contracted to raise and lower indices (as with eliminate_metric()), but it seems that objects with the Metric property in Cadabra must be symmetric.</p>
<p>Thanks in advance.</p>
<p>-Simon</p>General questionshttps://cadabra.science/qa/2019/how-to-create-an-antisymmetric-metricSun, 08 Aug 2021 08:14:34 +0000Answered: Support for plugin `Remote - WSL` in vscode
https://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 requestshttps://cadabra.science/qa/2015/support-for-plugin-remote-wsl-in-vscode?show=2016#a2016Thu, 08 Jul 2021 10:00:54 +0000Answered: how to cite cadabra2 in 2021
https://cadabra.science/qa/2013/how-to-cite-cadabra2-in-2021?show=2014#a2014
<p>The most recent paper (and the only one from my hand about Cadabra 2.x) is</p>
<pre><code>@article{Peeters2018,
doi = {10.21105/joss.01118},
url = {https://doi.org/10.21105/joss.01118},
year = {2018},
publisher = {The Open Journal},
volume = {3},
number = {32},
pages = {1118},
author = {Kasper Peeters},
title = {Cadabra2: computer algebra for field theory revisited},
journal = {Journal of Open Source Software}
}</code></pre>
<p>So that's probably the best one. Wouldn't hurt me if you would cite the two others as well though.</p>General questionshttps://cadabra.science/qa/2013/how-to-cite-cadabra2-in-2021?show=2014#a2014Tue, 06 Jul 2021 16:02:30 +0000Answered: component_to_subrule function
https://cadabra.science/qa/2008/component_to_subrule-function?show=2009#a2009
<p>This is a recent addition; make sure you are running a current version of Cadabra.</p>Bug reportshttps://cadabra.science/qa/2008/component_to_subrule-function?show=2009#a2009Wed, 30 Jun 2021 21:57:39 +0000Bug with isolate function
https://cadabra.science/qa/2007/bug-with-isolate-function
<p>Hello!
Then I try to solve linear equation like</p>
<pre><code>import cdb.core.manip as man
expr:= G - 2*F * X =0;
man.isolate(expr, $F$);</code></pre>
<p>I get something like that
<img src="https://sun9-1.userapi.com/impg/N5JkB_247NPa-RQCJFUDIjZ5Dm-ZtX93oyzBjA/tEej2DE_67o.jpg?size=436x235&quality=96&sign=6f3b1c2cead815519843d9fb7cf73483&type=album" alt="enter image description here"></p>
<p>I think it's not ok. It's a bug, or I'm doing something wrong?</p>Bug reportshttps://cadabra.science/qa/2007/bug-with-isolate-functionTue, 01 Jun 2021 17:08:34 +0000Answered: Error when applying the complete algorithm in the inverse Schwarzschild metric.
https://cadabra.science/qa/2004/applying-complete-algorithm-inverse-schwarzschild-metric?show=2005#a2005
<p>Be careful with your brackets and backslashes. The following segment works:</p>
<pre><code>{r,t,\phi,\theta}::Coordinate;
{\mu,\nu,\rho,\sigma,\lambda,\kappa,\chi,\gamma,\alpha,\beta#}::Indices(values= {t,r,\phi,\theta}, position=independent);
\partial{#}::PartialDerivative;
g_{\mu\nu}::Metric;
g^{\mu\nu}::InverseMetric;
# Schwarzschild metric:
scw:= { g_{t t} = -(1-2 M/r), g_{r r} = 1/(1-2 M/r), g_{\theta\theta} = r**2, g_{\phi\phi}=r**2 \sin(\theta)**2 };
# inverse metric:
complete(scw, $g^{\mu\nu}$);</code></pre>
<p>I had to fix the declaration of the indices (a missing curly opening bracket) and the use of <code>sin</code> (which you need to write as <code>\sin</code>, with a backslash).</p>
<p>If you copy-paste the above, do you still get the error?</p>General questionshttps://cadabra.science/qa/2004/applying-complete-algorithm-inverse-schwarzschild-metric?show=2005#a2005Tue, 11 May 2021 09:59:13 +0000Answered: Failure of running cadabra on windows.
https://cadabra.science/qa/1259/failure-of-running-cadabra-on-windows?show=1998#a1998
<p>Windows is no longer supported, I do not have the time for it anymore. Volunteers welcome to bring this back to life.</p>Bug reportshttps://cadabra.science/qa/1259/failure-of-running-cadabra-on-windows?show=1998#a1998Tue, 13 Apr 2021 17:31:26 +0000Answered: Sum of tensors in coordinate form
https://cadabra.science/qa/1993/sum-of-tensors-in-coordinate-form?show=1994#a1994
<p>Use <code>collect_components(ex)</code>.</p>General questionshttps://cadabra.science/qa/1993/sum-of-tensors-in-coordinate-form?show=1994#a1994Fri, 09 Apr 2021 19:07:58 +0000Answered: Problem with combine
https://cadabra.science/qa/1834/problem-with-combine?show=1992#a1992
<p>I can confirm the behaviour of your code. </p>
<p><strong>Just a comment:</strong> It seems that <code>combine</code> privilege the position of the indices (lower like a covariant and upper like contravariant) over the <code>property</code> of the objects. </p>
<p><img src="https://ibb.co/BVCM67P" alt="cadabra_combine"></p>Bug reportshttps://cadabra.science/qa/1834/problem-with-combine?show=1992#a1992Wed, 07 Apr 2021 11:35:56 +0000