小编Mar*_*ham的帖子

错误:function()至少需要n个参数(给定n)

我正在尝试使用SymPy来获取残留物,在这种情况下是余切函数.我有一个integrate()函数:

import sympy as sy
import numpy as np

def integrate(f, z, gamma, t, lower, upper, exact=True):
    '''
    Integrate f(z) along the contour gamma(t): [lower, upper] --> C

    INPUTS:
    f - A SymPy expression. Should represent a function from C to C.
    z - A SymPy symbol. Should be the variable of f.
    gamma - A SymPy expression. Should represent a function from [lower, upper] to C.
    t - A SymPy symbol. Should be the variable of gamma.
    lower - …
Run Code Online (Sandbox Code Playgroud)

python arguments sympy

8
推荐指数
1
解决办法
6248
查看次数

如何在numpy中创建一个n维网格来评估任意n的函数?

我正在尝试创建一个简单的数值积分函数来说明蒙特卡罗积分在高维度中的好处.我想要这样的东西:

def quad_int(f, mins, maxs, numPoints=100):
    '''
    Use the naive (Riemann sum) method to numerically integrate f on a box 
    defined by the mins and maxs.

    INPUTS:
    f         - A function handle. Should accept a 1-D NumPy array 
        as input.
    mins      - A 1-D NumPy array of the minimum bounds on integration.
    maxs      - A 1-D NumPy array of the maximum bounds on integration.
    numPoints - An integer specifying the number of points to sample in 
        the Riemann-sum method. Defaults …
Run Code Online (Sandbox Code Playgroud)

python arrays numpy numerical-integration

3
推荐指数
1
解决办法
2781
查看次数

标签 统计

python ×2

arguments ×1

arrays ×1

numerical-integration ×1

numpy ×1

sympy ×1