Logarithms

  • Thread starter Konstantin Loguinov
  • Start date
K

Konstantin Loguinov

Guys,

Here is my sample ASP code

<%
response.write log(2.63852242744063E-03)
%>

It shows -5.93753620508243 for result.

The same formula in Excel (or Google calculator) returns -2.57863921

Am I missing something?!?

K
 
B

Bob Barrows [MVP]

Konstantin said:
Guys,

Here is my sample ASP code

<%
response.write log(2.63852242744063E-03)
%>

It shows -5.93753620508243 for result.

The same formula in Excel (or Google calculator) returns -2.57863921

Am I missing something?!?

K

Yes. The vbscript log function returns the natural log of a number, not the
base-10 log. From the documentation:

You can calculate base-n logarithms for any number x by dividing the natural
logarithm of x by the natural logarithm of n as follows:

Logn(x) = Log(x) / Log(n)The following example illustrates a custom Function
that calculates base-10 logarithms:

Function Log10(X)
Log10 = Log(X) / Log(10)
End FunctionOh! The vbscript documentation can be downloaded
here:http://www.microsoft.com/downloads/details.aspx?FamilyID=01592c48-207d-
4be1-8a76-1c4099d7bbb9&DisplayLang=en
 
K

Konstantin Loguinov

Nevermind... Log and Ln in Excel are aparently two different functions.

K
 
D

Dave Anderson

Konstantin said:
Nevermind... Log and Ln in Excel are aparently two different
functions.

And yet they differ only by a constant.



--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
 
E

Evertjan.

Dave Anderson wrote on 03 nov 2004 in
microsoft.public.inetserver.asp.general:
And yet they differ only by a constant.

Impossible, but the results could.
 
D

Dave Anderson

Evertjan. said:
Impossible, but the results could.

Not impossible - fact. ln(10) is a constant, and ln(x) = ln(10) * log(x).
Put another way, ln(x)/log(x) is a constant, so one is merely a scaled
version of the other.



--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
 
E

Evertjan.

Dave Anderson wrote on 03 nov 2004 in
microsoft.public.inetserver.asp.general:
Not impossible - fact. ln(10) is a constant, and ln(x) = ln(10) *
log(x). Put another way, ln(x)/log(x) is a constant, so one is merely
a scaled version of the other.

But Dave, they are not functions. ln(1) is not a function in itself., it
is a function of 10.

If this where true, all functions resulting [for fixed parameters] in a
constant value could only differ by a constant.

=========

I concede to the fact that some routines without external variable
parameters and resultiong in a constant are mistakenly(!) called
functions in vbs, js and other languages.

function ten()
ten=10
ensd function

function ten(){
return 10
}
 
D

Dave Anderson

Evertjan. said:
But Dave, they are not functions. ln(1) is not a function in itself.,
it is a function of 10.

I assume you mean ln(10), not ln(1). In either case, you are not quite
correct. ln(x) is a function of x. ln(10) is not a function of 10, it is a
constant. x is a variable, 10 is a constant. ln(x) *depends* on x, ln(10)
does not depend on anything. it is always the same value, hence a
"constant".

If this where true, all functions resulting [for fixed parameters] in
a constant value could only differ by a constant.

But ln(x)/log(x) is exactly the same for EVERY x**. This has nothing to do
with fixed parameters.


I concede to the fact that some routines without external variable
parameters and resultiong in a constant are mistakenly(!) called
functions in vbs, js and other languages.

function ten()
ten=10
ensd function

function ten(){
return 10
}

That is not the issue. I am referring to two true functions which are scalar
multiples of each other, such as:

f(x) = the bitlength of string x
g(x) = the bytelength of string x




**Bearing in mind, of course, that neither ln(x) nor log(x) makes sense
unless x > 0

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
 
E

Evertjan.

Dave Anderson wrote on 03 nov 2004 in
microsoft.public.inetserver.asp.general:
ln(10)
does not depend on anything. it is always the same value, hence a
"constant".

Yes, it is constant in value.

No it is not a(!) constant, it is a function.
The return of a value takes much longer than that of a constant.
 
D

Dave Anderson

Evertjan. said:
Yes, it is constant in value.

No it is not a(!) constant, it is a function.
The return of a value takes much longer than that of a constant.

It is a constant.
http://msdn.microsoft.com/library/en-us/script56/html/js56jsproln10.asp


--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
 
D

Dave Anderson

Evertjan. said:
No it is not a(!) constant, it is a function.
The return of a value takes much longer than that of a constant.

I should clarify. The last response was meant to be tongue-in-cheek, but
perhaps more like kidding on the square. ln(10) is a constant in the
mathematical sense, and frequently in the *implementation* sense, as in the
JScript example I provided.

But any way you look at it, it is precisely the ratio of ln(x) to log(x),
when log(x) uses a base of 10. And in that context -- the whole point of
this diversion -- a fixed value is no different from a constant. You cannot
pretend that log(x) differs from ln(x) in any way but a constant scalar.



--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
 
E

Evertjan.

Dave Anderson wrote on 04 nov 2004 in
microsoft.public.inetserver.asp.general:
I should clarify. The last response was meant to be tongue-in-cheek,
but perhaps more like kidding on the square. ln(10) is a constant in
the mathematical sense, and frequently in the *implementation* sense,
as in the JScript example I provided.

But any way you look at it, it is precisely the ratio of ln(x) to
log(x), when log(x) uses a base of 10. And in that context -- the
whole point of this diversion -- a fixed value is no different from a
constant. You cannot pretend that log(x) differs from ln(x) in any way
but a constant scalar.

Oh yes, I do pretend it is not a constant in the computer programming
language sense, even the way you write it is different. [The proof of
that I can is in this last sentense]
ln(10) is a constant in the mathematical sense

Certainly not, only the resulting value is constant.

There is a difference between a constant and a variable having a constant
value.

While you could say, a variable is always a constant, I would disagree,
as much as a function is not a constant.

A variable has a constant value AS LONG AS the value is not changed.

A constant has a constant value, that is not allowed to be changed after
creation.

A function is always a function OF something, where the something is able
to change the function.

A tongue in cheek is a joy forever, but if you realy keep it constant, it
could turn out to cause a pain in the neck.
 
D

Dave Anderson

Evertjan. said:
Oh yes, I do pretend it is not a constant in the computer programming
language sense, even the way you write it is different. [The proof of
that I can is in this last sentense]

Math.LN10 is not read-write. It is constant. You may continue to ignore the
fact that implementation matters if you want.


Certainly not, only the resulting value is constant.

I can only conclude that you don't understand mathematics.


There is a difference between a constant and a variable having a
constant value.

This is tedious. I have been using the notation ln(10) as a syntactic
shorthand for the constant value represented by the natural logaritm of ten,
but you insist this means I am calling a function. Go ahead - be obtuse. My
point is made.



--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
 
E

Evertjan.

Dave Anderson wrote on 04 nov 2004 in
microsoft.public.inetserver.asp.general:
Evertjan. said:
Oh yes, I do pretend it is not a constant in the computer programming
language sense, even the way you write it is different. [The proof of
that I can is in this last sentense]

Math.LN10 is not read-write. It is constant.

Jscript Math.LN10 is NOT a function.
The Math collection has predefined constants.

btw: functions are never read/write.
You may continue to
ignore the fact that implementation matters if you want.

Plase explain if you think that your implementation changes the
definitions of mathematical and programme language concept like
"function".
I can only conclude that you don't understand mathematics.

No need to get personal. Getting personal does not strengthen a point
becaus it degrades credability.

I thought we were talking primarily wich is the ASP platform and it's
computer languages.

But in mathematics the concept "function" only exists as a result
variably dependent on its "function of" input value.

This is tedious.

No, it is not, Dave. The notion of "function" in programming and also in
pure mathematics is an important concept.

However, it could be tedious to you, and if so, I suggest you do not
answer anymore.
I have been using the notation ln(10) as a syntactic
shorthand for the constant value represented by the natural logaritm
of ten, but you insist this means I am calling a function. Go ahead -
be obtuse.

Thank you for allowing me to go agead.

You definitely are calling a function here, I insist.

Using a function as a "syntactic shorthand for the constant value" is
what I told you about the difference between "a constant" and something,
here a function, having "a constant value".

I am glad you in fact use that difference in your answer.

The function ln() only has a constant value, because you feed it with a
constant argument. That is exactly what the definition of a function is.
My point is made.

Certainly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top