python中插值函数绕Y轴旋转的体积

问题描述 投票:0回答:0

我有一个 (x,y) 数据集,x 域为 (0,10)。该数据集表示我想要查找其体积的对象的横截面。我的想法是:

  • 对数据集进行线性插值,得到插值函数 f(x)。
  • 求 f(x) -> g(y) 的倒数
  • 使用方程 $\pi\int_a^b g(y)^2dy $
  • 执行函数 g(y) 绕 y 轴的旋转积分

这是我迄今为止所掌握的内容的片段:

import numpy as np
from scipy import interpolate
from scipy.integrate import quad

#assume (x,y) dataset has been imported as xvals, yvals

f = interpolate.interp1d(xvals,yvals)
area=quad(f,0,xvals[-1],limit=200) #this finds the cross sectional area, I need a 3D volume

如何找到逆 g(y)?或者更一般地说,找到绕 y 轴旋转的形状所包围的体积的最佳过程是什么?

python scipy integration interpolation
© www.soinside.com 2019 - 2024. All rights reserved.