Skip to content

Commit 449ff2f

Browse files
authored
fix parser docs (#4530)
1 parent bbe3bb3 commit 449ff2f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Docs/sphinx_documentation/source/Basics.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,8 @@ numbers can be computed with ``min`` and ``max``, respectively. It supports
646646
the Heaviside step function, ``heaviside(x1,x2)`` that gives ``0``, ``x2``,
647647
``1``, for ``x1 < 0``, ``x1 = 0`` and ``x1 > 0``, respectively.
648648
It supports the Bessel function of the first kind of order ``n``
649-
``jn(n,x)``, and the Bessel function of the second kind of order ``n`` ``yn(n,x)``. Complete elliptic integrals of the first and second kind, ``comp_ellint_1(k)`` and ``comp_ellint_2(k)``,
649+
``jn(n,x)``, and the Bessel function of the second kind of order ``n`` ``yn(n,x)``.
650+
Complete elliptic integrals of the first and second kind, ``comp_ellint_1(k)`` and ``comp_ellint_2(k)``,
650651
are supported.
651652
There is ``if(a,b,c)`` that gives ``b`` or ``c`` depending on the value of
652653
``a``. A number of comparison operators are supported, including ``<``,
@@ -661,9 +662,9 @@ the parser.
661662
::
662663

663664
Parser parser("if(x>a and x<b, sin(x)*cos(y)*if(z<0, 1.0, exp(-z)), .3*c**2)");
664-
parser.setConstant(a, ...);
665-
parser.setConstant(b, ...);
666-
parser.setConstant(c, ...);
665+
parser.setConstant("a", ...);
666+
parser.setConstant("b", ...);
667+
parser.setConstant("c", ...);
667668
parser.registerVariables({"x","y","z"});
668669
auto f = parser.compile<3>(); // 3 because there are three variables.
669670

@@ -672,7 +673,7 @@ the parser.
672673
for (int k = 0; ...) {
673674
for (int j = 0; ...) {
674675
for (int i = 0; ...) {
675-
a(i,j,k) = f(i*dx, j*dy, k*dz);
676+
my_array(i,j,k) = f(i*dx, j*dy, k*dz);
676677
}
677678
}
678679
}

0 commit comments

Comments
 (0)