Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / Logarythmes => log(number,base)

Author
Message
Attreid
21
Years of Service
User Offline
Joined: 27th Nov 2002
Location:
Posted: 24th May 2003 01:33
there aren't logarythmes in dbp, so I've made a function

first, I have to tell you that there are two restrictions :
- it doesn't work for the number very high
- it doesn't work for the "first numbers" ("nombres premiers" in french => a number that can be divised only by one and itself) higher than the last first number that you have stocked in the array npr()
but theses restrictions aren't importants because you can easily upgrade this snippet

how do you can upgrade this code ? it's easy :
first, you need a calculator that can give the log of a number in base 10 (I use my TI-30X)
then, you go there : http://no-reality.dyn.dhs.org/public/primes/myriade.php3?myriade=0
after that, look in the code the last first number that is in the array npr() (it is 227 in the code that I'll post)
find in the web site the next first number (it is 229)
add it in the array (make it wider in the dim, not (49) but (50) )

and now, you have one more first number => you can have logs of numbers a bit higher

now, the code : click on the button under this message
Bu$herie
How many civilians is he going to kill ? he's going to burn in hell, and I hope that his pain will make him inderstand !
kevil
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Netherlands
Posted: 24th May 2003 01:37
I just made this code today. Maybe not so fast, but works ok.

Kevil

MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 24th May 2003 01:47
And I've got a plug-in for it...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
Attreid
21
Years of Service
User Offline
Joined: 27th Nov 2002
Location:
Posted: 24th May 2003 02:15
hehe, it looks like that my code is useless ^_^

Bu$herie
How many civilians is he going to kill ? he's going to burn in hell, and I hope that his pain will make him inderstand !
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 24th May 2003 02:29
Well, I didn't want to say it...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
Attreid
21
Years of Service
User Offline
Joined: 27th Nov 2002
Location:
Posted: 24th May 2003 02:45
lol, I know
but there are 2 systems better than mine, so mine is useless
I'm happy of it because my system may bug the game if a too high number is used

Bu$herie
How many civilians is he going to kill ? he's going to burn in hell, and I hope that his pain will make him inderstand !
QuothTheRaven
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 24th May 2003 06:56
there's no E or Y in logarithm...

Darken the skies, we are god
http://www.DelvarWorld.com
Attreid
21
Years of Service
User Offline
Joined: 27th Nov 2002
Location:
Posted: 24th May 2003 15:13
in french there is
hey, kevil, I've made this snippet because a friend asked in the gcn forum if there are logs in dbp
and guess which snippet he posted to tell me that my code is useless

Bu$herie
How many civilians is he going to kill ? he's going to burn in hell, and I hope that his pain will make him inderstand !
keeblerElf
20
Years of Service
User Offline
Joined: 11th Jun 2003
Location: United States
Posted: 20th Jul 2003 08:38
Why don't you just use the taylor series to find the natural logarithm of a number and then from there you would be able to find the logarithm of any number to any base without number restrictions

Dreamora
21
Years of Service
User Offline
Joined: 20th Sep 2002
Location: Switzerland
Posted: 20th Jul 2003 18:43
because DBP is that stupid slow for such works that it will take 10mins for a stupid log *ggg*

keeblerElf
20
Years of Service
User Offline
Joined: 11th Jun 2003
Location: United States
Posted: 20th Jul 2003 20:56
But the genius thing about the taylor series is that you can still get a good approximation with very little math at all

keeblerElf
20
Years of Service
User Offline
Joined: 11th Jun 2003
Location: United States
Posted: 10th Aug 2003 07:44
I was reading about Eulers Gamma constant the other day and I came up with this



It should be pretty quick because on my TI-86 it was fairly quick. Also if you want to find the Log A base B then all you have to do is say ln A/ln B. So if you wanted to find the log of 2 base 10 it would look like

ln(2.00)/ln(10.00)

Also not you need to put a number from the real number line into the function for it to work right

Live life and play video games
keeblerElf
20
Years of Service
User Offline
Joined: 11th Jun 2003
Location: United States
Posted: 10th Aug 2003 07:50
Also note that the higher the number is the more accurate the answer is. The function is only accurate to one decimal place for ln 2 but it is accurate to 5 decimal places for ln 100...so it gets more and more accurate fairly quickly

Live life and play video games

Login to post a reply

Server time is: 2024-04-26 16:03:26
Your offset time is: 2024-04-26 16:03:26