function [Bdp1,Bdp2] = bayespoints(m1,sd1,m2,sd2)
%calculates Bayes discriminate points for 1D 2-class with equal priors.
%m1 and sd1 are mean and standard deviation of class 1
%m2 and sd2 are mean and standard deviation of class 2
Bdp1=0;
Bdp2=0;
v1=sd1^2;
v2=sd2^2;
a=(1/(2*v2)-1/(2*v1));
b=(m1/v1-m2/v2);
c=(m2^2/(2*v2)-m1^2/(2*v1))+log(sd2/sd1);
disp([a,b,c])
if abs(a)<0.001 && abs(b)<0.001
    disp([a,b,c])
    return
end
if abs(a)<0.001
    Bdp1=-c/b;
    Bdp2=Bdp1;
    return
end
arg=b^2-4*a*c;
disp([a,b,c,arg])
if arg>0
    rad=sqrt(arg);
    Bdp1=(-b+rad)/(2*a);
    Bdp2=(-b-rad)/(2*a);
end
end
    



