Way OT Logarithms

Creagerj

Incidental Artist
Local time
6:46 AM
Joined
Jan 25, 2006
Messages
626
I am currently learning how to use visual basic and I need to know how to calculate a logarithm. Does anyone know how to compute a logarithm in visual basic or perhaps know how to explain to me how the logarithm formula works? I tired looking it up but I don't understand the formula. So basically I need it explained to me in the simplest way possible, or I need to know the command that can be written in the code line to calculate a log. I'm visual so examples help.
 
I don't know anything about Visual Basic, but a logarithm is the exponent by which you need to raise a base number to get another number. In common logarithms, the base number is 10, and in natural logarithms, the base number is a constant called e. Or the base can be a user-specified number.

Example: 10 squared -- that is, 10 raised by the exponent of 2 -- is 100. So, the common logarithm of 100 is 2. Is that the kind of stuff you need to know?

I found this page, with a Java calculator, but the calculator confused me more than the text explanation! Still, if you want, click here.

Again, I don't know anything about Visual Basic, but I'd think there would almost have to be a function call that will calculate the logarithm for any number and base. One common syntax for this would be LOGARITHM(number, base) so to do the above example, you'd include a program statement along the lines of:

myVal = LOGARITHM(100,10)

and the function would assign the variable myVal a value of 2, because 2 is the power by which you have to raise 10 to get 100.

I have no idea at all whether this is the kind of thing you need to know or not, but hey, at least I tried. Good luck...
 
I don't know anything about Visual Basic, but I was a math minor in undergrad. (Don't ask me how to do matrix inversions or diff-eq's, I haven't used that stuff since the exams!) Many calculators and computers use logarithms in the base e (Euler's constant) which are known as natural logarithms, and this may be confusing you if you are expecting common logarithms in the base 10.

As I said, I have never touched Visual Basic, but logarithm functions in various computer systems use functions like log(x), logn(x), log10(x) and they vary quite a bit.

JLW gave a very good overview of logarithms so I won't repeat any of that. :)

If you need it, there's a very simple formula to convert logarithms from one base to another, like if you have to compute common logs and your machine will only do natural logs. Example of this, if you have to do a log10() and all you have is logn() would be (and please excuse the formatting):

log10(x) = logn(x) / logn(10)

In the above, logn() is the natural (base e) log function and the result will be the logarithm in the base 10 of x.

I hope this helps at least somewhat.
 
Back
Top Bottom