0

I am trying to learn something new, and this might be the wrong place for it.

I have this: Math thing

and I have a few questions

  1. What do you call this, an algorithm?
  2. If I want to learn how to read it where should I start
  3. how would this translate in to c#, would I be right in thinking k = Math.Log(m / n) * 2; ? (I know that in .net Math.Log is ln and Math.Log10 is log.)

EDIT I am looking at Bloom Filters - https://en.wikipedia.org/wiki/Bloom_filter - this is the equation for finding the optimal number of hashes to use. K is the optimal number of hashes M is the known number of bits in the array/filter N is the known number of elements to be added to the filter

Stuart
  • 111
  • 1
    I'm new here. A comment on the down vote would be helpful. – Stuart Jun 28 '18 at 15:42
  • 1
    An algorithm is a process where you follow a set of rules to get a result. This would be more of an equation. Edit: also what are $k,m,n$? – The Integrator Jun 28 '18 at 15:43
  • Obviously it is an equation (or assignment). And the log is applied to 2 not to $m/n.$ – gammatester Jun 28 '18 at 15:48
  • $k, m, n$ are variables (maybe all integers), and $k = \frac mn \ln 2$ is an equation stating that $k$ is equal to $m$ divided $n$ times the natural logarithm of $2$. – amWhy Jun 28 '18 at 15:51
  • In the cited Wiki article $k$ is an integer, where as simple coding would give a floating point. – gammatester Jun 28 '18 at 15:52

1 Answers1

1

It is a formula or an equation rather than an algorithm - an algorithm would have multiple steps.

In C# I think you would write this as

k = (m/n)*Math.Log(2)

This assumes that you have values for $m$ and $n$ and want to assign a value to $k$.

gandalf61
  • 15,326