HP Forums

Full Version: logₓy
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
hi all,

I had cause to work out log₂ of a number today, and was vaguely surprised that I couldn't find it on my calculators, not even as a function, let alone on a key. Nor the more general logₓy.

The WP 34S is to be congratulated for having both on keys, but I can't find either even as a function on my DM42 or HP 50g.

It's trivial to write my own fn for e.g LOGy(x) (e.g. LOG SWAP LOG ÷), but am I missing something?
No, I think it is wanted. The log in different bases are not often used, compared to log_e and log_10 , therefore for other bases you are on your own.

you can contribute here:

http://www.hpmuseum.org/forum/thread-10271.html
thanks; I've added a comment to that thread.
I was having the opposite problem the other day trying to (somewhat quickly) take the log_10 of some number on a Casio fx-991EX, but the button I was using required an argument for the base and I thought it strange there'd be a button for that but not one for log_10. I did ultimately find it as a shifted function on the (-) key. At the time I thought it interesting that logₓy had its own button but log_10 didn't.
.
Hi,

(01-12-2019 09:09 PM)cdmackay Wrote: [ -> ]I had cause to work out log₂ of a number today, and was vaguely surprised that I couldn't find it on my calculators, not even as a function, let alone on a key. Nor the more general logₓy.

The HP-71B has several log functions (some in the mainframe and some in various ROMs), including LOG2(X) which admittedly is very handy for all sort of programming tasks.

I also think that the HP-75 had a general Log to any base, not sure if in the mainframa or perhaps in some ROM or other.

V.
thanks both,

(01-12-2019 10:42 PM)Benjer Wrote: [ -> ]I was having the opposite problem the other day trying to (somewhat quickly) take the log_10 of some number on a Casio fx-991EX, but the button I was using required an argument for the base and I thought it strange there'd be a button for that but not one for log_10. I did ultimately find it as a shifted function on the (-) key. At the time I thought it interesting that logₓy had its own button but log_10 didn't.

yup, it's not even a shifted fn there, but the main key fn.

(01-12-2019 10:49 PM)Valentin Albillo Wrote: [ -> ]The HP-71B has several log functions (some in the mainframe and some in various ROMs), including LOG2(X) which admittedly is very handy for all sort of programming tasks.

I also think that the HP-75 had a general Log to any base, not sure if in the mainframa or perhaps in some ROM or other.

I'll add one of those to my wish-list Smile
(01-12-2019 09:09 PM)cdmackay Wrote: [ -> ]It's trivial to write my own fn for e.g LOGy(x) (e.g. LOG SWAP LOG ÷), but am I missing something?


LOGx(y) sounds more natural to me:

« LN XROOT LN »

Shorter, but probably slower.
(01-12-2019 10:49 PM)Valentin Albillo Wrote: [ -> ]I also think that the HP-75 had a general Log to any base, not sure if in the mainframa or perhaps in some ROM or other.

The HP-75/71 mainframes include:

LOG(X) Base e Log of X
LOG10(X) Base 10 Log of X; 71B can also use LGT(X)


The HP-75/71 MATH ROMs include:

LOG2(X) Base 2 Log of X
LOGA(X,N) Base N Log of X (75 Only)

The 71B also includes LOGP1(X) which is the value of Ln(1+x)


So, pretty complete.
rprosperi Wrote:The HP-75/71 mainframes include:

LOG(X) Base e Log of X
LOG10(X) Base 10 Log of X; 71B can also use LGT(X)

The HP-71B also has LN(X) as an alternate spelling.

Quote:The 71B also includes LOGP1(X) which is the value of Ln(1+x)

So, pretty complete.

Yes, in the HP-71B you have in all six log possibilities, namely LN, LOG, LOG10, LOG2, LOGP1, LGT and if you fancy log to any base you simply define:

10 DEF FNL(X,N)=LN(X)/LN(N)

and then you can use FNL(X,N) as part of any expression in a program, from the command line or in (urg!) CALC mode. Also, creating a new assembly-language keyword LOGA(X,N) in a LEX file is utterly trivial and would take just a few bytes.

V.
.
(01-13-2019 12:40 AM)Gerson W. Barbosa Wrote: [ -> ]
(01-12-2019 09:09 PM)cdmackay Wrote: [ -> ]It's trivial to write my own fn for e.g LOGy(x) (e.g. LOG SWAP LOG ÷), but am I missing something?


LOGx(y) sounds more natural to me:

« LN XROOT LN »

Shorter, but probably slower.

nice. I think I'd just have put in an extra SWAP, but yours is more elegant.
(01-13-2019 12:40 AM)Gerson W. Barbosa Wrote: [ -> ]LOGx(y) sounds more natural to me:

Yes, and I'm glad it is defined this way on the WP34s.

(01-13-2019 12:40 AM)Gerson W. Barbosa Wrote: [ -> ]« LN XROOT LN »

That's a nice one. And it also works in RPN, e.g. on the 35s.

Dieter
(01-13-2019 01:29 AM)rprosperi Wrote: [ -> ]The HP-75/71 mainframes include:

why is the 75/71 a mainframe? were those not pocket computers?

edit: ah, maybe you mean the basic library without expansion cards.
(01-13-2019 09:11 AM)pier4r Wrote: [ -> ]why is the 75/71 a mainframe? were those not pocket computers?

Nobody is saying that they are mainframes. They have mainframes.

(01-13-2019 09:11 AM)pier4r Wrote: [ -> ]edit: a maybe you mean the basic library without expansion cards.

Correct Smile
A pocket computer has a mainframe?

Like Dr Who's Tardis, I guess - it's bigger on the inside.

It doesn't help that the forums on this site combine calculators and computers, so it's not immediately obvious unless you remember all the model numbers.
(01-13-2019 12:40 AM)Gerson W. Barbosa Wrote: [ -> ]LOGx(y) sounds more natural to me:

We write \(\log_b(x)\) and Mathematica uses:
Quote:Log[b,z]
gives the logarithm to base b.

Thus my intuition is to use: logy(x)
Exactly as you suggested.

(01-13-2019 08:47 AM)Dieter Wrote: [ -> ]Yes, and I'm glad it is defined this way on the WP34s.

No, it's sad it is defined this way on the WP-34s.

Cheers
Thomas
All of the programming languages I used that have log to a specified base, put the base second. I.e. log(x, b).

The 34S did originally calculate logxy, but we changed the arguments around. I have a vague memory that this was to be consistent with yx, but I could be wrong.


Pauli
(01-13-2019 11:07 AM)Paul Dale Wrote: [ -> ]All of the programming languages I used that have log to a specified base, put the base second. I.e. log(x, b).

The 34S did originally calculate logxy, but we changed the arguments around. I have a vague memory that this was to be consistent with yx, but I could be wrong.

?!? – all 34s versions I ever used calculate logxy. That's also what is shown on the emulator skins.

I remember well the discussion about the argument order. My point is that you usually have a number in X and then you want to calculate the base-x-log of it. For a base-5-log you now simply enter 5 [logxy]. Just as you do it with powers: 5 [yx].

5 [ENTER] 3 [yx] =>125
5 [logxy] => 3

So this is similar to he mentioned log(x, b) function in the programming languages: enter x first, then the base. It's only that in RPN the x-value happens to end up in Y and the base b in X. ;-)

Dieter
I apologise to those who prefer the other ordering/labelling Smile

I don't think I gave it much thought, but my naive thinking involved seeing e.g. log₂ as the function, and I normally use x to denote the input of f(), leaving y as the base.

but I quite see the alternative, especially when you consider it as a function with two arguments, which of course it is.

thanks!

PS and I would normally write x-to-the-y, but it's often y-to-the-x on calculators.
(01-13-2019 11:07 AM)Paul Dale Wrote: [ -> ]All of the programming languages I used that have log to a specified base, put the base second. I.e. log(x, b).

The 34S did originally calculate logxy, but we changed the arguments around. I have a vague memory that this was to be consistent with yx, but I could be wrong.

FWIW, and adding insult to injury, the SandMath has LOGYX where Y denotes the base and X the argument - blame it to the reverse part of RPN ;-)
In the interests of fairness, I'm pleased to note that the Prime has both a key for logb (the 'C' key's collection of fill-in examples), and a LOG(x, b) function [CAS logb(x, b)].
Pages: 1 2
Reference URL's