Thanks,
Laith E.H.
If you look in an algebra textbook, you'll find the following
property of logarithms:
log_a(x) = ln(x)/ln(a)
where log_a(x) is "Log base a of x" (in your case "Log base 2
of 8000"), and ln is (of course) natural logarithm, log base e.
So your answer will be 12. You can verify this by EVALuating
the following expression:
'FLOOR(LN(8000)/LN(2))'
Hope this helps,
katz
--
In order to e-mail me a reply to this message, you will have
to edit the address shown in the header. You know what to do.
log base x y=logy/logx
base of logs on right can be anything, but since you just happen to have the
base 10 key, I suggest it
Galen
>How do I do: floor(log base2 8000) for instance. I only see the log
>base10 key. Is there a way to change the base of the log function on an
>HP48G?
No, but you don't need to. In fact, strictly speaking you don't need
the LOG function if you have the LN function (and vice versa, if you
have or know the value of e as well).
If you know anything about logarithms, you also know the following
equality: a^log(x) = b^log(x)/b^log(a). So, in order to calculate
2^log(8000) you can use either log(8000)/log(2) or ln(8000)/ln(2).
That's just basic mathematical knowledge. A scientific calculator is a
tool, not a magical device...
Oh, by the way. If you want to use the 2^log() function (also know as
lg() to computer scientists) often, you can put the following program
in your HP48's home directory under the name of 'LG' and then simply
use LG in algabraic expressions as you would LOG or LN:
<< -> x 'LN(x)/LN(2)' >>
Jarno Peschier, computer science student, Utrecht University
mailto:jpes...@cs.ruu.nl http://jarno.home.ml.org/
____________________________________________________________
'avwI' nejDI' narghta'bogh qama' reH 'avwI' Sambej
-----------------------------------------------------
Blake T. Garretson
bgar...@eng.utoledo.edu
http://eng.utoledo.edu/~bgarrets
-----------------------------------------------------
Several readers have replied that log base 2 of x = ln(x)/ln(2) or
log(x)/log(2). Although this is mathematically correct, it can
result in roundoff errors.
For example, check out log base 2 of 2^34:
LN(2^34)/ LN(2) --> 33.9999999999
LOG(2^34)/LOG(2) --> 34.0000000001
Sometimes LOG is wrong and LN correct; other times vice versa.
Sometimes both are right; sometimes both are wrong. When both
are wrong, sometimes they straddle the correct answer (as in
the example above), and sometimes they are both less than (or
greater than) the correct answer. It's not predictable.
If 12-digit accuracy is not required, use the log/log method.
If full machine accuracy is required, however, then use LOGB
by Paul Dale, available on Goodies Disk #5. It merely does
log/log in System RPL using long reals. It gets the correct
answer for log base 2 of 2^34.
-Joe-
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
The following program LOGX(Y,X) takes log(Y) [level-2], base X [level-1],
using extended precision intermediate computations for greatest accuracy
(just as do all internal HP48 functions); if the arguments are not both
real numbers, however, then a more conventional approach is taken:
%%HP: T(3); @ include this line only for Kermit transfer PC -> HP48
@ Use either with stack args or as algebraic function of 2 args
\<< \-> y x \<< x y IF OVER TYPE OVER TYPE OR THEN LN SWAP LN /
ELSE #2B45Ch SYSEVAL #2AB5Bh SYSEVAL SWAP #2AB5Bh SYSEVAL
#2A9E8h SYSEVAL #2A5B0h SYSEVAL END \>> \>>
@ Checksum #8B08h, 158 bytes (on stack)
SysRPL (main computation): 2%>%% %%LN SWAP %%LN %%/ %%>%
[the first word converts 2 reals at once, the rest are "obvious"]
Warning: SYSEVAL's emit hazardous radiation, which may nuke all of
your memory if they are either entered or used incorrectly;
verify checksum before using.
Some errors (e.g. negative input) will leave not only a "Long Real"
on the stack, but also an "External" (PTR 0), which you should discard.
LOGB (GD#5) takes arguments in the opposite order, and is not structured
as a function usable in algebraics, but it behaves more nicely upon errors.
See also LONGAGO.DOC from the same GD#5.
-----------------------------------------------------------
With best wishes from: John H Meyers <jhme...@mum.edu>
>No, but you don't need to. In fact, strictly speaking you don't need
>the LOG function if you have the LN function (and vice versa, if you
>have or know the value of e as well).
>
>If you know anything about logarithms, you also know the following
>equality: a^log(x) = b^log(x)/b^log(a). So, in order to calculate
>2^log(8000) you can use either log(8000)/log(2) or ln(8000)/ln(2).
>That's just basic mathematical knowledge. A scientific calculator is a
>tool, not a magical device...
>
>Oh, by the way. If you want to use the 2^log() function (also know as
>lg() to computer scientists) often, you can put the following program
>in your HP48's home directory under the name of 'LG' and then simply
>use LG in algabraic expressions as you would LOG or LN:
>
><< -> x 'LN(x)/LN(2)' >>
Hi.
Could you help me a little.
When you white a^log(x) do you mean a log with base of a or a with
potential of log(x)...
You whote a: " a^log(x) = b^log(x)/b^log(a) " could you look in my
attachment and tell me is it the one by 1. or one by 2.
Thanks in advance for your answer.
***************************************************
If you wan't to e-mail me delete "_REMOVE_THIS_" from my e-mail address
***************************************************
Spam Bait
Chairman Reed Hundt: rhu...@fcc.gov
Commissioner James Quello: jqu...@fcc.gov
Commissioner Susan Ness: sn...@fcc.gov
Commissioner Rachelle Chong: rch...@fcc.gov
More SPAM Bait: ro...@mailloop.com,jo...@mailloop.com,jor...@earthlink.net
ma...@SALLYNET.COM , iq2...@usa.net , rem...@hotmail.com
fr...@ca.udec.edu
begin 644 log.gif
<encoded_portion_removed>
end
>There's also a program called LOGB that takes two arguments from the
>stack and returns the answer. It is slightly better than
>log_x y = log y / log x
>because the program uses full internal precision so it doesn't
>compound the rounding error.
Would you be so kind and send me the mentioned program, or at least
tell m ewhere can I find it.
Thanks in advance.