CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   Computer Programming (http://www.codingforums.com/forumdisplay.php?f=21)
-   -   c maths (http://www.codingforums.com/showthread.php?t=39513)

alaios 05-30-2004 04:32 PM

c maths
 
Hi i want to calculate the following function

T=-(1/l)*ln(1-y)...

I must do this without using an ln function...but only using the log...
Any good suggestion?
Thx :)

liorean 05-30-2004 04:43 PM

I won't give you the code to calculate it, but I can give you the formulae you want to utilise in writing it:

logfactor number=(logotherfactor number) / (logotherfactor factor)

The factor of ln is e, the factor of lb is 2, the factor of lg (sometimes called ld, sometimes called just log) is 10.

boris 05-31-2004 02:57 AM

basically, you want to calculate e and just use the log function on it
click here

liorean 05-31-2004 02:59 AM

What's the meaning of calculating E? Isn't it present in the math library already?

Antoniohawk 05-31-2004 04:13 AM

[http://www.mathworks.com/access/help.../functi10.html]
To calculate e, do exp(1).

boris 06-02-2004 12:20 PM

read what alaious said!!! you can only use log(etc.) function

jkd 06-02-2004 10:34 PM

Quote:

Originally Posted by liorean
The factor of ln is e, the factor of lb is 2, the factor of lg (sometimes called ld, sometimes called just log) is 10.

I've never seen it represented as ld before. In my maths, it has always been log for implicit base 10 and ln for implicit base e. In several algorithm books I own, I've seen lg used as implicit base 2. Not that it really matters with big-oh, but my books seem to prefer lg.

liorean 06-02-2004 10:46 PM

The typical usage is "log" followed by a subscript radix, space, and the number. Alternatively it can be "l" followed by a single character for the radix (b-binary, n-natural, d-decimal are the most common ones), space, and a number. Or, it can be "lg", which most often represents radix 10. It varies a bit, but those are the most common ones in mathematical representation.

Then programming languages don't look exactly like that, of course, so they use their own, native syntax.

jkd 06-02-2004 11:41 PM

Quote:

Originally Posted by liorean
The typical usage is "log" followed by a subscript radix, space, and the number. Alternatively it can be "l" followed by a single character for the radix (b-binary, n-natural, d-decimal are the most common ones), space, and a number. Or, it can be "lg", which most often represents radix 10. It varies a bit, but those are the most common ones in mathematical representation.

Then programming languages don't look exactly like that, of course, so they use their own, native syntax.

Once again, I've never seen that usage at all. I've studied everything from precalculus to partial differential equations to real analysis and abstract (modern) algebra, and never seen it done that way. I don't doubt that some authors have used it that way before, but I wouldn't pass it off as standard notation in any shape or form. log with no subscript is base 10 (unless it really doesn't matter or the mathematician is lazy to write the base each time), ln is base e. And I've seen far more literature using lg as base 2; to an extent that I could believe that lg is also accepted notation for the binary logarithm, and not the base 10 algorithm.

http://en.wikipedia.org/wiki/Binary_logarithm seems to agree. Also, Wikipedia lists ld as synonymous with the binary algorithm. Never seen it before, but eh, doesn't matter. But lg meaning base 10 is disconcerting to me.

jkd 06-02-2004 11:58 PM

Mathworld seems to have an acceptable explanation:
http://mathworld.wolfram.com/Lg.html

From Russia with love, eh liorean? :D

liorean 06-03-2004 01:07 AM

Actually, I've never seen 'lg' being used for binary logarithms before, but on the other hand I'm not that interested in math to have read that very many different sources. That you default to decimal when you hove no specified radix for 'log' is only natural, however.

As for your information, the books we used in gymnasial math seems to derive mainly from Swedish mathematical journals and sciences encyclopedias that in turn have centuries of history, deriving back to primarily two works: The journal Acta Mathematica (not sure about that spelling) by a number of famous Swedish mathematicians, and the Encyclopedia. I don't know from where the logarithm syntax in specific derives, however.



I do wonder about the conventions in international Mathematics, though. English conventions and litterature must have taken a greater prominence today, but I believe that Germany, France and Russia as well as a number of lesser Europeans nations, have had a large influence on the international conventions used in Math than the English speaking countries have.


All times are GMT +1. The time now is 05:01 PM.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.