How to use the quadpy.helpers.fsd function in quadpy

To help you get started, we’ve selected a few quadpy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nschloe / quadpy / quadpy / s2 / _kim_song / __init__.py View on Github external
def kim_song_9():
    data = [
        (0.051310052712355, fsd(2, (0.680167267076408, 2))),
        (0.208368275231940, fsd(2, (0.232463234651158, 2))),
        (0.113628206510048, fsd(2, (0.547722557505169, 2))),
        (0.126977836503225, fsd(2, (0.652159581445885, 1), (0.174745633184644, 1))),
        (0.079067977968328, fsd(2, (0.904823085572323, 1), (0.242446615072141, 1))),
    ]
    points, weights = untangle(data)
    weights /= math.pi
    return S2Scheme("Kim-Song 9", weights, points, 11, _source, 1.742e-14)
github nschloe / quadpy / quadpy / cn / _mcnamee_stenger.py View on Github external
I0
        - 2 * n * (A1 + A2)
        - 2 ** 2 * comb(n, 2) * (A11 + 2 * A12 + A22)
        - 2 ** 3 * comb(n, 3) * (A111 + A222)
        - 2 ** 4 * comb(n, 4) * A1111
    )

    u = sqrt(u2)
    v = sqrt(v2)

    data = [
        (A0, z(n)),
        (A1, fsd(n, (u, 1))),
        (A2, fsd(n, (v, 1))),
        (A11, fsd(n, (u, 2))),
        (A12, fsd(n, (u, 1), (v, 1))),
        (A22, fsd(n, (v, 2))),
        (A111, fsd(n, (u, 3))),
        (A222, fsd(n, (v, 3))),
        (A1111, fsd(n, (u, 4))),
    ]

    points, weights = untangle(data)

    weights /= I0
    variant = "a" if not switch_uv else "b"
    return f"McNamee-Stenger 9{variant}", n, weights, points, 9, _source
github nschloe / quadpy / quadpy / c3 / _hammer_stroud.py View on Github external
def hammer_stroud_6_3():
    alpha = sqrt(frac(6, 7))
    data = [
        (frac(1078, 3645), fsd(3, (alpha, 1))),
        (frac(343, 3645), fsd(3, (alpha, 2))),
        (0.2247031747656014, pm(3 * [0.7341125287521153])),
        (0.4123338622714356, pm(3 * [0.4067031864267161])),
    ]
    points, weights = untangle(data)
    weights /= 8
    return C3Scheme("Hammer-Stroud 6-3", weights, points, 7, _source)
github nschloe / quadpy / quadpy / s2 / _kim_song / __init__.py View on Github external
def kim_song_6():
    data = [
        (2 / 27 * math.pi, fsd(2, (0.866025403784439, 1))),
        (0.387077796006226, fsd(2, (0.322914992067400, 2))),
        (0.165609800458645, fsd(2, (0.644171310389465, 2))),
    ]
    points, weights = untangle(data)
    weights /= math.pi
    return S2Scheme("Kim-Song 6", weights, points, 7, _source)
github nschloe / quadpy / quadpy / c3 / _hammer_stroud.py View on Github external
def hammer_stroud_1_3():
    data = [(frac(1, 6), fsd(3, (1, 1)))]
    points, weights = untangle(data)
    return C3Scheme("Hammer-Stroud 1-3", weights, points, 3, _source)
github nschloe / quadpy / quadpy / enr2 / _stenger.py View on Github external
+0.112077863004144e2,
                +0.392940404320855e-2,
                -0.254859786784158e1,
                +0.775156917007496e-1,
                -0.130980134773619e-2,
                +0.509719573568315,
                +0.436600449245395e-3,
            ],
        ),
    }[dim]

    data = [
        (B[0], z(dim)),
        (B[1], fsd(dim, (u, 1))),
        (B[2], fsd(dim, (v, 1))),
        (B[3], fsd(dim, (u, 2))),
        (B[4], fsd(dim, (v, 2))),
        (B[5], fsd(dim, (u, 1), (v, 1))),
        (B[6], fsd(dim, (u, 3))),
        (B[7], fsd(dim, (v, 3))),
    ]
    if dim > 3:
        data += [(B[8], fsd(dim, (u, 4)))]

    points, weights = untangle(data)
    weights /= math.sqrt(math.pi) ** dim
    return Enr2Scheme("Stenger 9a", dim, weights, points, 9, source)
github nschloe / quadpy / tools / improve_precision.py View on Github external
def f(x):
        degree = 11
        n = 5
        u = x[0]
        v = x[1]
        w = x[2]
        B = x[3:]
        data = [
            (B[0], z(n)),
            (B[1], fsd(n, (u, 1))),
            (B[2], fsd(n, (v, 1))),
            (B[3], fsd(n, (w, 1))),
            (B[4], fsd(n, (u, 2))),
            (B[5], fsd(n, (v, 2))),
            (B[6], fsd(n, (w, 2))),
            (B[7], fsd(n, (u, 1), (v, 1))),
            (B[8], fsd(n, (u, 1), (w, 1))),
            (B[9], fsd(n, (u, 3))),
            (B[10], fsd(n, (v, 3))),
            (B[11], fsd(n, (w, 3))),
            (B[12], fsd(n, (u, 2), (v, 1))),
        ]
        if n > 3:
            data += [(B[13], fsd(n, (u, 4))), (B[14], fsd(n, (v, 4)))]
        if n > 4:
            data += [(B[15], fsd(n, (u, 5)))]
        points, weights = untangle(data)

        exponents = get_all_exponents(n, degree)
        # flatten list
github nschloe / quadpy / quadpy / enr2 / _stenger.py View on Github external
[
                -0.309679578630802e4,
                +0.815423321880237e3,
                +0.117326937169073,
                -0.173057295296448e3,
                +0.130511250871491,
                +0.232307582494626e2,
            ],
        ),
    }[dim]

    data = [
        (B[0], z(dim)),
        (B[1], fsd(dim, (u, 1))),
        (B[2], fsd(dim, (v, 1))),
        (B[3], fsd(dim, (u, 2))),
        (B[4], fsd(dim, (v, 2))),
        (B[5], fsd(dim, (u, 3))),
    ]
    points, weights = untangle(data)
    weights /= math.sqrt(math.pi) ** dim
    return Enr2Scheme("Stenger 7a", dim, weights, points, 7, source, 1.091e-13)
github nschloe / quadpy / tools / improve_precision.py View on Github external
# v = x[1]
        # w = x[2]
        # B = x[3:]
        B = x

        data = [
            (B[0], z(n)),
            (B[1], fsd(n, (u, 1))),
            (B[2], fsd(n, (v, 1))),
            (B[3], fsd(n, (w, 1))),
            (B[4], fsd(n, (u, 2))),
            (B[5], fsd(n, (v, 2))),
            (B[6], fsd(n, (w, 2))),
            (B[7], fsd(n, (u, 1), (v, 1))),
            (B[8], fsd(n, (u, 1), (w, 1))),
            (B[9], fsd(n, (u, 3))),
            (B[10], fsd(n, (v, 3))),
            (B[11], fsd(n, (w, 3))),
            (B[12], fsd(n, (u, 2), (v, 1))),
        ]

        points, weights = untangle(data)

        exponents = get_all_exponents(n, degree)
        # flatten list
        exponents = numpy.array([item for sublist in exponents for item in sublist])

        def evaluate_all_monomials(x):
            return numpy.prod(x[..., None] ** exponents.T[:, None], axis=0).T

        flt = numpy.vectorize(float)
        exact_vals = flt([integrate_monomial_over_unit_nball(k) for k in exponents])
github nschloe / quadpy / quadpy / enr2 / _stenger.py View on Github external
[
                +0.616293651884027e3,
                +0.107529736766179e1,
                -0.113807008098269e3,
                -0.610828352270520e-1,
                +0.127887706992535e2,
                +0.239492607623178e-1,
            ],
        ),
    }[dim]

    data = [
        (B[0], z(dim)),
        (B[1], fsd(dim, (u, 1))),
        (B[2], fsd(dim, (v, 1))),
        (B[3], fsd(dim, (u, 2))),
        (B[4], fsd(dim, (v, 2))),
        (B[5], fsd(dim, (u, 3))),
    ]
    points, weights = untangle(data)
    weights /= math.sqrt(math.pi) ** dim
    return Enr2Scheme("Stenger 7b", dim, weights, points, 7, source)