logarithm

What does O(log n) mean exactly?

I am currently learning about Big O Notation running times and amortized times. I understand the notion of O(n) linear time, meaning that the size of the input affects the growth of the algorithm proportionally...and the same goes for, for example, quadratic time O(n2) etc..even algorithms, such as permutation generators, with O(n!) tim...

How to calculate the curve of a linear floating point number in Javascript?

How do I calculate a curve of a linear floating point number (0 to 1) and get another floating point number as a result? What I want is up until the half (0..0.5), to be inversed logarithmic and high than that to be logarithmic like a curve according to the given linear value. ...

How to find a binary logarithm very fast? (O(1) at best)

Is there any very fast method to find a binary logarithm of an integer number? For example, given a number x=52656145834278593348959013841835216159447547700274555627155488768 such algorithm must find y=log(x,2) which is 215. x is always a power of 2. The problem seems to be really simple. All what is required is to find the position of...

Pruning data for better viewing on loglog graph - Matlab

Hi Guys, just wondering if anyone has any ideas about an issue I'm having. I have a fair amount of data that needs to be displayed on one graph. Two theoretical lines that are bold and solid are displayed on top, then 10 experimental data sets that converge to these lines are graphed, each using a different identifier (eg the + or o or ...

Implementing Operator Overloading with Logarithms in C++

Hello my friends, I'm having some issues with implementing a logarithm class with operator overloading in C++. My first goal is how I would implement the changeBase method, I've been having a tough time wrapping my head around it. I have tried to understand the math behind changing the base of a logarithm, but i haven't been able to....

How can I compare the performance of log() and fp division in C++?

Hi, I’m using a log-based class in C++ to store very small floating-point values (as the values otherwise go beyond the scope of double). As I’m performing a large number of multiplications, this has the added benefit of converting the multiplications to sums. However, at a certain point in my algorithm, I need to divide a standard dou...

Difference between Logarithmic and Uniform cost criteria

I'v got some problem to understand the difference between Logarithmic(Lcc) and Uniform(Ucc) cost criteria and also how to use it in calculations. Could someone please explain the difference between the two and perhaps show how to calculate the complexity for a problem like A+B*C (Yes this is part of an assignment =) ) Thx for any hel...

Any way to specify the base of math.log() in javascript?

I need a log function in my javascript but it needs to be base 10, I can't see any listing for this so I'm assuming it's not possible... any math wizards out there know of an approach for this? Or maybe I'm missing something and there is a way? ...

How to draw tick marks on a log graph?

Given a range '1 to x', with a tick mark spacing 'y' such that 'y' < 'x/2', how do I draw the tick marks on a graph in log 10? Is there a generalized algorithm for this sort of thing? I should have added this is in c# for a custom control. ...

How do you calculate log base 2 in Java for integers?

I use following function to calculate log base 2 for integers: public static int log2(int n){ if(n <= 0) throw new IllegalArgumentException(); return 31 - Integer.numberOfLeadingZeros(n); } Does it has optimal performance? Does someone know ready J2SE API function for that purpose? UPD1 Surprisingly for me, float point arith...

What is the difference between 'log' and 'symlog'?

In matplotlib, I can set the axis scaling using either pyplot.xscale() or Axes.set_xscale(). Both functions accept three different scales: 'linear' | 'log' | 'symlog'. What is the difference between 'log' and 'symlog'? In a simple test I did, they both looked exactly the same. I know the documentation says they accept different paramet...

Passing double types to ceil results in different values for different optimization levels in GCC

Below, the result1 and result2 variable values are reporting different values depending upon whether or not you compile the code with -g or with -O on GCC 4.2.1 and on GCC 3.2.0 (and I have not tried more recent GCC versions): double double_identity(double in_double) { return in_double; } ... double result1 = ceil(log(32.0) / log(...

Big O Log problem solving

I have question that comes from a algorithms book I'm reading and I am stumped on how to solve it (it's been a long time since I've done log or exponent math). The problem is as follows: Suppose we are comparing implementations of insertion sort and merge sort on the same machine. For inputs of size n, insertion sort runs in 8n^2 steps,...

Logarithmic Mouse Movement

Alright, this is probably gonna be a pretty simple question to answer. I haven't had a math class dealing with logarithms in a few years, so I apologize. So I have a USB Controller that I'm using to control the mouse on the screen with the left joystick. Now how this works right now is the controller returns a double between 0.00 and 1.0...

Log to the base 2 in python

How should I compute log to the base 2 in python. Eg. I have this equation where i am using log base 2 import math e = -(t/T)* math.log((t/T)[, 2]) ...

Java: Generating a random numbers with a logarithmic distribution

I am attempting to generate a random numbers with a logarithmic distribution. Where n=1 occurs half of the time, n=2 occurs a aurter of the time, n=3 occurs an eight of the time, etc. int maxN = 5; int t = 1 << (maxN); // 2^maxN int n = maxN - ((int) (Math.log((Math.random() * t)) / Math.log(2))); //...

How do I calculate a logarithm in iOS?

I want to calculate a logarithm in iOS. Can Objective-C do this? ...

What does "log*" mean?

I have come across the term O(log* N) in a book I'm reading on data structures. What does log* mean? I cannot find it on Google, and WolframAlpha doesn't understand it either. ...

solving log in iphone objective c calculations

how can a logarithm be solved on the iphone. I tried using different methods with the log2f and all those however I wasnt sure exactly how to make a log lets say log (base4) 5 = x and x would be given as the answer ...

To Compute log(a+b)

I want the complete expansion of log(a+b)=? for ex log(a*b)=log a + log b; log(a/b)=lob a - log b; Similar to this, is there any expansion for log(a+b)??? Thanks in advance... ...