I want to solve the following expression using sympy. I have defined all the symbols and functions. c,x,R are functions and f is the equation I want to solve for p. I will have two possible p which I want to plot like the following. p is also between 0 and 1 and I didn't put that and don't know how to define that. x is the derivative of c function wrt k and I have put the inverse of it in the f.
Code:
import sympy as sym
sym.init_printing()
p,q,a,c0,c1,z,k = sym.symbols('p,q,a,c0,c1,z,k')
c = sym.Eq(c0+0.5*c1*(1/k**2))
x = sym.diff(c,k)
R = sym.Eq(z*(a+x**(-1)))
f = sym.Eq((1-p+p*q)*(a+x**(-1))-c-(1-p)*R)
sym.solve([f],(p))