[英]I have a problem with a code. I need to solve this error. Help me
My code is in the picture How I solve this error?我的代码在图片中我如何解决这个错误?
from sympy import *
import math
import numpy as np
from scipy.misc import derivative
x = Symbol ('x')
f = x*sin*(x) *exp**(-x**2)
derivative = f.diff(x)
print(derivative)
TypeError: unsupported operand type(s) for *: 'Symbol' and 'FunctionClass' TypeError: *: 'Symbol' 和 'FunctionClass' 不支持的操作数类型
You have extra stars *
.你有额外的星星*
。 Here is how it should be:应该是这样的:
f = x*sin(x) * exp(-x**2)
sin
and exp
are functions. sin
和exp
是函数。 A single *
is multiplication, and **
is exponentiation.单个*
是乘法,而**
是求幂。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.