Skip to content

Commit bfb7764

Browse files
committed
Fix programming chapter of reference guide.
1 parent be1d98c commit bfb7764

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

examples/ref_programming.cnb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@
434434
{
435435
"cell_origin" : "client",
436436
"cell_type" : "input",
437-
"source" : "def expand_nabla(ex):\n for nabla in ex[r'\\nabla']:\n nabla.name=r'\\partial'\n dindex = nabla.indices().__next__() \n for arg in nabla.args(): \n ret:=0;\n for index in arg.free_indices():\n t2:= @(arg);\n if index.parent_rel==sub:\n t1:= -\\Gamma^{p}_{@(dindex) @(index)};\n t2[index]:= _{p};\n else:\n t1:= \\Gamma^{@(index)}_{@(dindex) p};\n t2[index]:= ^{p};\n ret += t1 * t2\n nabla += ret\n return ex"
437+
"source" : "def expand_nabla(ex):\n for nabla in ex[r'\\nabla']:\n nabla.name=r'\\partial'\n dindex = nabla.indices().__next__() \n for arg in nabla.args(): \n ret:=0;\n for index in arg.free_indices():\n t2:= @(arg);\n if index.parent_rel==sub:\n t1:= -\\Gamma^{p}_{@(dindex) @(index)};\n t2[index]:= _{p};\n else:\n t1:= \\Gamma^{@(index)}_{@(dindex) p};\n t2[index]:= ^{p};\n ret += Ex(str(nabla.multiplier)) * t1 * t2\n nabla += ret\n return ex"
438438
},
439439
{
440440
"cell_origin" : "client",
@@ -468,10 +468,10 @@
468468
{
469469
"cell_origin" : "server",
470470
"cell_type" : "input_form",
471-
"source" : "\\nabla_{a}(h^{b}_{c})"
471+
"source" : " 1/2 \\nabla_{a}(h^{b}_{c})"
472472
}
473473
],
474-
"source" : "\\begin{dmath*}{}\\nabla_{a}{h^{b}\\,_{c}}\\end{dmath*}"
474+
"source" : "\\begin{dmath*}{}\\frac{1}{2}\\nabla_{a}{h^{b}\\,_{c}}\\end{dmath*}"
475475
},
476476
{
477477
"cell_origin" : "server",
@@ -481,13 +481,13 @@
481481
{
482482
"cell_origin" : "server",
483483
"cell_type" : "input_form",
484-
"source" : "\\partial_{a}(h^{b}_{c}) + \\Gamma^{b}_{a p} h^{p}_{c}-\\Gamma^{p}_{a c} h^{b}_{p}"
484+
"source" : " 1/2 \\partial_{a}(h^{b}_{c}) + 1/2 \\Gamma^{b}_{a p} h^{p}_{c} - 1/2 \\Gamma^{p}_{a c} h^{b}_{p}"
485485
}
486486
],
487-
"source" : "\\begin{dmath*}{}\\partial_{a}\\left(h^{b}\\,_{c}\\right)+\\Gamma^{b}\\,_{a p} h^{p}\\,_{c}-\\Gamma^{p}\\,_{a c} h^{b}\\,_{p}\\end{dmath*}"
487+
"source" : "\\begin{dmath*}{}\\frac{1}{2}\\partial_{a}\\left(h^{b}\\,_{c}\\right)+\\frac{1}{2}\\Gamma^{b}\\,_{a p} h^{p}\\,_{c} - \\frac{1}{2}\\Gamma^{p}\\,_{a c} h^{b}\\,_{p}\\end{dmath*}"
488488
}
489489
],
490-
"source" : "\\nabla{#}::Derivative;\nex:= \\nabla_{a}{ h^{b}_{c} }; \nexpand_nabla(ex);"
490+
"source" : "\\nabla{#}::Derivative;\nex:= 1/2 \\nabla_{a}{ h^{b}_{c} }; \nexpand_nabla(ex);"
491491
},
492492
{
493493
"cell_origin" : "client",
@@ -502,10 +502,10 @@
502502
{
503503
"cell_origin" : "server",
504504
"cell_type" : "input_form",
505-
"source" : "\\nabla_{a}(v_{b} w^{b})"
505+
"source" : " 1/4 \\nabla_{a}(v_{b} w^{b})"
506506
}
507507
],
508-
"source" : "\\begin{dmath*}{}\\nabla_{a}\\left(v_{b} w^{b}\\right)\\end{dmath*}"
508+
"source" : "\\begin{dmath*}{}\\frac{1}{4}\\nabla_{a}\\left(v_{b} w^{b}\\right)\\end{dmath*}"
509509
},
510510
{
511511
"cell_origin" : "server",
@@ -515,13 +515,13 @@
515515
{
516516
"cell_origin" : "server",
517517
"cell_type" : "input_form",
518-
"source" : "\\partial_{a}(v_{b} w^{b})"
518+
"source" : " 1/4 \\partial_{a}(v_{b} w^{b})"
519519
}
520520
],
521-
"source" : "\\begin{dmath*}{}\\partial_{a}\\left(v_{b} w^{b}\\right)\\end{dmath*}"
521+
"source" : "\\begin{dmath*}{}\\frac{1}{4}\\partial_{a}\\left(v_{b} w^{b}\\right)\\end{dmath*}"
522522
}
523523
],
524-
"source" : "ex:= \\nabla_{a}{ v_{b} w^{b} };\nexpand_nabla(ex);"
524+
"source" : "ex:= 1/4 \\nabla_{a}{ v_{b} w^{b} };\nexpand_nabla(ex);"
525525
},
526526
{
527527
"cell_origin" : "client",

0 commit comments

Comments
 (0)