syms f(x) x K B i o;

f(x) = B*(K*sin(x))/(1+K*cos(x));
g(x) = i*sin(x)/(sqrt(i^2+o^2+2*i*o*cos(x)));

df = diff(f)
dg = diff(g);

eqnf = df == 0;
solve(eqnf,x)

eqng = dg == 0;
solve(eqng,x);

ddf = diff(df);
x = pi + acos(K);
K = 0.1;
B = 1;
eval(subs(f));