[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: log to arbitrary base
From: |
Alexander Hansen |
Subject: |
Re: log to arbitrary base |
Date: |
Mon, 17 Aug 2015 17:13:22 -0700 |
> On Aug 17, 2015, at 15:23, Eric Smith <address@hidden> wrote:
>
> Hi
>
> Both qalc (1) and Matlab have a log function like;
> log(125, 5) = 3
>
> How do I find the log to base n with Octave?
>
> Eric
>
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-octave
y=log(x)/log(n) is a standard technique to do that, and is independent of the
base of the “log” function. For example, if you wanted the log of 27 to the
base 3:
octave:6> log(27)/log(3) #natural log
ans = 3
octave:7> log2(27)/log2(3) #base 2
ans = 3
octave:8> log10(27)/log10(3) #base 10
ans = 3
--AKH