-1
import sympy as sp
def taylorCoefficient(f, a, n):
x = sp.symbols("x")
coefficient = []
for i in range(0, n + 1):
afgeleide = sp.diff(f(x), x, n=n)
def f(x0): return afgeleide.subs(x, x0)
coefficient += f(a)/sp.factorial(n)
return coefficient
x = sp.symbols("x")
taylorCoefficient(x ** 2 * sp.sin(x/2), 0, 3)
私はmulオブジェクトを呼び出すことはできませんが、なぜですか? (on line afgeleide = ...)"mulオブジェクトは呼び出し可能ではありません" - エラー
トレースバックお願い –
'f'は呼び出し可能でない' Mul'オブジェクトです。あなたはそれがあると思いましたか?どうして? – Goyo