I have a problem with a code. I need to solve this error. Help me
Question:
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’
Answers:
You have extra stars *
. Here is how it should be:
f = x*sin(x) * exp(-x**2)
sin
and exp
are functions. A single *
is multiplication, and **
is exponentiation.
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’
You have extra stars *
. Here is how it should be:
f = x*sin(x) * exp(-x**2)
sin
and exp
are functions. A single *
is multiplication, and **
is exponentiation.