from math import pi,sin
#given signal is Sx=(N/2)*rect(w/4(pi)B)
N=1#
B=1#
T=input("enter the value of T : ")
Rx=(N*B)*(sin(2*(pi)*B*T))#
print "mean square value of the signal is %0.4f"%Rx,"Watt"
from math import cos
# autocorrelation function of given signal is A**2/2 * cos(wct)
A=2#
wct=input("enter the value of wct : ")
Rx=((A**2)/2)* cos(wct)#
print "mean square value of the process is %.4f"%Rx,"Watt"
P1=input("enter prob of symbol 1 : ")
P2=input("enter prob of symbol -1 : ")
ak=(1)*P1+(-1)*P2#
print "mean is",ak
Ro=(1**2)*P1+((-1)**2)*P2#
print "mean square is",Ro
P1=input("enter prob of symbol 1 : ")
P0=input("enter prob of symbol 0 : ")
ak=(1)*P1+(0)*P2#
print "mean is",ak
Ro=(1**2)*P1+((0)**2)*P2#
print "mean square is",Ro
# bipolar signalling
P0=input("enter prob of symbol 0 : ")
P1=input("enter prob of symbol 1 : ")
P2=input("enter prob of symbol -1 : ")
ak=(0)*P0+(1)*P1+(-1)*P2#
print "mean is",ak
Ro=(0**2)*P0+(1**2)*P1+((-1)**2)*P2#
print "mean square is",Ro