3 Replies - 34271 Views - Last Post: 19 April 2010 - 02:53 AM Rate Topic: -----

#1 henryl  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 24
  • Joined: 12-May 06

How to Implement n-base logarithm

Post icon  Posted 30 May 2006 - 09:34 AM

Hi.

I'm trying to generate random numbers with a Cellular Automata. For this, I implement a Genetic Algorithm which find the best rule for the Automata's cells. The Genetic Algorithm evaluate the rules, but it needs to use the two-base logarithm, and the lybrary math.h don't implement this function.

Does exist any library that implement n-base logarithm?

Thanks.
Is This A Good Question/Topic? 0
  • +

#5 Nova Dragoon  Icon User is offline

  • The Innocent Shall Suffer, Big Time
  • member icon

Reputation: 36
  • View blog
  • Posts: 6,169
  • Joined: 16-August 01

Re: How to Implement n-base logarithm

Posted 30 May 2006 - 09:46 AM

you could use the dirty math hack to do change of log bases

its

logb (x) = (loga(x)) / (loga(B))
example

log base 2 (5) = (log base 10 (5) ) / (log base 10 (2) )
Was This Post Helpful? 1

#6 William_Wilson  Icon User is offline

  • lost in compilation
  • member icon

Reputation: 205
  • View blog
  • Posts: 4,807
  • Joined: 23-December 05

Re: How to Implement n-base logarithm

Posted 30 May 2006 - 10:36 AM

I don't think there is a library to do such a thing as the formula is not all that complex. There is a function in the math/h library to handle log and that is considered sufficient.
Was This Post Helpful? 0
  • +
  • -

#7 Guest_SAMEER*


Reputation:

Re: How to Implement n-base logarithm

Posted 19 April 2010 - 02:53 AM

View PostNova Dragoon, on 30 May 2006 - 08:46 AM, said:

you could use the dirty math hack to do change of log bases

its

logb (x) = (loga(x)) / (loga(B))
example

log base 2 (5) = (log base 10 (5) ) / (log base 10 (2) )

this code is correct.
Was This Post Helpful? 0

Page 1 of 1