I have this integral, the semi standard deviation for calculation the Sortino ratio, however I cannot seem to get an analytical solution to this
The mathematical expression of the integral
import sympy as sy
c = sy.Symbol('B')
x = sy.Symbol('x')
a= sy.Symbol('-sy.oo')
x = sy.Symbol('x')
f=sy.Symbol('f')
d=sy.Symbol('d')
f1 = sy.integrate(sy.sqrt((c-x)**2* f(x)*dx),(x, -sy.oo, c))
I get the below error
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/var/folders/hc/13tll2g535x553nmqlfcyztr0000gn/T/ipykernel_70280/1712613650.py in <module>
----> 1 f1 = sy.integrate(sy.sqrt((c-x)**2* f(x)*dx),(x, -sy.oo, 0.2))
TypeError: 'Symbol' object is not callable
You defined f as a Symbol, so sympy doesn't know what to do when you write f(x).
Try with
sympy.Function
instead ofsympy.Symbol
.