相关疑难解决方法(0)

Python有限差分函数?

我一直在Numpy/Scipy中寻找包含有限差分函数的模块.然而,我发现最接近的是numpy.gradient(),这对于二阶精度的一阶有限差分是有利的,但如果你想要更高阶导数或更准确的方法则不是那么多.我甚至没有为这类事情找到很多具体的模块; 大多数人似乎都在做他们需要的"自己动手"的事情.所以我的问题是,是否有人知道任何模块(Numpy/Scipy的一部分或第三方模块)专门用于高阶(精度和衍生)有限差分方法.我有自己的代码,我正在研究,但它目前有点慢,我不会尝试优化它,如果有'

请注意,我所说的是有限差异,而不是衍生品.我已经看过两个scipy.misc.derivative()Numdifftools,它们采用了我没有的分析函数的衍生物.

python numpy scipy

33
推荐指数
4
解决办法
3万
查看次数

Calculating a 3D gradient with unevenly spaced points

I currently have a volume spanned by a few million every unevenly spaced particles and each particle has an attribute (potential, for those who are curious) that I want to calculate the local force (acceleration) for.

np.gradient only works with evenly spaced data and I looked here: Second order gradient in numpy where interpolation is necessary but I could not find a 3D spline implementation in Numpy.

Some code that will produce representative data:

import numpy as np    
from scipy.spatial …
Run Code Online (Sandbox Code Playgroud)

python numpy scipy numerical-methods derivative

5
推荐指数
1
解决办法
1569
查看次数

标签 统计

numpy ×2

python ×2

scipy ×2

derivative ×1

numerical-methods ×1