473,224 Members | 1,597 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,224 software developers and data experts.

Logarithms

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
Jul 21 '05 #1
13 2467
Konstantin Loguinov wrote:
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/d...01592c48-207d-
4be1-8a76-1c4099d7bbb9&DisplayLang=en
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 21 '05 #2
Nevermind... Log and Ln in Excel are aparently two different functions.

K

"Konstantin Loguinov" <st*********@hotmail.com.NOSPAM> wrote in message
news:O3**************@TK2MSFTNGP12.phx.gbl...
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

Jul 21 '05 #3
Konstantin Loguinov wrote:
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.
Jul 21 '05 #4
Dave Anderson wrote on 03 nov 2004 in
microsoft.public.inetserver.asp.general:
Konstantin Loguinov wrote:
Nevermind... Log and Ln in Excel are aparently two different
functions.


And yet they differ only by a constant.


Impossible, but the results could.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress,
but let us keep the discussions in the newsgroup)

Jul 21 '05 #5
Evertjan. wrote:
Nevermind... Log and Ln in Excel are aparently two different
functions.


And yet they differ only by a constant.


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.
Jul 21 '05 #6
Dave Anderson wrote on 03 nov 2004 in
microsoft.public.inetserver.asp.general:
Evertjan. wrote:
Nevermind... Log and Ln in Excel are aparently two different
functions.

And yet they differ only by a constant.


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.


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
}
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress,
but let us keep the discussions in the newsgroup)

Jul 21 '05 #7
Evertjan. wrote:
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.


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.
Jul 21 '05 #8
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.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress,
but let us keep the discussions in the newsgroup)

Jul 21 '05 #9
Evertjan. wrote:
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.


It is a constant.
http://msdn.microsoft.com/library/en...6jsproln10.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.
Jul 21 '05 #10
Evertjan. wrote:
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.
Jul 21 '05 #11
Dave Anderson wrote on 04 nov 2004 in
microsoft.public.inetserver.asp.general:
Evertjan. wrote:
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.


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.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress,
but let us keep the discussions in the newsgroup)

Jul 21 '05 #12
Evertjan. wrote:
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.
ln(10) is a constant in the mathematical sense


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.
Jul 21 '05 #13
Dave Anderson wrote on 04 nov 2004 in
microsoft.public.inetserver.asp.general:
Evertjan. wrote:
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".
ln(10) is a constant in the mathematical sense


Certainly not, only the resulting value is constant.


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[s].

There is a difference between a constant and a variable having a
constant 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.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress,
but let us keep the discussions in the newsgroup)

Jul 21 '05 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

24
by: Philipp | last post by:
Hello (not sure this is the right forum for that question so please redirect me if necessary) How can I know how many double values are available between 0 and 1? On my machine (pentium 3) I get...
1
by: limelight | last post by:
I have discovered a math error in the .NET framework's Log function. It returns incorrect results for varying powers of 2 that depend on whether the program is run from within the IDE or from the...
3
by: Alex Vinokur | last post by:
Dann Corbit has implemented function int ilog2 (unsigned long) at http://groups.google.com/groups?selm=lkPa4.2165%24I41.1498%40client Is exist a similar C++-function for very large numbers,...
2
by: cowboyboborton | last post by:
Looking for some help here. I've tried to solve this, but I just can't. What I need to know is what formula to use in an excel calculation to complete the following calculation. It's in two...
11
by: Russ | last post by:
I have a couple of questions for the number crunchers out there: Does "pow(x,2)" simply square x, or does it first compute logarithms (as would be necessary if the exponent were not an integer)?...
1
by: Oscar Patarroyo Velasco | last post by:
-- Oscar Patarroyo Velasco Sistemas y Asesorias de Colombia Bogotá, Colombia
18
by: xahlee | last post by:
Last year, i've posted a tutorial and commentary about Python and Perl's sort function. (http://xahlee.org/perl-python/sort_list.html) In that article, i discussed a technique known among...
109
by: jmcgill | last post by:
Hello. Is there a method for computing the number of digits, in a given numeric base, of N factorial, without actually computing the factorial? For example, 8! has 5 digits in base 10; 10! has...
3
by: dynamo | last post by:
Is there a formula for finding logarithms to base two of a number.If so wtat is it.Thanks for any replying.
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.