Cadabra Q&A - Recent questions and answers
http://cadabra.science/qa/qa
Powered by Question2AnswerAnswered: Apply an operator to an equation
http://cadabra.science/qa/1195/apply-an-operator-to-an-equation?show=1196#a1196
<p>Cool one. There is a subtle bug in the parser which fails on these Python names with underscores. If you replace <code>lhs_scL</code> with <code>lhsscL</code> and ditto for the rhs version, things work. Will fix, hopefully the workaround above can keep you going in the meantime.</p>
General questionshttp://cadabra.science/qa/1195/apply-an-operator-to-an-equation?show=1196#a1196Wed, 26 Jun 2019 06:38:46 +0000Answered: Graded partial differential
http://cadabra.science/qa/1188/graded-partial-differential?show=1189#a1189
<p>Assign the <code>AntiCommuting</code> property to the indices, not to the derivatives. So</p>
<pre><code>{a, b, c, d, e, f, g, h, i, j, k, l, m, n ,o, r,s,t,u,v,w,x,y,z#}::Indices(T, position=free, parent=double);
D{#}::PartialDerivative;
\xi{#}::Depends(D{#});
{a, b, c, d, e, f, g, h, i, j, k, l, m, n ,o, r,s,t,u,v,w,x,y,z#}::AntiCommuting;
</code></pre>
<p>and then</p>
<pre><code>Exp:=D_{a}{D_{b}{\xi_{c}}*\xi_{d}};
product_rule(_);
</code></pre>
<p>produces</p>
<p>$$D_{a b}{\xi_{c}} \xi_{d} + D_{b}{\xi_{c}} D_{a}{\xi_{d}}$$</p>
General questionshttp://cadabra.science/qa/1188/graded-partial-differential?show=1189#a1189Thu, 20 Jun 2019 08:18:04 +0000Answered: Poincare example evaluated twice
http://cadabra.science/qa/1186/poincare-example-evaluated-twice?show=1187#a1187
<p>What happens here is that the <code>post_process</code> function converts the <code>\commutator{#}</code> argument in the line</p>
<pre><code>{J_{\mu\nu}, P_{\mu}, W_{\mu} }::Depends(\commutator{#}).
</code></pre>
<p>to a <code>0</code>, so that that line becomes</p>
<pre><code>{J_{\mu\nu}, P_{\mu}, W_{\mu} }::Depends(0).
</code></pre>
<p>This does not happen on first run, because in that case the function <code>post_process</code> is not defined yet when the above line is encountered.</p>
<p>The problem is that <code>unwrap</code> (which is used in <code>post_process</code>) should have left <code>\commutator{#}</code> untouched. </p>
<p>Thanks for reporting this; will fix in a future update.</p>
General questionshttp://cadabra.science/qa/1186/poincare-example-evaluated-twice?show=1187#a1187Wed, 12 Jun 2019 11:47:30 +0000Answered: Using multiple notebooks
http://cadabra.science/qa/1184/using-multiple-notebooks?show=1185#a1185
<p>Just stick it anywhere in your PYTHONPATH; the import works just like any regular Python import process.</p>
General questionshttp://cadabra.science/qa/1184/using-multiple-notebooks?show=1185#a1185Wed, 12 Jun 2019 08:56:06 +0000Answered: Kernel crashing
http://cadabra.science/qa/1170/kernel-crashing?show=1182#a1182
<p>You probably either did not terminate an expression line with <code>;</code> or <code>:</code>, or you tried to wrap a Cadabra expression over multiple lines by using <code>\</code>. If it's the latter, just remove that <code>\</code>; Cadabra expressions can wrap over multiple lines without Python's line continuation character.</p>
Bug reportshttp://cadabra.science/qa/1170/kernel-crashing?show=1182#a1182Mon, 10 Jun 2019 09:01:41 +0000definitions in cadabra
http://cadabra.science/qa/1176/definitions-in-cadabra
<p>can you combine letters with numbers to name definitions in cadabra? Like as follows</p>
General questionshttp://cadabra.science/qa/1176/definitions-in-cadabraFri, 07 Jun 2019 06:44:48 +0000Functional dependence
http://cadabra.science/qa/1167/functional-dependence
<p>Hi friends,</p>
<p>I would like to know if is there any possibility of defining a functional dependence for an object. For example, in the below code the Cadabra throws an error</p>
<pre><code>x::Coordinate;
\partial{#}::PartialDerivative;
\bar{#}::DiracBar;
{\phi,J, j, \eta}::Depends(x, \partial{#});
S::Depends(\phi,\bar{\eta},\eta);
</code></pre>
<p>Regards</p>
General questionshttp://cadabra.science/qa/1167/functional-dependenceTue, 04 Jun 2019 23:17:50 +0000Answered: Some suggestions for the next version
http://cadabra.science/qa/1079/some-suggestions-for-the-next-version?show=1166#a1166
<ol>
<li><p>See <a rel="nofollow" href="https://cadabra.science/help.html">https://cadabra.science/help.html</a> (not yet complete but getting closer).</p></li>
<li><p>The notebook should now accept any UTF-8 input; can you please let me know if you still have problems with this? Most likely this will not yet do what you want with LaTeX input cells, but I don't write Chinese so I don't know what people use to write LaTeX in Chinese.</p></li>
</ol>
Feature requestshttp://cadabra.science/qa/1079/some-suggestions-for-the-next-version?show=1166#a1166Tue, 28 May 2019 17:35:28 +0000Action of sort_product depends on the choice of index
http://cadabra.science/qa/1164/action-of-sort_product-depends-on-the-choice-of-index
<p>Hi everyone, </p>
<p>I encountered the following surprising example while trying to simplify the expression </p>
<pre><code>F^{d}_{a e}* F^{f}_{b f} - F^{f}_{b f}* F^{d}_{a e}
</code></pre>
<p>to zero using the following code</p>
<pre><code>{a, b, c, d, e, f, g#}::Indices(T, position= independent, parent=double);
{F^{d}_{a e}, F^{f}_{b f}}::SortOrder.
Exp:= F^{d}_{a e}* F^{f}_{b f} - F^{f}_{b f}* F^{d}_{a e};
sort_product(_);
sort_sum(_);
canonicalise(_);
rename_dummies(_);
collect_terms(_);
</code></pre>
<p>Strangely, the obtained result is </p>
<pre><code>F^{d}_{a e} F^{c}_{b c}-F^{c}_{b c} F^{d}_{a e}
</code></pre>
<p>i.e. sort_product failed to order the products. </p>
<p>Even stranger, if I replace the index <code>f</code> in the first term by <code>c</code> i.e. if use the code: </p>
<pre><code>{a, b, c, d, e, f, g#}::Indices(T, position= independent, parent=double);
{F^{d}_{a e}, F^{f}_{b f}}::SortOrder.
Exp:= F^{d}_{a e}* F^{c}_{b c} - F^{f}_{b f}* F^{d}_{a e};
sort_product(_);
sort_sum(_);
canonicalise(_);
rename_dummies(_);
collect_terms(_);
</code></pre>
<p>then everything works fine and the output is zero, as it should. </p>
<p>I tested this on both Mac and Ubuntu and the result is the same. </p>
<p>Does anyone have an idea where the bug came from and how to fix it?</p>
<p>Thank you already for any information, </p>
<p>Kevin</p>
Bug reportshttp://cadabra.science/qa/1164/action-of-sort_product-depends-on-the-choice-of-indexThu, 16 May 2019 01:30:28 +0000Answered: `eliminate_vielbein` and the `KroneckerDelta`
http://cadabra.science/qa/1155/eliminate_vielbein-and-the-kroneckerdelta?show=1163#a1163
<p>The bonus question is already possible, just</p>
<pre><code>\delta{#}::KroneckerDelta;
</code></pre>
<p>works.</p>
<p>The other one is more tricky. I usually do</p>
<pre><code>E^{\mu}_{\nu}::KroneckerDelta;
E^{\mu}_{\nu}::LaTeXForm("\delta").
</code></pre>
<p>to get the display correct. In order to auto-convert to an actual <code>\delta</code> object, not just something that prints as $\delta$, <code>eliminate_vielbein</code> would need to know that you want to use the <code>\delta^{\mu}_{\nu}</code> as the Kronecker delta for the $\mu, \nu$ indices. That's possible (there is a way for algorithms to look up such properties) but I haven't implemented that yet. Have opened an issue on github to track this ( <a rel="nofollow" href="https://github.com/kpeeters/cadabra2/issues/153">https://github.com/kpeeters/cadabra2/issues/153</a> ).</p>
Feature requestshttp://cadabra.science/qa/1155/eliminate_vielbein-and-the-kroneckerdelta?show=1163#a1163Thu, 09 May 2019 14:52:53 +0000Answered: Exportaing to LaTeX a Cadabra2 notebook
http://cadabra.science/qa/1152/exportaing-to-latex-a-cadabra2-notebook?show=1161#a1161
<p>Now fixed on github, thanks.</p>
Bug reportshttp://cadabra.science/qa/1152/exportaing-to-latex-a-cadabra2-notebook?show=1161#a1161Wed, 08 May 2019 11:32:56 +0000Answered: import cdb.sympy.solvers hangs the kernel
http://cadabra.science/qa/1142/import-cdb-sympy-solvers-hangs-the-kernel?show=1160#a1160
<p>The new UTF8 parser barfed on a double backslash. Still not quite sure why, but I have corrected that in the <code>core/packages/cdb/sympy/solvers.cnb</code> file and this package should work now again. Update on github master.</p>
Bug reportshttp://cadabra.science/qa/1142/import-cdb-sympy-solvers-hangs-the-kernel?show=1160#a1160Wed, 08 May 2019 11:02:43 +0000Defining a non-nilpotent `ExteriorDerivative`
http://cadabra.science/qa/1159/defining-a-non-nilpotent-exteriorderivative
<p>Hello!</p>
<p>I'm creating a Cadabra notebook showing how the Bianchi identities are obtained, using the structural equations.</p>
<p>Although I achieve the goal, it is useful to show the results introducing an exterior covariant derivative, $D$. Such derivative is not nilpotent, i.e. $D^2 \neq 0$.</p>
<p>I tried the following</p>
<pre><code>D{#}::Derivative.
D{#}::LaTeXForm("{\rm D}").
D{#}::DifferentialForm(degree=1);
</code></pre>
<p>but I think that the last declaration spoils the super-commutativity of the differential forms.</p>
<p><strong>Question</strong></p>
<p>How could I possible define a non-nilpotent exterior derivative?</p>
General questionshttp://cadabra.science/qa/1159/defining-a-non-nilpotent-exteriorderivativeTue, 07 May 2019 16:01:20 +0000Answered: Vielbein, inverse and their elimination. Documentation
http://cadabra.science/qa/1153/vielbein-inverse-and-their-elimination-documentation?show=1154#a1154
<p>Have merged your initial docs and the actual algorithm now. There's room for improvement of course.</p>
Feature requestshttp://cadabra.science/qa/1153/vielbein-inverse-and-their-elimination-documentation?show=1154#a1154Fri, 03 May 2019 18:26:02 +0000Answered: A general covariant derivative
http://cadabra.science/qa/68/a-general-covariant-derivative?show=1151#a1151
<p>Have a look at the example at the bottom of <a rel="nofollow" href="https://cadabra.science/notebooks/ref_programming.html">https://cadabra.science/notebooks/ref_programming.html</a> for a way to handle operators whose expansion depends on the object they act on. </p>
General questionshttp://cadabra.science/qa/68/a-general-covariant-derivative?show=1151#a1151Fri, 26 Apr 2019 12:13:43 +0000Answered: Cadabra QA page: functionality
http://cadabra.science/qa/1148/cadabra-qa-page-functionality?show=1150#a1150
<p>I rely on the Q2A software for all of this; you may be better off making these suggestions on their support forum.</p>
Feature requestshttp://cadabra.science/qa/1148/cadabra-qa-page-functionality?show=1150#a1150Fri, 26 Apr 2019 11:48:41 +0000Answered: Dimensional reduction of a three form
http://cadabra.science/qa/1143/dimensional-reduction-of-a-three-form?show=1144#a1144
<p>The line</p>
<pre><code>C_{\Sigma \Pi \Theta}::AntiSymmetric;
</code></pre>
<p>makes the tensor antisymmetric in the 'full' indices, and it would be natural for Cadabra to infer that this implies that the anti-symmetry is also present when these indices are replaced with either '4' or one of the <code>space1</code> indices, but it doesn't do that (yet). If it does not clash with other tensors, you can do</p>
<pre><code>C_{A? B? C?}::AntiSymmetric;
</code></pre>
<p>which makes the tensor antisymmetric regardless of what you stick in the index slots. Of course this will then also yield antisymmetry for a C-tensor with indices from yet another set (which you probably won't have).</p>
<p>Unfortunately there are no logical operators in conditional substitution yet; it's fairly limited at the moment.</p>
General questionshttp://cadabra.science/qa/1143/dimensional-reduction-of-a-three-form?show=1144#a1144Thu, 25 Apr 2019 16:07:32 +0000Sorting indices of tensors
http://cadabra.science/qa/1141/sorting-indices-of-tensors
<p>Hi. I've been working on a Kaluza-Klein dimensional reduction. In the reduced model there are terms like $g<em>{a 5}$ and $g</em>{5 a}$. Is the a command that sort the indices, and allows to write everything in terms of a single component? </p>
General questionshttp://cadabra.science/qa/1141/sorting-indices-of-tensorsWed, 24 Apr 2019 13:18:28 +0000Dependence on a subspace - Possible???
http://cadabra.science/qa/1139/dependence-on-a-subspace-possible
<p>Going through the Kaluza-Klein examples, I noticed that it is possible to define subspaces (e.g. <code>split_index</code>). There is also a <code>Depends</code> property.</p>
<p>I've defined</p>
<pre><code>{\Lambda,\Theta,\Sigma,\Xi,\Gamma,\Delta,\Pi,\Omega}::Indices(full,position=independent);
{\mu,\nu,\rho,\sigma,\gamma,\lambda}::Indices(space1,position=independent);
\partial{#}::PartialDerivative;
{\phi, A_{\mu?}, h_{\mu? \nu?}}::Depends(\partial{#});
</code></pre>
<p>Is it possible to restrict the dependence of the fields to the subspace <code>space1</code>?</p>
General questionshttp://cadabra.science/qa/1139/dependence-on-a-subspace-possibleTue, 23 Apr 2019 19:53:08 +0000Answered: Problem with substitution
http://cadabra.science/qa/1134/problem-with-substitution?show=1135#a1135
<p>Should probably go in a FAQ: if you write <code>e^{a}</code> this gets interpreted as a tensor <code>e</code> with one contravariant index <code>a</code>. To write exponentials, use <code>\exp{...}</code> instead, or <code>e**{...}</code> if you really want the <code>e</code>.</p>
General questionshttp://cadabra.science/qa/1134/problem-with-substitution?show=1135#a1135Tue, 23 Apr 2019 16:39:48 +0000Answered: unexpected crash
http://cadabra.science/qa/390/unexpected-crash?show=1133#a1133
<p>In case anyone is still following this thread, this is now fixed on github master (version 2.2.7 or later).</p>
Bug reportshttp://cadabra.science/qa/390/unexpected-crash?show=1133#a1133Thu, 18 Apr 2019 11:56:11 +0000Answered: Inconsistencies in factor_out and factor_in
http://cadabra.science/qa/1126/inconsistencies-in-factor_out-and-factor_in?show=1130#a1130
<p>Let me first address the case which does work with the current version (at least for me):</p>
<pre><code>ex2:= (a + b - c) d + (-a -b + c) d
factor_out(_,$d$);
</code></pre>
<p>correctly factors out $d$. Factoring out composite expressions (like the $a+b-c$) is currently not supported, unfortunately.</p>
<p>All the other cases have to do with factoring out tensors. In general, for that to work, you need to have the indices on the expression you want to factor out be the same on all terms (so sort the expression and <code>rename_dummies</code> first), and it needs to be un-ambiguous (your last example isn't, because the <code>factor_out(_, $g_{a b}$)</code> means 'factor out the g-tensor with two indices', not 'factor out the g-tensor with one index 'a' and one 'b'').</p>
<p>Fixing this has been on the TODO list for some time, but there are only 25 hours in each day unfortunately.</p>
Bug reportshttp://cadabra.science/qa/1126/inconsistencies-in-factor_out-and-factor_in?show=1130#a1130Thu, 18 Apr 2019 09:53:06 +0000Answered: Cadabra crashes on non-ASCII input
http://cadabra.science/qa/1127/cadabra-crashes-on-non-ascii-input?show=1129#a1129
<p>This should now be fixed with the current version on github. There are still a few issues with actually using non-ascii symbols in Cadabra expressions, but the crashes are gone.</p>
Bug reportshttp://cadabra.science/qa/1127/cadabra-crashes-on-non-ascii-input?show=1129#a1129Thu, 18 Apr 2019 09:37:54 +0000Answered: How define a general tensor symmetry
http://cadabra.science/qa/1098/how-define-a-general-tensor-symmetry?show=1125#a1125
<p>With the provided information, you cannot determine an irrep under which your tensor transform. That's why you cannot use <code>TableauSymmetry</code></p>
<p>Notice however that, your tensor could lie on the <code>{2,2,2}</code> Young tableau. Perhaps that can help!</p>
<p>Cheers.</p>
General questionshttp://cadabra.science/qa/1098/how-define-a-general-tensor-symmetry?show=1125#a1125Tue, 16 Apr 2019 15:45:47 +0000Answered: Symmetrise pairs of indices
http://cadabra.science/qa/1111/symmetrise-pairs-of-indices?show=1124#a1124
<p>As shown in the manual, <a rel="nofollow" href="https://cadabra.science/manual/TableauSymmetry.html,">https://cadabra.science/manual/TableauSymmetry.html,</a> you could use the property <code>TableauSymmetry</code></p>
<pre><code>A_{a b c d}::TableauSymmetry( shape={2,2}, indices={0,2,1,3} );
</code></pre>
<p>Cheers.</p>
General questionshttp://cadabra.science/qa/1111/symmetrise-pairs-of-indices?show=1124#a1124Tue, 16 Apr 2019 15:32:38 +0000Answered: what is the use of question mark postindices, how it changes contractions and symmetry properties of indices?
http://cadabra.science/qa/1117/question-postindices-changes-contractions-symmetry-properties?show=1118#a1118
<p>A single question mark indicates a pattern (or wildcard), so that should only be used in e.g. <code>substitute</code>. Under most circumstances you don't need them for normal indices. Two question marks indicate an <code>object wildcard</code>, that is, a wildcard which matches an entire tensor. Have a look at</p>
<p><a rel="nofollow" href="https://cadabra.science/notebooks/ref_patterns.html">https://cadabra.science/notebooks/ref_patterns.html</a></p>
<p>in the reference guide, and then reply to this answer in case it is still not clear.</p>
General questionshttp://cadabra.science/qa/1117/question-postindices-changes-contractions-symmetry-properties?show=1118#a1118Mon, 08 Apr 2019 08:15:50 +0000Answered: nested zoom/unzoom
http://cadabra.science/qa/1112/nested-zoom-unzoom?show=1115#a1115
<p>The easter bunny is early this year: the version now on github does <code>unzoom</code> step by step, except when you give it the <code>repeat=True</code> parameter, in which it unzooms all the way to the original expression. Let me know if you run into any issues.</p>
General questionshttp://cadabra.science/qa/1112/nested-zoom-unzoom?show=1115#a1115Sat, 06 Apr 2019 13:16:19 +0000Answered: glob pattern in rules
http://cadabra.science/qa/1105/glob-pattern-in-rules?show=1106#a1106
<p>Try</p>
<pre><code>foo := t0 A + t2 B + t13 C;
substitute(foo, $t? | \regex{t?}{"t[0-9]*"} -> 1$);
</code></pre>
<p>The structure of this replacement rule is described in the reference guide chapter on <a rel="nofollow" href="https://cadabra.science/notebooks/ref_patterns.html">patterns</a>.</p>
General questionshttp://cadabra.science/qa/1105/glob-pattern-in-rules?show=1106#a1106Sun, 31 Mar 2019 11:28:21 +0000Answered: to_lhs produces Python syntax error
http://cadabra.science/qa/1101/to_lhs-produces-python-syntax-error?show=1102#a1102
<p>Thanks for reporting this, you are number 2 today ;-) It's now fixed on github, or if you want to patch it locally: just replace that line with <code>to_rhs(ex, *parts)</code>.</p>
Bug reportshttp://cadabra.science/qa/1101/to_lhs-produces-python-syntax-error?show=1102#a1102Wed, 27 Mar 2019 12:09:34 +0000Answered: Is it possible to use "+/-" as indices?&How to define a commutator?
http://cadabra.science/qa/1093/is-it-possible-to-use-as-indices-%26how-to-define-a-commutator?show=1094#a1094
<p>Use <code>fm</code> and <code>fp</code> and define</p>
<pre><code>fm{#}::LaTeXForm("{f_{-}}").
fp{#}::LaTeXForm("{f_{+}}").
</code></pre>
<p>To expand, use</p>
<pre><code>substitute(_, $\commutator{A??}{B??} -> A?? B?? - B?? A??$);
</code></pre>
<p>Does that help?</p>
General questionshttp://cadabra.science/qa/1093/is-it-possible-to-use-as-indices-%26how-to-define-a-commutator?show=1094#a1094Sun, 24 Mar 2019 08:10:36 +0000Answered: Can I use any Greek alphabet as a spinor?
http://cadabra.science/qa/1088/can-i-use-any-greek-alphabet-as-a-spinor?show=1089#a1089
<p>If you declare <code>\xi</code> to be a <code>Spinor</code> too, it should work.</p>
General questionshttp://cadabra.science/qa/1088/can-i-use-any-greek-alphabet-as-a-spinor?show=1089#a1089Thu, 21 Mar 2019 11:14:54 +0000some things about "substitute"
http://cadabra.science/qa/1084/some-things-about-substitute
<p>I want to achieve following rule</p>
<pre><code>...a b c d...->c d... ...a b
</code></pre>
<p>I have tried function <code>substitute</code>, but I have no idea how to achieve it. My recent work need this operation. Are there any suggestions about it?</p>
<p>For example, everything is <code>NonCommuting</code> and <code>depends \partial{#}</code> in following formula<br>
$$ <br>
a b \partial_{\mu} c d <br>
$$</p>
<p>I must exchange $a b$ with $ \partial_{\mu} c d $ to get</p>
<p>$$ <br>
\partial_{\mu} {c} d a b<br>
$$</p>
<p>then use <code>substitute</code> or <code>integrate_by_parts</code> to get </p>
<p>$$<br>
- c \partial_{\mu}(d a b)<br>
$$</p>
<p>I am trapped in this point now. </p>
General questionshttp://cadabra.science/qa/1084/some-things-about-substituteTue, 19 Mar 2019 14:41:35 +0000Answered: How to use \dagger ?
http://cadabra.science/qa/1071/how-to-use-dagger?show=1072#a1072
<p>We are in the process of making this properly supported, but in the meantime, give this function a shot (you need to build Cadabra from source for this, the functionality is not yet in any of the binary packages):</p>
<pre><code>def expand_conjugate(ex):
tst:= (A??)^{\dagger};
for node in ex:
if tst.matches( node ):
rep=$P$
lst=[]
for prod in node["\\prod"]:
for factor in prod.factors():
lst.append($ @(factor) $)
for factor in list(reversed(lst)):
rep.top().append_child($ @(factor)^{\dagger} $)
rep.top().name=r"\prod"
node.replace(rep)
return ex
</code></pre>
<p>If you stick the above in a cell and evaluate it, you can then do</p>
<pre><code>\dagger::Symbol;
ex:= (A B C)^{\dagger} + Q + (D E)^{\dagger};
expand_conjugate(ex);
</code></pre>
<p>to produce</p>
<p>$$C^{\dagger} B^{\dagger} A^{\dagger} + Q + E^{\dagger} D^{\dagger}$$</p>
<p>There will be better support for generic conjugation operations in Cadabra soon.</p>
<p>For the other two lines, try simple substitution with a rule of the type</p>
<pre><code>rl:= { (A?^{\dagger})^{\dagger} = A?,
( (A??)^{\dagger} )^{\dagger} = A??,
A?^{\dagger} A? = 1,
A? A^{\dagger} = 1,
(A??)^{\dagger} A?? = 1,
A?? (A??)^{\dagger} = 1 };
</code></pre>
<p>You can then do e.g.</p>
<pre><code>\dagger::Symbol;
{A,B,U}::NonCommuting;
ex:= ( U^{\dagger} )^{\dagger} + U^{\dagger} U
+ (A B)^{\dagger} + ( (A B)^{\dagger} )^{\dagger};
substitute(ex, rl);
</code></pre>
<p>Hope this helps.</p>
General questionshttp://cadabra.science/qa/1071/how-to-use-dagger?show=1072#a1072Sun, 17 Mar 2019 15:19:13 +0000Answered: NameError: name 'dsolve' is not defined At: <string>(7)
http://cadabra.science/qa/1067/nameerror-name-dsolve-is-not-defined-at-string-7?show=1069#a1069
<p>You need to </p>
<pre><code>from cdb.sympy.solvers import *
</code></pre>
<p>before this works. Requires a fairly recent pull from git, this functionality is not yet in any of the binary distributions. You do not need <code>import sympy</code>, that's already done for you by Cadabra.</p>
General questionshttp://cadabra.science/qa/1067/nameerror-name-dsolve-is-not-defined-at-string-7?show=1069#a1069Sat, 16 Mar 2019 09:22:56 +0000Sort product with symbols
http://cadabra.science/qa/1064/sort-product-with-symbols
<p>Hey, I have been working for a few hours now with substitute and it behaves perfectly so far! <br>
However, now that symbols which were initially indices appear in the main expression, there seems to be a problem with sort product. I am attaching below a sample piece of code:</p>
<pre><code>{\dagger}::Symbol.
{a,b,c,\alpha,\beta,\gamma}::Symbol;
{P^{\dagger}_{a? \alpha?}, K_{a? b?}}::NonCommuting.
{a?, x_{a?},P^{\dagger}_{a? \alpha?}, K_{a? b?}}::SortOrder;
ex:=K_{a b} a x_{a} P^{\dagger}_{b \alpha};
sort_product(_);
</code></pre>
<p>In this case the expression remains unchanged, although the c-numbers a and x_a should be taken to the left. Am I missing something?</p>
<p>Thank you!</p>
General questionshttp://cadabra.science/qa/1064/sort-product-with-symbolsWed, 13 Mar 2019 10:44:30 +0000Answered: How to bypass triple index error for symbols?
http://cadabra.science/qa/1037/how-to-bypass-triple-index-error-for-symbols?show=1062#a1062
<p>I have pushed a fix for this to github master just now. It took a little while longer than planned as this was probably the first time such expressions got tested properly, and in that process I ran into a subtle other <code>substitute</code> bug which I wanted to fix as well. </p>
<p>Let me know if this does what you need (or not, in which case I'll be happy to make more changes/fixes).</p>
General questionshttp://cadabra.science/qa/1037/how-to-bypass-triple-index-error-for-symbols?show=1062#a1062Tue, 12 Mar 2019 19:49:38 +0000Answered: Bug in split index cadabra 2.2.6 (build 2031.aa34dcb4e3 dated 2019-03-04)
http://cadabra.science/qa/1044/bug-split-index-cadabra-build-2031-aa34dcb4e3-dated-2019-04?show=1052#a1052
<p>I have pushed a fix for this to github master. Are you able to build from source?</p>
Bug reportshttp://cadabra.science/qa/1044/bug-split-index-cadabra-build-2031-aa34dcb4e3-dated-2019-04?show=1052#a1052Tue, 05 Mar 2019 15:04:28 +0000Answered: update Cadabra: reference guide and tutorial to 2.x
http://cadabra.science/qa/1039/update-cadabra-reference-guide-and-tutorial-to-2-x?show=1040#a1040
<p>See <a rel="nofollow" href="https://cadabra.science/help.html">https://cadabra.science/help.html</a> (not entirely complete but better than nothing).</p>
Feature requestshttp://cadabra.science/qa/1039/update-cadabra-reference-guide-and-tutorial-to-2-x?show=1040#a1040Sat, 02 Mar 2019 11:02:16 +0000Matrix exponential
http://cadabra.science/qa/1035/matrix-exponential
<p>It would be nicer if the future Cadabra would be able to deal with calculating the exponentials of (Gamma) matrices. </p>
Feature requestshttp://cadabra.science/qa/1035/matrix-exponentialSun, 17 Feb 2019 14:18:29 +0000Examles of using Cadabra for superspace calculations.
http://cadabra.science/qa/1033/examles-of-using-cadabra-for-superspace-calculations
<p>I am trying to use a program for computation in superspace. Unfortunately, this raises many questions. I am sure that many people have already done such calculations. Can someone send examples of such calculations? For example, how the action of covariant derivatives is realized and the chiral superfield is described.</p>
General questionshttp://cadabra.science/qa/1033/examles-of-using-cadabra-for-superspace-calculationsFri, 01 Feb 2019 13:47:09 +0000Answered: Curved and Flat Indices
http://cadabra.science/qa/1031/curved-and-flat-indices?show=1032#a1032
<p>Those are just names; the full form of that first property is</p>
<pre><code> {\mu,\nu,\rho}::Indices(name=curved, position=fixed).
</code></pre>
General questionshttp://cadabra.science/qa/1031/curved-and-flat-indices?show=1032#a1032Thu, 31 Jan 2019 14:36:20 +0000Answered: Please show a simple example showing difference b/w Indices(curved) and Indices(flat).
http://cadabra.science/qa/1029/simple-example-showing-difference-indices-curved-indices?show=1030#a1030
<p>Read the chapter on indices in the reference manual,</p>
<p><a rel="nofollow" href="https://cadabra.science/notebooks/ref_indices.html">https://cadabra.science/notebooks/ref_indices.html</a></p>
<p>Hope that helps; if it doesn't, reply to this and I'll make another attempt.</p>
General questionshttp://cadabra.science/qa/1029/simple-example-showing-difference-indices-curved-indices?show=1030#a1030Tue, 29 Jan 2019 10:00:19 +0000Answered: Substitute Christoffel2nd into Dual Riemann tensor
http://cadabra.science/qa/1027/substitute-christoffel2nd-into-dual-riemann-tensor?show=1028#a1028
<p>The steps should be</p>
<pre><code>substitute(uDualRiemann, lRieman);
substitute(uDualRiemann, Riemann);
substitute(uDualRiemann,Christoffel2nd);
</code></pre>
<p>The 1st line rewrites the Riemann with all lower indices in terms of one with the first index raised. The 2nd line substitutes the definition of the Riemann in terms of Christoffel symbols. And then the 3rd line rewrites the Christoffel symbols in terms of derivatives of the metric.</p>
General questionshttp://cadabra.science/qa/1027/substitute-christoffel2nd-into-dual-riemann-tensor?show=1028#a1028Sun, 27 Jan 2019 11:41:46 +0000Answered: Fedora 29 rpm cpack error
http://cadabra.science/qa/1020/fedora-29-rpm-cpack-error?show=1023#a1023
<p>I have made a few changes to detect Fedora 29 and build the package appropriately (using normal cmake, not cmake3). The resulting package is now available from the download page.</p>
Installation troublehttp://cadabra.science/qa/1020/fedora-29-rpm-cpack-error?show=1023#a1023Mon, 14 Jan 2019 19:06:53 +0000Answered: Correlation functions, Wick theorem and summation
http://cadabra.science/qa/1012/correlation-functions-wick-theorem-and-summation?show=1018#a1018
<p>I am not sure exactly which summation problem you are trying to solve; maybe you can give a bit more detail?</p>
<p>For the Wick story, here's a bit of code I put together a while ago which may help you get things implemented. It basically gives you a <code>contract</code> function which takes a product of fields and replaces all pairs with propagators. You'll need to expand this of course to do real world problems but the gist of the solution is in here.</p>
<p>First, you need something that takes a list of numbers and returns all possible ways in <br>
which you can pair numbers:</p>
<pre><code>def all_pairs(lst):
if len(lst) < 2:
yield []
return
else:
a = lst[0]
for i in range(1,len(lst)):
pair = (a,lst[i])
for rest in all_pairs(lst[1:i]+lst[i+1:]):
yield [pair] + rest
</code></pre>
<p>That's just a bit of standard Python, nothing Cadabra-specific. Then you need something that takes a cadabra expression and does the contractions in there:</p>
<pre><code>def contract(ex):
amp:=0.
L=list(range(len(ex)))
for c in all_pairs(L):
diag:=1;
for p in c:
a1=ex[p[0]][0]
a2=ex[p[1]][0]
diag *= $G( @(a1) - @(a2) )$
amp += diag
return amp
</code></pre>
<p>Hopefully this makes it clear how to take Cadabra expressions apart and build new ones from the pieces. Then the following works:</p>
<pre><code>ex:=\phi(x_1) \phi(x_2) \phi(x_3) \phi(x_4);
contract(ex);
</code></pre>
<p>gives</p>
<p>$$G\left(x_{1}-x_{2}\right) G\left(x_{3}-x_{4}\right)+G\left(x_{1}-x_{3}\right) G\left(x_{2}-x_{4}\right)+G\left(x_{1}-x_{4}\right) G\left(x_{2}-x_{3}\right)$$</p>
<p>For any serious work you'll probably have to rewrite the <code>all_pairs</code> function so that it is not recursive.</p>
General questionshttp://cadabra.science/qa/1012/correlation-functions-wick-theorem-and-summation?show=1018#a1018Sat, 12 Jan 2019 14:13:48 +0000Answered: Fedora 29 rpm is missing
http://cadabra.science/qa/1016/fedora-29-rpm-is-missing?show=1017#a1017
<p>I didn't yet get around to building it, will do so the next few days.</p>
Installation troublehttp://cadabra.science/qa/1016/fedora-29-rpm-is-missing?show=1017#a1017Sat, 12 Jan 2019 12:53:23 +0000Answered: whenever make Cadabra do lengthy calculations, I always get error on output
http://cadabra.science/qa/1009/whenever-cadabra-lengthy-calculations-always-error-output?show=1010#a1010
<p>You'll have to make this a bit more specific. Can you email me (info@cadabra.science) a notebook that fails in this way (preferably as short as possible)? </p>
General questionshttp://cadabra.science/qa/1009/whenever-cadabra-lengthy-calculations-always-error-output?show=1010#a1010Wed, 02 Jan 2019 17:42:33 +0000Answered: Homebrew install problem
http://cadabra.science/qa/1005/homebrew-install-problem?show=1007#a1007
<p>There is now the option to install directly using homebrew. First install MacTeX, either directly from its website, or using homebrew,</p>
<pre><code>brew tap caskroom/cask
brew cask install mactex
</code></pre>
<p>Then install cadabra using</p>
<pre><code>brew tap kpeeters/repo
brew install cadabra2
</code></pre>
<p>These instructions are now also on the download page. Please let me know if you run into any trouble; this has not yet received a lot of testing!</p>
Installation troublehttp://cadabra.science/qa/1005/homebrew-install-problem?show=1007#a1007Mon, 17 Dec 2018 20:26:02 +0000Answered: Grouping substitution rules makes the kernel unresponsive
http://cadabra.science/qa/1001/grouping-substitution-rules-makes-the-kernel-unresponsive?show=1002#a1002
<p>Those output lines suggest that you used a version which wasn't really meant for production. I am assuming you compiled from source? Can you try pulling the latest version from github, building that and then trying again?</p>
<p>If that does not solve the problem, please email your notebook to info@cadabra.science and I'll have a look. If it worked before it is probably something small.</p>
Bug reportshttp://cadabra.science/qa/1001/grouping-substitution-rules-makes-the-kernel-unresponsive?show=1002#a1002Fri, 14 Dec 2018 11:14:08 +0000Answered: collect_factors(_) for Symbol indices
http://cadabra.science/qa/998/collect_factors-_-for-symbol-indices?show=999#a999
<p>It should, it's a bug introduced with tidying up some pattern matching functions. I have just pushed a fix for this to github. Thanks for reporting.</p>
General questionshttp://cadabra.science/qa/998/collect_factors-_-for-symbol-indices?show=999#a999Mon, 03 Dec 2018 15:02:11 +0000