import numpy
import numpy
import matplotlib
from matplotlib import pyplot
%matplotlib inline
x=numpy.linspace(0,1,7);
y=10**x;
pyplot.plot(x,y);
pyplot.title(" graph of y=10**x")
pyplot.xlabel("x axis")
pyplot.ylabel("y axis");
pyplot.legend("y=10**x");
pyplot.grid()
pyplot.show()
#ex1:1.8*2.6=? ,from graph
#1.8=10**0.26 \n 2.6=10**0.42
x=10**0.26;y=10**0.42;
#format(4)
ex1_ans=x*y#from the graph
#ex2:9**(1/3)
#9=10**0.96
x=10**0.96;
#format(4)
ex2_ans=x**(1/3)#third law of indices
print ex1_ans,ex2_ans
import math
from math import log10
ans1=log10(56.2)
ans2=10
ans3=log10(1000)
ans4=log10(81)/log10(3)
print ans1,ans2,ans3,ans4
#no. whose logarithm is 2.3714
mantissa=0.3714;
print("from anti-logarithm table,corresponding no. is 2352")
# As,characteristic is 2,no. must lie between 100 & 1000.\n \n hence 3 significant figures in the intergral part
print 235.2
#value of (57.86*4.385)
from math import log10
#log(p*q)=log(p)+log(q)
p=57.86;q=4.385;
logx=log10(p)+log10(q);
format(6)
x=10**logx
print x
#value of (5.672*18.94)/1.758
from math import log10
#log(p*q)=log(p)+log(q) , log(p/q)=log(p)-log(q)
p=5.672;q=18.94;r=1.758;
logx=log10(p)+log10(q)-log10(r);
x=10**logx
print round(x,1)
#5th root of 721.8
from math import log10
#log(a)^n=n*log(a)
p=721.8;n=1./5.;
logx=n*log10(p);
#format(6)
x=10**logx
print round(x,3)
#logs of 0.3185,0.03185,0.003185
from math import log10
x=0.3185;y=0.03185;z=0.003185;
logx=log10(0.3185)
logy=log10(0.03185)
logz=log10(0.003185)
print round(logx,4),round(logy,4),round(logz,4)
#no. with logarithm -3.5416
mantissa=0.5416;
print("from anti-logarithm table, corresponding no.is 3840 ")
#characteristic is -3.\n \n hence there will be 2 zeros after the decimal point
print 0.003480
#sum of logarithms -1.6173,-2.3415,-1.6493,-0.7374
x=.6173;y=.3415;z=.6493;a=0.7374;#mantissa's of all 4 logarithms
mantissa=x+y+z+a;
#2 which is carried forward from the addition of mantissa is +ve.
characteristic=-1-2-1-0+2;#characteristic part of all 4 logarithms
print("sum=-",mantissa)
#logarithm : -1.6175-(-3.8463)
mantissa=1.6175-0.8463;
#in borrowing to subtract 8 from 6, -1(characteristic) becomes -2
characteristic=-2-(-3);
print mantissa+characteristic
#logarithm : multiply -2.8763 by 3
num=2.8763;#given
mantissa=0.8763;
mul=mantissa*3;
#when mantissa is multiplied, 2 is carried forward. (-2)*3=-6. the characteristic becomes -6+2=-4
print -4.6289
#logarithm: -1.8738*1.3
#multiply mantissa & characteristic seperately and add results
x=0.8738*1.3;
y=-1*1.3;
#as y=-1.3 is -ve, change it to -2.7 to make mantissa +ve
y=-2.7;
mantissa_sum=0.13594+0.7; #of x & y
characteristic_sum=2-1;
print 2*characteristic_sum-mantissa_sum
#divide -5.3716 by 3
#characteristic=-5=-6+1 or the log as -6+1.3716
characteristic=-6/3;
mantissa=1.3716/3;
print characteristic-mantissa
#log50 to the base e
from math import log
print round(log(50),3)#natural logarithm
# or, log50_base_e=log10(50)*2.3026