[R] Searching for antilog function

Gabor Grothendieck ggrothendieck at myway.com
Thu Nov 25 05:22:58 CET 2004


Heather J. Branton <hjb <at> pdq.com> writes:

: 
: Thank you so much for each of your responses. But to make sure I am 
: clear (in my own mind), is this correct?
: 
: If  x = 2^y
: Then  y = log2(x)
: 
: Thanks again. I know this is basic.

Although its not a proof, you can still use R to help you
verify such hypotheses.  Just use actual vectors of numbers 
and check that your hypothesis, in this case y equals log2(x),
holds.

For example,

R> # try it out with the vector 1,2,3,...,10
R> y <- 1:10
R> y
 [1]  1  2  3  4  5  6  7  8  9 10
R> # now calculate x
R> x <- log2(y)
R> # lets see what 2^x looks like:
R> 2^x 
 [1]  1  2  3  4  5  6  7  8  9 10
R> # it gave back y!




More information about the R-help mailing list