! MExample Program 3-5

! Use of exponentiation

! Change exponent, experiment with logarithm functions

 

LET X = 5 ! assigns numerical value 5 to numerical variable X

PRINT "The PI of"; X; "is"; X^3.14 ! note that pi , Pi and PI are 3.14...

LET y = log(pi)

PRINT y

LET z = 10^y

PRINT z

LET w = log (10)

PRINT w ! shows log means ln

LET k = log10(1000)

PRINT k ! should be 3 if log10 means log to base 10

LET j = 10^log10(1000)

PRINT j ! should give 1000 back

SOUND 3000, .2 ! for fun

! What is the value of e? Compute

LET m = exp(1) ! exponential function

PRINT m ! comes out 2.71828

! which is bigger ? Pi^e or e^pi? (ans: e^pi)

LET n = (pi^exp(1))/(exp(1)^pi)

PRINT "The ratio pi^e/e^pi is ..."; n ! comes out 0.97

END