Fungrim home page

Fungrim entry: 43cc72

Symbol: For \ldots General-purpose generator
For(x) declares the given symbol as locally bound variable in the scope of the parent call. For example, f(a, For(x), b) declares xx as a locally bound variable that may be used within the expressions aa and bb. The interpretation of the variable is left to the parent operator ff.
Called with a tuple of symbols, For(Tuple(x, y, z)), each symbol becomes a locally bound variable.
Called with several arguments, for example For(x, a, b, c), the additional parameters aa bb cc specify information about the range of xx. The interpretation of the parameters is up to the parent operator ff. Most operators recognize For() with two additional parameters as specifying an iteration range: for example, Sum(Factorial(n), For(n, 2, 10)) gives n=210n!\sum_{n=2}^{10} n !. (When For(n, a, b) is used in this sense, the endpoints aa and bb must be integers or possibly a=a = -\infty and/or b=b = \infty where an infinite sequence makes sense. The iteration sequence is empty if b<ab < a.)
There are various exceptions. For example, Integral understands two parameters as representing the endpoints (not necessarily integers) of a directed line segment to integrate over: Integral(Cos(x), For(x, Neg(Pi), Pi)) becomes ππcos(x)dx\int_{-\pi}^{\pi} \cos(x) \, dx. Derivative takes one or two parameters denoting the evaluation point and optionally the order of differentiation: Derivative(Sin(x), For(x, y)) becomes sin(y)\sin'(y) and Derivative(Sin(x), For(x, y, 2)) becomes sin(y)\sin''(y).
Definitions:
Fungrim symbol Notation Short description
Sumnf(n)\sum_{n} f(n) Sum
Factorialn!n ! Factorial
Infinity\infty Positive infinity
Integralabf(x)dx\int_{a}^{b} f(x) \, dx Integral
Coscos(z)\cos(z) Cosine
Piπ\pi The constant pi (3.14...)
Derivativeddzf ⁣(z)\frac{d}{d z}\, f\!\left(z\right) Derivative
Sinsin(z)\sin(z) Sine
Source code for this entry:
Entry(ID("43cc72"),
    SymbolDefinition(For, Ellipsis, "General-purpose generator"),
    Description(SourceForm(For(x)), "declares the given symbol as locally bound variable in the
    scope of the parent call. For example,", SourceForm(f(a, For(x), b)), "declares", x, "as a locally bound variable that may be used within the expressions ", a, "and", b, ". The interpretation of the variable is left to the
    parent operator", f, "."),
    Description("Called with a tuple of symbols,", SourceForm(For(Tuple(x, y, z))), ", each symbol
    becomes a locally bound variable."),
    Description("
    Called with several arguments, for example ", SourceForm(For(x, a, b, c)), ", the additional parameters", a, b, c, "specify information about the range of", x, ".", "The interpretation of the parameters is up to the parent operator", f, ". Most operators recognize ", SourceForm(For()), "with two additional parameters as
    specifying an iteration range: for example, ", SourceForm(Sum(Factorial(n), For(n, 2, 10))), "gives", Sum(Factorial(n), For(n, 2, 10)), ".", "(When", SourceForm(For(n, a, b)), " is used in this sense, the endpoints", a, "and", b, "must be integers or possibly", Equal(a, Neg(Infinity)), "and/or", Equal(b, Infinity), "where an infinite sequence makes sense. ", "The iteration sequence is empty if", Less(b, a), ".)"),
    Description("
    There are various exceptions. For example,", SourceForm(Integral), "understands two
    parameters as representing the endpoints (not necessarily integers)
    of a directed line segment to integrate over: ", SourceForm(Integral(Cos(x), For(x, Neg(Pi), Pi))), "becomes", Integral(Cos(x), For(x, Neg(Pi), Pi)), ". ", SourceForm(Derivative), "takes one or two parameters", "denoting the evaluation point and optionally the order of differentiation:", SourceForm(Derivative(Sin(x), For(x, y))), "becomes", Derivative(Sin(x), For(x, y)), "and", SourceForm(Derivative(Sin(x), For(x, y, 2))), "becomes", Derivative(Sin(x), For(x, y, 2)), "."))

Topics using this entry

Copyright (C) Fredrik Johansson and contributors. Fungrim is provided under the MIT license. The source code is on GitHub.

2021-03-15 19:12:00.328586 UTC