本文整理汇总了Python中sympy.Function.subs方法的典型用法代码示例。如果您正苦于以下问题:Python Function.subs方法的具体用法?Python Function.subs怎么用?Python Function.subs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sympy.Function
的用法示例。
在下文中一共展示了Function.subs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: open
# 需要导入模块: from sympy import Function [as 别名]
# 或者: from sympy.Function import subs [as 别名]
GCodeFile = open('C:\\3D Printer Calculus Project\\docs\\Sample.txt', 'w+')
x = Symbol('x')
f = Function('f')(x)
f = 0.5*x
xVals = []
yVals = []
zVals = []
SideArray = []
TotalVolume = 0
AxisChoice = gui.AxisRevScreen()
if AxisChoice == "X-axis":
Bounds = gui.BoundsScreen()
FirstBound = int(Bounds[0])
FinalBound = int(Bounds[1])
xInitialVal = FirstBound
yInitialVal = f.subs(x, FirstBound)
zInitialVal = 0
xVals.append(xInitialVal)
yVals.append(yInitialVal)
zVals.append(zInitialVal)
FinalBound1 = int(FinalBound * 10)
FirstBound1 = int(FirstBound * 10)
for t in range (FirstBound1, FinalBound1):
### This for loop generates the x coordinates ###
if t % 2 == 0:
xVal = t/10.0
for i in range (1,37):
###This for loop generates the y and z coordinates for each x coordinate when the graph is spun around###
newYVal = f.subs(x, xVal) * np.cos((3.14159265359*i)/18)
newZVal = f.subs(x, xVal) * np.sin((3.14159265359*i)/18)
yVals.append(newYVal)